Page 1 of 1

How would I implement this: If (field) = (text) then...

PostPosted: Sat Oct 22, 2011 7:23 pm
by elsparkodiablo
Hey guys

Upgraded to 11sp1 and love the new features.

We occasionally have issues where we'd like to list a product, but hide the sale price to comply with our vendor's Minimum Allowable Advertising Policies (MAAP). I'm running into an issue that should be easy to solve, but I must be exhausted and am not getting this right.

How am I screwing this up:
Code: Select all
[-- IF Product.Field10 "maap" --]
Add to cart to see our low price!
[-- ELSE --]
(standard Add to Cart code)
[-- END_IF --]


Eventually I'm going to use Product.Field10 for several different codes with resulting outputs in a series of IF ELSE statements... but getting this first one right is screwing me up.

Re: How would I implement this: If (field) = (text) then...

PostPosted: Sat Oct 22, 2011 9:43 pm
by Jim
I know about "maap" pricing and what you have should work fine. What you need to do is not display the price instead of not displaying the add to cart button.

[-- IF Product.Field10 "maap" --]
Price = Add to cart to see our low price!
Add to cart button here
[-- ELSE --]
[-- product.price --]
(standard Add to Cart code)
[-- END_IF --]

You will want to code the add to cart link using a method other than the [-- PRODUCT.OrderCheckout --] which displays order options and may include the price.

Re: How would I implement this: If (field) = (text) then...

PostPosted: Sun Oct 23, 2011 12:00 pm
by elsparkodiablo
I figured out what I was doing wrong - had the product loop building each product using a specific template instead of the testing template I was coding. This was a workaround since prior to 11sp1 if you didn't specify the template when adding products, it'd default to a stripped down version. Removed that code segment and my test template is displaying just fine.

Thanks for the response.

Re: How would I implement this: If (field) = (text) then...

PostPosted: Sun Oct 23, 2011 1:15 pm
by Jim
Glad you got it working.

Regarding this sentence in your post.
"This was a workaround since prior to 11sp1 if you didn't specify the template when adding products, it'd default to a stripped down version"

The "it defaults to a stripped down version" isn't quite right. If a template isn't specified in the loop products [-- product --] tag it uses the template that is assigned to the product on the Edit Product Layout screen. The default product template depends on which theme is active so it could be very complex, as in the Awesome theme or very plain as in the Plain theme. This behavior has never changed since the custom templates first implemented, and is still the same in ShopSite 11 sp1.