On this page i’m gonna put all the template stuff someone will need to make a template: different global variables, loops, condition statements and other smarty-related stuff.
Let’s start from different variables:
{$config.skin_path} – the root path of the skin, i.e. cs-cart/skins/myskin/customer
{$config.current_path} – contains path to shop’s homepage
{$config.current_url} – contains the current url
{$index_script} – contains the path to index.php (or admin.php if it’s a template for admin page)
{$images_dir} – the /images/ directory of the skin
{$images_dir}/{$manifest.Customer_logo.filename} – this will generate an url to the logo
{$manifest.copyright} – contains the copyright info from the template file manifest.ini
{$manifest.copyright_url} – copyright url from the template file manifest.ini
{if $auth.user_id} – may be used to check if user logged in
{if $hide_advanced_search} – used to check if advanced search is on
{if $location_dir==”blocks/locations/index”} – used to check if it’s home page
{if in_array(1, $auth.usergroup_ids)} – used to check if logged in used belongs to user group with id 1
{$smarty.const.TIME|date_format:”%Y”} – display current year
{$smarty.session.cart.amount} – used to check or output the number of items on the cart
{$smarty.session.cart.display_subtotal} – total price of all items in cart
{$smarty.session.cart.products} – an array of products in cart
{$ldelim} – will output the raw { symbol
{$rdelim} – will output }
Useful commands and constructors
{assign var=”product” value=1|fn_get_product_data} – this will set a $product variable with the info of product with id 1. (You may need to enclose this in {capture} to make sure it doesn’t echo any errors if there are)
Template Loops:
{foreach from=0|fn_get_subcategories item=”cat”}…{/foreach} – iterate through categories, if you place another foreach inside of current, it will allow to iterate through child categories too
{$cat.category|escape:html} – outputs category title and escapes html symbols
{assign var=”_cart_products” value=$smarty.session.cart.products|array_reverse:true}
{foreach from=$_cart_products key=”key” item=”p” name=”cart_products”}
…
{/foreach} – this loop is used to loop through cart items
{foreach from=$product.product_features item=’i’ key=’k'}{if $i.description == “Artist Name”}Design by {$i.value}{/if}{/foreach} – in this example, we output the product feature if it’s title says “Artist Name”
File-related commands:
{include file=”common_templates/search.tpl” hide_advanced_search=true} – includes the file search.tpl (default search template) with hiding the advanced search option
{script src=”js/myscript.js”} – this will place the <script> tag with all the neccessary attributes
Some general dispatch paths:
categories.catalog – catalog view (a list of categories usually displayed with images and a list of subcategories in it)
categories.view&category_id=1 – view category with id=1
pages.view&page_id=1 – display page with id 1
products.search – search page
profiles.add – user registration page
profiles.update – user profiles page
promotions.list – page with promotions
Undocumented stuff
- To clean thumbnails cache, log in to admin page and add a &ct=1 parameter to any url you are in. This will wipe out the thumbnails and have them regenerated next time you request those images

I do not recommend to use the following constuction: “{assign var=”product” value=1|fn_get_product_data}”
This is a very resource intensive. So it must be done in PHP files and applied to the template.
Professional CS-Cart developer could make any modules, changes, and fixes for you here: {{ad removed}}
Exactly. But please don’t post any more ads here
Thanks for this article, good reference.
In Cs-Cart, how can i get the product price value to pass to input field?
@Hoko, assuming you are on a product template page, you can use any of these values (depending on the case)
$product.original_price
$product.list_price
$product.base_price
then, there’s $product.discount and $product.list_discount, which you may use too
it’s a bit tricky to do it yourself, so basically you can copy the existing script located in common_templates/product_data.tpl to a new file, and trim any unnessecary output
Thanks, about this tip.
I am helping someone with their cs-cart v1. I was able to nav through and figure out most of the back end but am stuck on this one…. The category pages should *not* display category titles. He wants to use his own images via admin instead.
Category.php lets me hide the title but doing that also hides the assigned top category image. I tried in the other category related php files as well, no dice.
In theory, I should be able to remove category titles by copying mainbox.tpl and giving it a new name. Then reference the new name in categories.tpl.
In practice every which way I tried, it bombed. The title can be hidden by removing the title reference from mainbox.tpl. Doing that hides it everywhere though – including product pages.
Any thoughts would be greatly appreciated!
Thanks
Julie
Julie, you will need to look at customer/views/categories/view.tpl
there, on the most bottom is
{capture name=”mainbox_title”}{$category_data.category}{/capture}
just remove the $category_data.category and that should make the title be empty
btw, sometimes you will need to reactivate the theme for the files to recache
How do I get a zero price to display and allow customer to add this as a free product?
When I set “add zero price to cart”, no price is displayed.
You will probably need to modify the template for this — most likely it’s in common_templates/product_data.tpl where all the data for the Buy button is generated