Jump to content

show promotion box if specific products be on card


hogava

Recommended Posts

how can i set condition for show promotion box when specific product added in card?

now i use this conditon:

{if $product.pid == '1'}  

in:

templates/orderforms/standard_cart/viewcart.tpl

but now when product with pid 1 added to card, promotion card shown, if you add another product condition not worked.

i want if product with 1, 2, 3 or 4 added to card promotion box shown on viewcart.

tnx

Link to comment
Share on other sites

do you mean that only if the cart contains products with IDs of 1,2,3 or 4, do you want to see the promo box below?

FBweBJ5.png

your method would work if there was either just one applicable product in the cart, or if the first product was applicable in a cart of multiple products... but if your (1,2,3,4) product was second or third in the art, then it would fail.

because $products is an array, you would have to loop through it to determine if there was a 1,2,3,4 product somewhere in the cart.

you could write a hook that would hide (using css) the entire promo box if the cart does NOT contain 1,2,3,4 - but because of the way WHMCS wrote the template, it would hide the Estimate Taxes tab too... alternative, you could hide the promo input field, but then the tab would still be visible.

rgqG7Dj.png

another way would be to write a hook to determine if product 1,2,3,4 is in the cart and then pass a variable back to viewcart that you can use in the template to determine whether to show the promo box.

it's probably also worth mentioning that a user could still apply a promotion code just be editing the URL - so the removal of this box doesn't prevent them from adding a promotion code to the order, it just makes it more difficult.

https://docs.whmcs.com/Promotions#Promotion_Links

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated