0

Folks:

The client has a number of products that do not ship outside of North America (most ship anywhere). I am using the is_in_cart tag (http://cartthrob.com/docs/tags_detail/is_in_cart/) to check if non-shippable items are in the cart. There are 18 items that don't ship outside North America.

Now, I have a long OR statement to deal with this ({exp:cartthrob:is_in_cart entry_id="301"} OR {exp:cartthrob:is_in_cart entry_id="302"} OR {exp:cartthrob:is_in_cart entry_id="303"} etc.). This isn't too bad. Problem is, though, that the site is going multilingual. This means 18 more checks for every new language. With 6 languages total, that's a crazy number of OR statements and will be a big performance hit.

It would be great if I could just check against a single category. Is this possible?

1 Answer 1

1

First of all, if you use for example publisher for translations, you will keep the same ID's so that would not be an issue!

What I would do in your case is add a custom field to the product of the type checkbox and check the products that can't be shipped. Then in you loop through your cart to check if a product is in the cart you can do a conditional check on the custom check box field.

I don't know if it is possible with cartthrob to add custom fields, with expresso store you can since those product entries are based on channels.

1
  • It's definitely possible in Cartthrob - products also go in channels in CT. Indeed, you can have as many product channels as you like, with basically any differing set of fields you like. Mar 18, 2014 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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