What would cause my cart to be empty?
If I click on add to cart, the cart page says "Your Cart is Empty."
If I remove the section of the add to cart form for my variations:
<perch:productopts>
<fieldset>
<legend><perch:productopt id="title" /></legend>
<perch:input type="select" required="true" id="<perch:shop id="optionKey" />" name="os<perch:shop id="perch_item_index" />" options=" <perch:productvalues><perch:productvalue id="valueTitle" />|<perch:productvalue id="valueID" />,</perch:productvalues>" />
</fieldset>
</perch:productopts>
Products get added to the cart just fine. If I include the above code, nowt happens.
What does debug output for your cart page?
SELECT * FROM perch2_members_sessions WHERE sessionID='68caf2324cfe51cb77939ac1367ee5d0b4b5f2f7' AND sessionHttpFootprint='2631419c2f44dc27e3c8e69d0ef9cab3556b788e' AND sessionExpires>'2016-08-11 20:04:13' LIMIT 1 User is logged in [1] SELECT * FROM perch2_pages WHERE pagePath='/cms/shop/cart/index.php' LIMIT 1 [1] SELECT * FROM perch2_shop_cart WHERE cartID=2 [1] SELECT * FROM perch2_shop_cart WHERE cartID=2 [24] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Array ( [0] => required )
[nil] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC Using cart from cache. Using template: \templates\shop\cart\cart.html
Are you setting the productID anywhere in the form? e.g.
Yep:
Are you setting an action on the add to cart form? Does the value resolve to your cart page without a redirect?
Yes and there are no redirects:
It works fine it I remove the product options form the form. Just doesn't seem to like them for some reason.
Can you show me the full template?
To be honest, it is mostly just the default template as I am only just working out some functionality at the moment (sorting out that whole hiding stuff from certain members thing). This is the list.html template - I am not using individual products pages so all are listed on one page with their add to cart buttons. I basically just copied the product.html template into list.html and added the options bit:
You've got the action set to
action="/Vanilla-CMS/shop/cart/"
- is that what you thought it was? It's not what you told me above.Sorry, yes that is correct. I trimmed the first one to make things clearer since it is in a subdirectory on my test server for now called Vanilla-CMS. I wouldn't normally work like that as it makes a headache transferring to a live server but like I said, I just did a very quick install to test out the whole member access thing then came across this.
Sorry to confuse things!
Why would adding in the product options bit stop the cart from working?
It looks like you've changed the name of the inputs. Those are special values that the app is looking for. I'd suggest trying the example from the documentation:
https://docs.grabaperch.com/addons/shop/products/template-tags/options/
Hmm, I see. OK, well If I put the name as :
It outputs the name as opt-1[], op-2[] for each of my select boxes. However, the cart is still empty when I add ot cart!
Is it because I am using a series of selct boxes rather than groups of radio buttons? Radio buttons are no good as there are 62 colours ot choose from! I also cannot use the default option of a single select box as it is just far too confusing for the user (they have 62 material colours and 62 feather colours to choose from) so a series of select boxes is the only option for me.
Also when I use the default perch select box (with all variations listed), the item may be added to the cart but the selected product options do not show. I am using this:
If I put name="product" as is output by the default select box, the item is added to the cart. However, if I have many select boxes per product then surely they cannot all be named the same?
If you as a test use the radio buttons, do those work?
Right, so yes, product is added to cart, so no empty cart. Still no reference on the cart or in the order as to what the selected product options were though
(literaly just copied and pasted from the product options docs page)
What tags do you have in your cart template? Have you turned on
<perch:showall />
in the template to see what you've got available to you?OK, so with the radio buttons it does include [variant_desc] => Blue, Pink but doesn't show it in the template or in the order
Is
variant_desc
not the description of your selection that you're looking for?Oh for God's sake. All this faffing I had deleted the variant_desc from my template. OK, so yes, with radio buttons everything works as it should. Just can't get it to work with my multiple select box version