PDA

View Full Version : Common Smarty statements for X-Cart development


topvip
2014-03-23, 01:29 AM
Home Page

{if $main eq "catalog" AND $current_category.categoryid ne ""}
I am on the home page.
{/if}


Any Category
{if $main eq "catalog" AND $current_category.categoryid gt 0}
I am on a category listing page.
{/if}

Specific Category (replace X with the numeric categoryid)

{if $current_category.categoryid eq X}
I am on category X.
{/if}

Any Product
{if $main eq "product"}
I am on the product details page.
{/if}

Specific Product (replace X with the numeric productid)
{if $product.productid eq X}
I am on product X.
{/if}

Any Static Page
{if $main eq "pages"}
I am on a static page.
{/if}

Specific Static Page (replace X with the numeric pageid)

{if $page_data.pageid eq X}
I am on page X.
{/if}



Manufacturer Listing

{if $main eq "manufacturers"}
I am on the manufacturers listing page.
{/if}



Any Manufacturer

{if $main eq "manufacturer"}
I am on the page of a specific manufacturer.
{/if}



Specific Manufacturer Page (replace X with the numeric manufacturerid)

{if $manufacturer.manufacturerid eq X}
I am on manufacturer X.
{/if}



Shopping Cart

{if $main eq "cart" OR $main eq "checkout" OR $main eq "order_message"}
I am in the checkout process.
{/if}



Checkout Process

{if $main eq "checkout" OR $smarty.get.mode eq "checkout" OR $main eq "order_message" OR $smarty.get.mode eq "order_message"}
I am in the checkout process.
{/if}



Anywhere Except Checkout

{if $main ne "cart" AND $main ne "checkout" AND $smarty.get.mode ne "checkout" AND $main ne "order_message" AND $smarty.get.mode ne "order_message"}
I am in not in the checkout process.
{/if}



Only If Logged In

{if $login ne ""}
The user is logged in.
{/if}



Only If Logged Out

{if $login eq ""}
The user is logged out.
{/if}