mEcommerce Posted April 25, 2008 Share Posted April 25, 2008 I guess the title of this post is clear 8) Link to comment Share on other sites More sharing options...
zefranck Posted April 28, 2008 Share Posted April 28, 2008 You may look at smarty.net... You can also activate the debug window... Have fun. Link to comment Share on other sites More sharing options...
Pursuant Posted April 29, 2008 Share Posted April 29, 2008 It varies. Really, any variables can be used in smarty. What are you trying to do, we may be able to help. Link to comment Share on other sites More sharing options...
mEcommerce Posted April 29, 2008 Author Share Posted April 29, 2008 You may look at smarty.net... You can also activate the debug window... Have fun. What do you mean by debug window? The one inside my browser? It varies. Really, any variables can be used in smarty. What are you trying to do, we may be able to help. Well I was looking at some templates inside PrestaShop.. What I was trying to do is hide the Shipping and Total costs, and the Check-out button in the Cart Block if the Cart is empty. I managed to do this successfully using the {if $products} tag. And I was wondering if there is a list available of all variables and tags.. Ill just have a look at smarty.net! Thanks for replying! Link to comment Share on other sites More sharing options...
zefranck Posted April 29, 2008 Share Posted April 29, 2008 What do you mean by debug window? The one inside my browser? Go to the config/config.inc.php file and set $smarty->debugging to true Link to comment Share on other sites More sharing options...
mEcommerce Posted April 29, 2008 Author Share Posted April 29, 2008 What do you mean by debug window? The one inside my browser? Go to the config/config.inc.php file and set $smarty->debugging to true Thanks for pointing in the right direction. Another thing I'm trying to accomplish is to adjust the Userinfo Block to show: Welcome mr./ms. (depending on gender) $Costumername. I've had a look in the identity template to find the correct variables but I just can't get it to work. This is the line of code I've added: {if $id_gender eq '1'}mr. {else}mrs. {/if}<span>{$customerName}</span> Since that I'm a noob when it comes to Smarty the code above is incorrect and just shows mrs. Can you show me what do I have to put in place of {if $id_gender eq '1'}? Link to comment Share on other sites More sharing options...
zefranck Posted April 29, 2008 Share Posted April 29, 2008 Well, the blockuserinfo block does not return the needed information. You have to modify it... Go to /modules/blockuserinfo/blockuserinfo.php and replace function hookTop($params) { global $smarty, $cookie, $cart; $smarty->assign(array( 'cart' => $cart, 'cart_qties' => $cart->nbProducts(), 'logged' => $cookie->isLogged(), 'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false) )); return $this->display(__FILE__, 'blockuserinfo.tpl'); } with function hookTop($params) { global $smarty, $cookie, $cart; $customer = new Customer(intval($cookie->id_customer)); $smarty->assign(array( 'cart' => $cart, 'cart_qties' => $cart->nbProducts(), 'logged' => $cookie->isLogged(), 'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false), 'id_gender' => $customer -> id_gender )); return $this->display(__FILE__, 'blockuserinfo.tpl'); } Link to comment Share on other sites More sharing options...
mEcommerce Posted April 29, 2008 Author Share Posted April 29, 2008 Excellent! Just for my own knowledge I'd like to know what these 2 lines do; $customer = new Customer(intval($cookie->id_customer)); id_gender' => $customer -> id_gender Thanks again! Link to comment Share on other sites More sharing options...
zefranck Posted April 29, 2008 Share Posted April 29, 2008 The first one gets the customer "properties" (you may add print_r($customer); in blockuserinfo.php to see all the customers variables). The second one assigns the attribute we need (id_gender) to a smarty variable. Have fun Link to comment Share on other sites More sharing options...
mEcommerce Posted April 29, 2008 Author Share Posted April 29, 2008 The first one gets the customer "properties" (you may add print_r($customer); in blockuserinfo.php to see all the customers variables). The second one assigns the attribute we need (id_gender) to a smarty variable. Have fun Thanks alot you really helped me out on this one! Another thing is, I want to turn caption on the costumers lastname off.. Link to comment Share on other sites More sharing options...
zefranck Posted April 29, 2008 Share Posted April 29, 2008 I am sure you can find the solution yourself in the /modules/blockuserinfo/blockuserinfo.php file Link to comment Share on other sites More sharing options...
mEcommerce Posted April 29, 2008 Author Share Posted April 29, 2008 I am sure you can find the solution yourself in the /modules/blockuserinfo/blockuserinfo.php file I can't find anything inside the code that sets the uppercase.. I also added text-transform: capitalize style to the blockuserinfo.tpl file but that doesnt do the trick. However, if i replace capitalize with lowercase, it does transform the lastname in lowercase characters. Link to comment Share on other sites More sharing options...
zefranck Posted April 29, 2008 Share Posted April 29, 2008 blockuserinfo.php not blockuserinfo.tpl Link to comment Share on other sites More sharing options...
Pursuant Posted April 29, 2008 Share Posted April 29, 2008 ucfirst() Is the function I think you want. Link to comment Share on other sites More sharing options...
zefranck Posted April 30, 2008 Share Posted April 30, 2008 oOOps, yes, you're right Ox40.... I've misunderstood the question, sorry By the way, look at http://www.smarty.net/manual/en/language.modifiers.php and http://smarty.incutio.com/?page=SmartyPlugins ... You will find a lot of tips. Link to comment Share on other sites More sharing options...
mEcommerce Posted May 2, 2008 Author Share Posted May 2, 2008 Thank you Ox40 and zefranck, Ive got it using the ucfirst() option.. I think I'll spend a few days breaking my head over Smarty, Im sure its worth the time! Bye! Link to comment Share on other sites More sharing options...
kelvz Posted December 18, 2012 Share Posted December 18, 2012 how about printing page_name in php file not .tpl? Link to comment Share on other sites More sharing options...
Recommended Posts