Product Image as "Option"

72 views
Skip to first unread message

Artem

unread,
Mar 31, 2024, 10:05:59 AMMar 31
to django-oscar
Hello! First of all, exciting project!
Django-Oscar is great, however, there are big difficulties for someone willing to customize it with a lack of Django knowledge. 
Please, help me with the following problem:
Suppose I'm building a clothing store, which has a set of clothing patterns. User can choose a pattern and see how it looks like on a given range of products. 
I stuck with a connection between the Product model and the Pattern model. 
On the main page I also want to display a view with a range of product mockups with a random pattern applied, so I should be able to define this connection from python itself, not based on user choice. 
Any suggestions? 

Aaron Jack

unread,
Mar 31, 2024, 10:34:53 AMMar 31
to django-oscar
When a user selects a pattern on the product page, you want the product image to show the selection?

is that correct?

Artem

unread,
Mar 31, 2024, 4:02:37 PMMar 31
to django-oscar
In general, yes, I want to connect an image within the user session to existing products (so I can show this image applied to the product mockup on the product page and save this connection until the product purchase). 
Assume I have Pattern model with ImageField (pattern image) and CharField (pattern description) and Django Oscar's Product model. So, I do not understand how to connect within user session a product with an image. Idea of copying existing products with only pattern ImageField added seems not optimal. Is there any other way to do that? 

Aaron Jack

unread,
Apr 2, 2024, 8:20:28 AMApr 2
to django-oscar
If they are pre-defined patterns, it would make sense to use the Product Attributes / Options. Then Oscar will do the heavy lifting for you in terms of remembering the selected pattern throughout the ordering process.

If it is a user uploaded pattern, then it is a totally different case and to be honest, i'm not sure.

In my project, a product can have many colours and sizes (all pre defined by the supplier) so I have this as Product Attributes and Option Groups.

The next stage I will be trying to make a product customiser of some type, to be after the add to cart button press. I haven't gotten this far yet.

Im using my Product Attributes as facet filters on my category page too which is also quite simple to put together.

Hope this helps!

Artem

unread,
Apr 2, 2024, 10:02:02 AMApr 2
to django-oscar
Thank you for your reply! I ended up creating a copy of ProductDetailView with an additional variable in url, which I'm using in order to define the pattern needed. It gives me an ability to show related pattern on the chosen product page. 
I've also added new option fields, which are hidden. I fill them with javascript in order to store related information (such as image path, image description). I've also changed Line description function so I do not append values of hidden inputs in the basket. They are already connected with an Order info as every Oscar's option. 

I've also noticed one bug. When I choose the same option in the dashboard on the Product class page and on the Product page with the same class, this product being added in basket has description with multiple instances of this option. 

Aaron Jack

unread,
Apr 3, 2024, 12:14:20 AMApr 3
to django...@googlegroups.com
If they are pre-defined patterns, it would make sense to use the Product Attributes / Options. Then Oscar will do the heavy lifting for you in terms of remembering the selected pattern throughout the ordering process.

If it is a user uploaded pattern, then it is a totally different case and to be honest, i'm not sure.

In my project, a product can have many colours and sizes (all pre defined by the supplier) so I have this as Product Attributes and Option Groups.

The next stage I will be trying to make a product customiser of some type, to be after the add to cart button press. I haven't gotten this far yet.

Im using my Product Attributes as facet filters on my category page too which is also quite simple to put together.

Hope this helps!

--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
---
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...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/2d81f659-7586-4514-bf1d-e3e98fcb740bn%40googlegroups.com.


--
Aaron Jack
Prblm Ltd
Upcoming Annual Leave: 20/05/2024 - 28/05/2024
Let's team up and make better websites: https://calendly.com/prblm/team-up

Reply all
Reply to author
Forward
Message has been deleted
0 new messages