| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Truncating to the FIRST Character in a variable | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() trying to modify the customer reviews so that it doesn't automatically populate the name with the full name and email address of the customer.
Removing the email address was easy enough but now I am trying to have it default to just their first initial and last name .. or first name and last initial but I do not know how to modify the variable to only display the first character. Code:
any ideas? Thanks! |
|||||||
#2
|
|||||||||
|
|||||||||
![]() Take a look at the customer/main/products.tpl note the truncate command smarty has in there to reduce the short description to 300 chars, you can use the same code to accomplish what you want here.
__________________
Groovico Used by X-carters the world over: Marketing Manager Pro Bundle For X-cart Featured Product Manager for X-cart Feed manager pro for X-cart http://www.firetanksoftware.com Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X |
|||||||||
#3
|
|||||||
|
|||||||
![]() the problem is that I need the FIRST character .. so if a name is 8 characyers long I need to use the FIRST one.
FirstName LastName = F. LastName here is what I am in the progress of working on that seems to work. It's not pretty but seems to work for the most part Code:
|
|||||||
#4
|
|||||||
|
|||||||
![]() try:
Code:
This will work on the product reviews.
__________________
ex x-cart guru ![]() |
|||||||
#5
|
|||||||
|
|||||||
![]() ok, that was what it looked like in the example that Groovico pointed me to but thought that wouldn't work.
I was all over smarty.php.net and went back after your post. I guess what threw me was the description of what the parameter TRUE did. Quote:
Thanks!!!, wish I wouldn't have spent as much time as I did on figuring THAT one out though ![]() |
|||||||
#6
|
|||||||
|
|||||||
![]() i get it now. by setting it to TURE then it does the WORD and since most people only use 1 first name then this works. But if someone uses a 2 word first name then it will only truncate the last one .. right?
like: Lisa Marie Smith = Lisa M. Smith Right?? |
|||||||
#7
|
|||||||||
|
|||||||||
![]() Best way of working stuff like that out is simply to do quick tests
{$customer_info.firstname|truncate:2:".":true} {$customer_info.firstname|truncate:2:".":False} And just view the effects
__________________
Groovico Used by X-carters the world over: Marketing Manager Pro Bundle For X-cart Featured Product Manager for X-cart Feed manager pro for X-cart http://www.firetanksoftware.com Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X |
|||||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|