Using 8.0.3 GLCA production release.
Scenario: Create a product and then make a duplicate or duplicates of it below on the same page. Now set page to use Single Add to Cart. Publish page.
Look at live page. Now select main product quantity as say 2, leave last of the duplicates at quantity 0. Try Add Selection to Cart. You get error bounce page saying that No products have been selected.... If you set all the values only the last one gets added to the cart. Likewise, if you have Choices and make different choices on each product, only the last one gets used.
Reason: Actinic is using <actinic:variable name="ProductReference" /> as the reference data for all the product fields, including the variant selectors and product quantity. This variable is always that of the main product and contains no duplicate identities. Consequently the page contains lots of form fields with identical names. The only fields that are unique in these products and correctly contain the duplicate ID seem to be the CartError and EncodedProductAnchor variables.
Hack/Solution: If instead of
I use
then that fixes the Product Quantity. However this would need doing for all prompts and variants, etc. Quite a lot of hacking.
Notes: Actinic V7 correctly used 1!<prodref>, 2!<prodref> when generating variant selectors, quantites, etc.
In case anyone says "why would you want duplicates on the same page" the answers are (a) you're not prohibited from doing this; and (b) you might want several dups all with Attributes and Choices to allow the customer to select different quantities of each Choice all in one go; which is a very desirable feature.
PS I'm sure I reported this way back in Alpha days (I tend to look at the generated code more than most).
Scenario: Create a product and then make a duplicate or duplicates of it below on the same page. Now set page to use Single Add to Cart. Publish page.
Look at live page. Now select main product quantity as say 2, leave last of the duplicates at quantity 0. Try Add Selection to Cart. You get error bounce page saying that No products have been selected.... If you set all the values only the last one gets added to the cart. Likewise, if you have Choices and make different choices on each product, only the last one gets used.
Reason: Actinic is using <actinic:variable name="ProductReference" /> as the reference data for all the product fields, including the variant selectors and product quantity. This variable is always that of the main product and contains no duplicate identities. Consequently the page contains lots of form fields with identical names. The only fields that are unique in these products and correctly contain the duplicate ID seem to be the CartError and EncodedProductAnchor variables.
Hack/Solution: If instead of
Code:
<input type="text" name="Q_<Actinic:Variable Name="ProductReference"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
Code:
<input type="text" name="Q_<actinic:block php="true">$dupindex = <actinic:variable name="DuplicateIndex" encoding="perl" selectable="false" />; if ($dupindex > 0) echo "$dupindex!";</actinic:block><Actinic:Variable Name="ProductReference"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
Notes: Actinic V7 correctly used 1!<prodref>, 2!<prodref> when generating variant selectors, quantites, etc.
In case anyone says "why would you want duplicates on the same page" the answers are (a) you're not prohibited from doing this; and (b) you might want several dups all with Attributes and Choices to allow the customer to select different quantities of each Choice all in one go; which is a very desirable feature.
PS I'm sure I reported this way back in Alpha days (I tend to look at the generated code more than most).
Comment