Jump to content
uddhava

Global Smarty Variables used in Prestashop

Recommended Posts

could you tell me where $base_dir is set at so that i can change all http: to https:
thanks

Share this post


Link to post
Share on other sites

Most variables get set by the config files in the /config folder

Share this post


Link to post
Share on other sites

Thx for the info. But the list seems to be a bit outdated. logged is deprecated, is there any substitute for this?

TIA

Share this post


Link to post
Share on other sites

Talking of this subject, what about the order note comment field from checkout?

In the PrestaShop 1.4.2.5 release it cheekily appears as a global Smarty $oldMessage on the page where you enter the note, and then.. it is gone when you click Next!

(On the page after that in checkout the gift wrap message is put into $cart>-gift_message.. But where is the order note?!)

49818_VkaCqBNm1feLFD94wTAx_t

Share this post


Link to post
Share on other sites

Hi,

 

I have a solution to find the current page.

 

{assign var='pageName' value=$smarty.server.PHP_SELF}

 

{$pageName}

 

 

the variable 'pageName' print its name with absolute path. then you need to subtr it.

Share this post


Link to post
Share on other sites

Hello,

 

Can i create a global variable in a module ?

I want to use this variable in every tpl file in my theme.

 

thx

Share this post


Link to post
Share on other sites

On my search for the GLOBALS Smarty variables in Prestashop i stumbled upon this gem :

( Thx to Matt : http://www.sandfight...shop-uncovered/)

 

01	 $base_dir { root folder of your shop }
02	$base_dir_ssl { root folder of your shop using HTTPS protocol }
03	$content_dir { root folder of your shop depending on the SSL settings }
04	$img_ps_dir { root folder containing images "/img/" }
05	$img_dir { images folder in your current theme directory }
06	$css_dir { css folder inside the current theme folder }
07	$js_dir { JavaScript inside the theme folder }
08	$tpl_dir { theme root folder }
09	$modules_dir { modules root folder }
10	$mail_dir { mail templates root folder }
11	$lang_iso { current language ISO code }
12	$come_from { previous page address [absolute] }
13	$shop_name { your specified shop name }
14	$cart_qties { total number of products in the cart }
15	$cart { shopping cart contents }
16	$currencies { pulls available currencies }
17	$id_currency_cookie { selected currency id [cookie dependent] }
18	$currency { active currency }
19	$cookie { active cookie }
20	$languages { grabs available languages }
21	$logged { checks whether users is logged in }
22	$page_name { current page's name }
23	$customerName { customer name [session dependent] }
24	$priceDisplay { current price display settings [currency dependent] }

 

I have no idea if these are all working. I was looking for a global variable that has the

URL of the current page. Anybody knows that ?

 

Thanks for the list... I have also found out that $module_name works in v1.4.9.0 and im using it in my template to add an active class to the navigation like so...

 

{if $module_name == 'mymodule'} class="active"{/if}

 

@MyWebsiteSpot

  • Like 2

Share this post


Link to post
Share on other sites

well, it's a bit old thread with not all global variables used in 1.5.x version

Share this post


Link to post
Share on other sites

How did Prestashop got the URL for the Media-Server (ccc) ? 

Some Modules seems not to implement the right Smarty-Variable for that.

 

For example Homeslider & advertising_block & Product-Highlight on startpage still use default-domainname for the images.

Share this post


Link to post
Share on other sites

well, it's a bit old thread with not all global variables used in 1.5.x version

 

And is there a place to find all the current global variables used in 1.5 but mostly important in 1.6?

Share this post


Link to post
Share on other sites

Thanks Vekia, but that list contains {$base_dir} which does not work under 1.6

I've found this to be the solution:

 

__PS_BASE_URI__ is a constant defined in prestashop and those can be access through Smarty's {$smarty.const...} tag.

So, use {$smarty.const.__PS_BASE_URI__} en voilá.

  • Like 1

Share this post


Link to post
Share on other sites

could you tell me where $base_dir is set at so that i can change all http: to https:

thanks

you should be able to accomplish your task/goal by going to backoffice preferences/general and setting "Force the SSL on all pages" to YES

Share this post


Link to post
Share on other sites
Look for the following at about line 429 of classes/controller/FrontController.php and you'll find the global variables listed after it:



// Useful for layout.tpl

  • Thanks 1

Share this post


Link to post
Share on other sites
On 4/25/2019 at 9:36 AM, sumant@brucode.com said:

Can any one can say how can i active link on top horizontal menu in internal pages.

 

Suppose about us in there are two cms pages but i want about us remain active when click on internal pages of about.

please give any solution.

Thanks 

Sumant kumar

solved

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More