| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
If <item X in basket> then | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
If <item X in basket> then
I wonder if there a way to run an {if} check to see if a specific item is in the basket? some sort of smarty check or something?
I would be checking it at the 'cart' stage. e.g. {if <item X is in basket> } EXECUTE THIS {/if} thanks |
|||||||
#2
|
|||||||
|
|||||||
Re: If <item X in basket> then
ok, so I have figured half of it out.
{section name=product loop=$products} {if $products[product].productid eq "17137"} Thank you. Gift wrapping has now been added to your order.<br /> {/if} {/section} BUT.. I also want to run something like: {if $products[product].productid NE "17137"} If you would like to add gift wrapping click here blah blah etc. {/if} But if I do this in a 'section' then it executes the code once for every single in the basket . So if I have 4 items in the basket it will execute that code 4 times. Any wayto make it only execute once? |
|||||||
#3
|
|||||||
|
|||||||
Re: If <item X in basket> then
OK,looks like im talking to myself but I did it using smarty variables and it works absolutely sweet. To those who are looking for a giftwrapping mod check out what i've done at www.watchshopuk.com (add something to basket then try adding and removing gift wrapping).. I am well pleased with it.
|
|||||||
#4
|
|||||||
|
|||||||
Re: If <item X in basket> then
very nice!
May I suggest, instead of the text, "Add gift wrapping to this order" -- this should be an image -- it gets lost in all the text. A "gift box" type image with "Gift Wrap? Click Here..." would take the clutter out of the lower part of the page. Just an idea. How did you get the code to only execute once?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4 |
|||||||
#5
|
|||||||
|
|||||||
Re: If <item X in basket> then
thanks for the suggestion.. I did it by assigning a variable called "giftwrapped" a value of either 1 or 0 depending on if the gift wrapping is in the cart.
here is the complete code: Code:
|
|||||||
|
#6
|
|||||||
|
|||||||
Re: If <item X in basket> then
Nice one Moving to Completed Custom Mods.
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#7
|
|||||||
|
|||||||
Re: If <item X in basket> then
I would like to make a comparison kind of like this in a php file. How can I get the productid to do so?
Thanks.
__________________
X-Cart Gold Version 4.1.3 |
|||||||
#8
|
|||||||
|
|||||||
Re: If <item X in basket> then
Serdar, someone else may have more chance of answering you as I dont know what you mean without some sort of clarification or example.
on a side note, 4 gift wrapping orders in 2 days. Could work out to an extra few hundred quid a year. Buys a couple of extra pints. I'm going to write this up as a full mod I think, including a gift message facility. Im thinking I may as well give something back to the x-cart community after 100 odd posts of asking questions. |
|||||||
#9
|
|||||||
|
|||||||
Re: If <item X in basket> then
Thank You sho ryu ken for this excellent mod!! This has been a long time coming for the gift wrap option at checkout...
Looking forward to the gift message facility!
__________________
maineiac x-cart gold v4.0.18 x-cart gold v4.1.8 |
|||||||
|
|||
X-Cart forums © 2001-2020
|