X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   String formatting in X-Cart/Smarty (https://forum.x-cart.com/showthread.php?t=36695)

sk8conz 01-11-2008 10:27 AM

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

inebriate 01-11-2008 01:27 PM

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}

sk8conz 01-12-2008 11:34 AM

Re: String formatting in X-Cart/Smarty
 
That pointed me in the right direction. all working now.

Thanks :D


All times are GMT -8. The time now is 06:11 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.