Closed ghost closed 7 years ago
Which version do you use? How does your global properties look like?
Hi Kai,
The code has just been cloned from lfs-buildout-devel repo this morning. I think I possibly found the cause - the code in add_variants() function @ /lfs/manage/product/variants.py mostly takes care of local properties and checks against duplicated entries in this context only. In particular:
# Create a variant for every requested option combination
for i, options in enumerate(manage_utils.cartesian_product(*properties)):
if product.has_variant(options, only_active=False):
continue
However, in case of global properties-based variants there are no options at all. So the first time has_variant returns False, the second time it returns True and the whole further code responsible for variant production is omitted. My quick hack to this is below:
# Create a variant for every requested option combination
for i, options in enumerate(manage_utils.cartesian_product(*properties)):
if product.has_variant(options, only_active=False):
if options: # MY HACK
continue
The only problem is that variants' names displayed in the left part of the dashboard are all the same, taken from parent product name, but this most likely is another issue.
Hi, The problem with names mentioned at the end of previous comment is not a bug, I just had to activate names of the variants.
Hi,
I'm going to look at this as soon as I find some time. Thx for reporting this.
Kai
Can't reproduce.
Hi,
It is not possible to add more but just one variant for a product using global properties instead of local ones. I added a product using the dashboard, changed its type to "product with variants" and tried to add the variants by pressing "add variant(s)", so that I could assign properties later on. It only works for the first time, when I tried to add the second variant the message "no variants have been added" appears.