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 Variable List/Guide (https://forum.x-cart.com/showthread.php?t=57142)

petrero 12-18-2010 06:40 PM

Smarty Variable List/Guide
 
I'm back under the hood working on the sites again, and in need of a list of smarty variables that x-cart uses. I could have sworn that there was a guide/list/tutorial here on the forums at some point, but try as I might I haven't been able to find it. Can anyone assist?

Much thanks as always.

Peter

gb2world 12-18-2010 07:19 PM

Re: Smarty Variable List/Guide
 
Your best bet is to use the webmaster mode console to see all the smarty variables and their settings per page load.

For your version - the smarty variables are not present by default in webmaster mode.

This tip explains what to do to see them.

This thread contains a method to modify it so your webmaster mode can switch between template listing and smarty variables.

---

petrero 12-18-2010 07:29 PM

Re: Smarty Variable List/Guide
 
Thanks so much, gb. I'll look into the modification. Although embarassing, it might make sense to ask about a particular variable:

On my product page, I'm trying to create a breadcrumb - so I need to display the category related to that particular product. I could not find it in the $product array. Any thoughts?

gb2world 12-18-2010 08:22 PM

Re: Smarty Variable List/Guide
 
If you are assigning an individual product to many categories - to my knowledge, the default installation of X-Cart does not query for every possible category in which a product can be and provide that in smarty.

In the product array - you are provided with what you what you have set to be the Main category. That is what X-Cart uses to build its breadcrumb. (It is not a true navigation breadcrumb that traces how you navigated to the product page.)

So, when you say "the category related to that particular product", it is unclear what you mean. If you mean the main category - it should be in the product array. If you mean something else - it might not be available by default in smarty.

---

petrero 12-18-2010 08:34 PM

Re: Smarty Variable List/Guide
 
sorry... should have been more clear. each product is assigned/associated with only one parent category. within the $product array, I'm only finding the category ID. I guess I could do an if/then statement, like if catid=950 then display 'eye brushes'. prefer something a bit cleaner, but it may have to do.

hmm.... :\

gb2world 12-18-2010 09:01 PM

Re: Smarty Variable List/Guide
 
If the information you need is not there - then you have to add a query to the php to get it.

The query that got the catid can be modified to also get the name.

Are you sure it is not there? The default x-cart installation already has a breadcrumb that has the name. I also thought there was a $current_category array with the information.

If you look at the tips I originally posted, you should be able to search in the webmaster mode for these variables.

---


All times are GMT -8. The time now is 10:35 PM.

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