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

String formatting in X-Cart/Smarty

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-11-2008, 10:27 AM
 
sk8conz sk8conz is offline
 

Advanced Member
  
Join Date: Dec 2007
Posts: 31
 

Default String formatting in X-Cart/Smarty

I'm trying to reformat a string and then pass it to our shipping companies web site for tracking.

I have done it previously in asp / vb but am new to smarty and am finding the syntax a little hard going.

Heres the vb code

Code:
ticketnumber = replace (ticketnumber ," ", "") 'remove spaces ticketnumber = replace (ticketnumber ,".", "") 'remove . serial_number = right (ticketnumber,8) ' get serial number - always 8 digits product_code = left (ticketnumber,(len(ticketnumber)-8)) ' get product code, could be 2 or 3 char


Can someone give me a "translation" for Smarty ?

Seems from (my very limited) expereince I will need to set it up as a plugin and do it under php ???

Thanks
__________________
4.3.1
rounded white template
one page checkout
Reply With Quote
  #2  
Old 01-11-2008, 01:27 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: String formatting in X-Cart/Smarty

use replace and substr

ie:

replace:" ":""

substr:8

you can pipe these together as well, ie:

{$ticketnumber|replace:" ":""|substr:8}
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #3  
Old 01-12-2008, 11:34 AM
 
sk8conz sk8conz is offline
 

Advanced Member
  
Join Date: Dec 2007
Posts: 31
 

Default Re: String formatting in X-Cart/Smarty

That pointed me in the right direction. all working now.

Thanks
__________________
4.3.1
rounded white template
one page checkout
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 11:23 AM.

   

 
X-Cart forums © 2001-2020