How to attach addons product to a product

50 views
Skip to first unread message

moemen Abd ElKader

unread,
Oct 4, 2017, 12:45:41 PM10/4/17
to django-oscar
Hello,

I'm a new with django-oscar. And I was trying to implement a feature for a project I'm working on. I read documentation and explored the source code a little, but I'm still wondering if django-oscar have a shortcut to help me with that.

I want to add link products to a main product, so user has the option to buy them as part of the main product.

For example, Mobile phone can be attached to it's headphone, cover, charger, ... etc. User can select/deselect any of them, and he can of-course buy them independently.
And is it possible to apply discount or use different taxes in case that user selected those products?


Thank you for your help,
Moemen

Ryan Harrigan

unread,
Oct 4, 2017, 5:32:00 PM10/4/17
to django...@googlegroups.com
Hello Moemen, 

I am new to django-oscar as well. I think linked products can be implemented using the 'parent' property in the AbstractProduct class. Every product should have the 'parent' property because it is set in AbstractProduct. http://django-oscar.readthedocs.io/en/releases-1.5/topics/modelling_your_catalogue.html

Taxes are implemented in product.strategy.partner. You need to overload the partner app, particularly the strategy.py file and the Selector class. You may save some time using the Structured class like so:





class Selector(Structured):
    pass



You then need to define how you want to implement taxes with pricing_policy(). I think this should help you. 


If anyone wants to correct me, please do so.

Best,

Ryan

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/aebeb1c7-8b85-48c1-af31-1b1f0439b161%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Harrigan

unread,
Oct 5, 2017, 12:33:13 AM10/5/17
to django...@googlegroups.com
I apologize. I was mistaken with the syntax of Selector. Use the code below and modify the necessary methods in the Structured class.
Once again, if I am mistaken, please let me know



class Selector(object):

    def strategy(self, request=None, user=None, **kwargs):
        """
        Return an instanticated strategy instance
        """
        return Structured(request)

moemen Abd ElKader

unread,
Oct 5, 2017, 5:40:45 AM10/5/17
to django-oscar
Hello Ryan,

Thank you for your response.
But what I understand is that parent/children relationship is for variants. So, phones for example, variants would be the different colors and memory size.
But what I have here is different product.
Beside that for example, chargers can be attached to multiple products (phones), so relation should be many to many, shouldn't it?

Sincerely,
Moemen
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.

Ryan Harrigan

unread,
Oct 6, 2017, 11:14:15 AM10/6/17
to django...@googlegroups.com
In that case, I suggest that you make a customized Category hierarchy (AbstractCategory)  and use a specialized ProductCategory (AbstractProductCategory) to associate specific business logic between particular Products and Categories.



To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages