Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

common if/then modifications I make to x-cart...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #81  
Old 07-25-2008, 09:22 AM
 
qrichou qrichou is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 39
 

Default Re: common if/then modifications I make to x-cart...

Hi,

Does anyone know if you can use like with smarty?

We want to say {if $products[product].productcode like "C-"}do this{else}dothis{/if}

Thanks
Reply With Quote
  #82  
Old 07-25-2008, 11:27 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: common if/then modifications I make to x-cart...

Quote:
Originally Posted by qrichou
Hi,

Does anyone know if you can use like with smarty?

We want to say {if $products[product].productcode like "C-"}do this{else}dothis{/if}

Thanks

Like?

Here are the smarty functions rules: http://www.smarty.net/manual/en/language.function.if.php

If you use numerical productID as your var, then you can easily constrain an if to give you the correct results. Why not use the numerical ID? Am I missing what you're trying to do here?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #83  
Old 07-29-2008, 08:30 AM
 
qrichou qrichou is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 39
 

Default Re: common if/then modifications I make to x-cart...

In "like" i mean like in SQL eg - SELECT * from orders where items like '%electronic%'

Basically we mark all products that are variants with a productcode that begins "C-" and i want to show a field based on this.

Hope that makes sense.
Reply With Quote
  #84  
Old 08-05-2008, 07:48 PM
 
benhoffman benhoffman is offline
 

Member
  
Join Date: Jul 2006
Posts: 18
 

Default Re: common if/then modifications I make to x-cart...

Any idea how to use $cat variables on the Cart page? For example, you can use:

{if $cat eq "X"} SHOW THIS {/if}

on other pages, but it doesn't work on the cart page.
__________________
x-cart 4.2.2
Reply With Quote
  #85  
Old 08-17-2008, 01:42 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Default Re: common if/then modifications I make to x-cart...

What if instead of {if=a}html1{else}html2{/if} you wanted something like this:
{if=a}html1{if=b}html2{else}html3{/if}?
__________________
4.1.9 Gold

window valances | curtains
Reply With Quote
  #86  
Old 10-06-2008, 05:03 PM
 
ReadytoCover ReadytoCover is offline
 

Senior Member
  
Join Date: Apr 2008
Posts: 124
 

Default Re: common if/then modifications I make to x-cart...

Quote:
Originally Posted by benhoffman
Any idea how to use $cat variables on the Cart page? For example, you can use:

{if $cat eq "X"} SHOW THIS {/if}

on other pages, but it doesn't work on the cart page.

Anyone have a response to this?

I have tried

{if $products[product].categoryid eq "3"} and
{if $products[product].catid eq "3"}

and neither work...I am trying to display a specific message in the cart if the customer has a product from that category in their cart.

Thanks!!!!!!
__________________
x-cart 4.1.9
Reply With Quote
  #87  
Old 10-08-2008, 01:04 PM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: common if/then modifications I make to x-cart...

I use this on the product.tpl for categories and it works there... give it a try on your cart page:

{if $product.categoryid == 3}

Robert
__________________
X-cart 4.1.10
Reply With Quote
  #88  
Old 10-09-2008, 05:58 AM
 
ReadytoCover ReadytoCover is offline
 

Senior Member
  
Join Date: Apr 2008
Posts: 124
 

Default Re: common if/then modifications I make to x-cart...

Thanks but unfortunately that doesn't work.

If anyone else has a suggestion feel free to pass it along. Thank you.
__________________
x-cart 4.1.9
Reply With Quote
  #89  
Old 10-09-2008, 12:10 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: common if/then modifications I make to x-cart...

You have to ensure you are using a variable in a section loop. For example:
Code:
{section name=prod_num loop=$products} {$products[prod_num].product}: {$products[prod_num].categoryid}<br /> {/section}

Not sure if the categoryid is in the cart $products variable as I didn't test it.
Reply With Quote
  #90  
Old 10-09-2008, 12:11 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: common if/then modifications I make to x-cart...

Quote:
Originally Posted by anela2003
What if instead of {if=a}html1{else}html2{/if} you wanted something like this:
{if=a}html1{if=b}html2{else}html3{/if}?

Code:
{if $x eq 'a'}html1{elseif $x eq 'b'}html2{else}html3{/if}
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:56 AM.

   

 
X-Cart forums © 2001-2020