1

I am trying to use the Grid fieldtype as a price modifier for Cartthrob. Documentation is lacking on this, it only describes Matrix. I have set it up like Matrix, but obviously change tags to Grid tags.

I am also using the exp:cartthrob:multi_add_to_cart_form so we can add multiple options and quantities at the same time.

I can add multiple product options to the cart, but cannot get the price or the inventory as per the documentation for Matrix.

My product_options fieldnames are options_value, price, inventory, and I have mapped the inventory and price to my product_options field in Cartthrob, but adding to the cart states "Product is out of stock" for all options. If I remove the inventory mapping, I can add them to the cart but then the price is 0.

So it seems I cannot map price and inventory to a grid field, like the docs say you can for Matrix. Does anyone know if this is possible?

Here is exp:cartthrob:multi_add_to_cart_form form:

{exp:cartthrob:multi_add_to_cart_form return="cart" }

{product_options}
<input type="hidden" name="entry_id[{product_options:count}]" value="{entry_id}">
<input type="hidden" name="item_options[{product_options:count}][product_options]" value="{product_options:option_value}">
<input type="text" name="quantity[{product_options:count}]" value="{product_options:count}">
{/product_options}

<input type="submit" value="Add To Cart" />

{/exp:cartthrob:multi_add_to_cart_form} 

We are using the latest CT version 2.5 and EE 2.7.2

Thanks

  • I found one issue with my code, I corrected it now. That is the name of the options field must be the name in the item_options field, e.g. name="item_options[{product_options:count}][product_options]" – Laurence Cope Jun 1 '14 at 15:39
  • I have also tested this with Matrix and it is indeed working (using Matrix tags), so it seems Grid either does not work, or I am doing something wrong – Laurence Cope Jun 1 '14 at 15:40
  • I tried using grid as a price modifier for CartThrob and it didn't work for me either. I can only assume it is not supported. I used Matrix and that worked. – Anthony Mellor Jun 1 '14 at 22:35
  • Yes am using Matrix for the time being, a real shame now that we have grid. – Laurence Cope Jun 2 '14 at 8:14
1

No, CartThrob does not support using a Grid field for price modifiers.

| improve this answer | |
  • Thanks Derek, thought not, but do you mind me asking how you know so I can be sure? And if you know of any plans to introduce it? Thanks – Laurence Cope Jun 2 '14 at 15:30
  • It's not mentioned in the docs, nor the release notes, and CartThrob have unfortunately been very slow to support new EE versions/features, making it even more unlikely that it would have been implemented, without comment, in the span of a single version (Grid was introduced in EE 2.7). – Derek Hogue Jun 2 '14 at 16:25
  • I guess you're right then :( – Laurence Cope Jun 2 '14 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.