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)
-   -   Smarty Global variables (https://forum.x-cart.com/showthread.php?t=29551)

gerrick@ncs-online.com 03-09-2007 06:46 AM

Smarty Global variables
 
I'd like to create a new variable usable on any of the xcart pages through smarty. For example, $basicmarkup with the value of 1.2;

Thanks!

gerrick@ncs-online.com 03-12-2007 04:56 AM

Re: Smarty Global variables
 
Anyone?

wjbrewer 03-12-2007 07:58 AM

Re: Smarty Global variables
 
Add this to the auth.php file

PHP Code:

$smarty->assign('basicmarkup'1.2); 


Add it after this code:

PHP Code:

x_session_register("logout_user");
x_session_register("session_failed_transaction");
x_session_register("add_to_cart_time"); 


gerrick@ncs-online.com 03-19-2007 04:48 AM

Re: Smarty Global variables
 
Very helpful! This worked! I appreciate the help.

However, I've run into another issue. On the search results page when in debug mode it does not show any information about the user. What i'm trying to do is this.


{if $customer_info.membership eq "GSA"}
GSA Price:<br />
{math equation="price*markup" price=$products[product].taxed_price markup=$gsamarkup format="%.2f" assign=gsaprice}

{include file="currency.tpl" value=$gsaprice plain_text_message=true}

gerrick@ncs-online.com 03-20-2007 04:20 AM

Re: Smarty Global variables
 
bump

espresso 09-06-2007 05:19 PM

Re: Smarty Global variables
 
Quote:

Originally Posted by wjbrewer
Add this to the auth.php file

PHP Code:

$smarty->assign('basicmarkup'1.2); 


Add it after this code:

PHP Code:

x_session_register("logout_user");
x_session_register("session_failed_transaction");
x_session_register("add_to_cart_time"); 



I can't get variables to show it's modified value in other templates. ex:

in template_decide.tpl:

Code:

{if $customer eq "A"}
{assign var="basicmarkup" value=1.4}
{else}
{assign var="basicmarkup" value=1.6}
{/if}


and then I use product.tpl to display the result like:

Code:

markup: {$basicmarkup}

The output will be "markup: 1.2" as it is assigned with $smarty->assign('basicmarkup', 1.2) in auth.php

How do I pass the variable between templates with a new modified value ?


All times are GMT -8. The time now is 07:37 AM.

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