Does anyone has a handy list of exceptions / conditions?

Hi there,



Does anyone has a list of exceptions in their sleeves? :stuck_out_tongue:



I want to exclude a certain button from the homepage and the product details page. Have looked high and low but can’t find the code if statements necessary to hide this button.



I think I have the homepage code condition somewhere, but not the product page.



Something like:



if “category page”

do this

else

do that



Cheers

this should work:


{if $category.category_id == '357'}
*do this*
{else}
*do that*
{/if}


if you have multiple categories you would like to apply the same mod to you can use:



{if $category.category_id == '357' || $category.category_id == '358' || $category.category_id == '359'}
*do this*
{else}
*do that*
{/if}




or if you need to have different mods applied to different categories you can use:


{if $category.category_id == '357'}
*do this1*
{elseif $category.category_id == '358'}
*do that2*
{elseif $category.category_id == '359'}
*do that3*
{elseif $category.category_id == '360'}
*do that4*
{else}
*do that5*
{/if}


you can also mix the above 2 examples:


{if $category.category_id == '357' || $category.category_id == '358' || $category.category_id == '359'}
*do this1*
{elseif $category.category_id == '360'}
*do that2*
{elseif $category.category_id == '361'}
*do that3*
{elseif $category.category_id == '362'}
*do that4*
{else}
*do that5*
{/if}


if you want to mod actions on the products pages you can use the examples above and change to use the product variables instead:


{if $product.product_id == '24'}
*do this*
{else}
*do that*
{/if}

Wow snorocket, I honestly didn’t expect a post as long as yours… Thanks a lot mate, appreciate it! :wink:



I posted this post to understand better these page conditions, but I already had something in mind when I wrote it… What I actually needed doing is the following:



I would like to have a [info] button besides the [buy now] button, wherever the [buy now] button appears. To make the [info] button appear besides the [buy now] button, I would need to include it in the “buy_now.tpl”.



To avoid the [buy now] button appearing in the homepage and/or in the product detail’s page, I would need to combine two conditions. Something like:



IF homepage OR product-detail-page
DO NOT SHOW [buy now] BUTTON
ELSE
SHOW [buy now] BUTTON




The reason I’d like to do it is purely GUI-related, we would like our users to understand straight away that if they click there they will go to a detail page. Many stores have implemented that, so we’d like to see if it helps at all.



Cheers

The “content.tpl” has a full list of page conditions:



{if $content == "categories"}
{include file="categories_pages/categories.tpl"}

{elseif $content == "category_products"}
{include file="categories_pages/categories.tpl"}

{elseif $content == "products"}
{include file="products_pages/products.tpl"}

{elseif $content == "products_search_results"}
{include file="products_pages/products_search_results.tpl"}

{elseif $content == "product_details"}
{include file="products_pages/product_details.tpl"}

{elseif $content == "profiles"}
{include file="profiles_pages/profiles.tpl"}

{elseif $content == "checkout"}
{include file="cart_pages/checkout.tpl"}

{elseif $content == "invoice"}
{include file="orders/invoice.tpl" skin_area="mail"}

{elseif $content == "orders"}
{include file="orders_pages/orders.tpl"}

{elseif $content == "order_details"}
{include file="orders_pages/order_details.tpl"}

{elseif $content == "login_form"}
{include file="auth_pages/login.tpl"}

{elseif $content == "recover_password"}
{include file="auth_pages/recover_password.tpl"}

{elseif $content == "topics"}
{include file="topics_pages/topics.tpl"}

{elseif $content == "topic_pages"}
{include file="topics_pages/topics.tpl"}

{elseif $content == "pages"}
{include file="pages_pages/pages.tpl"}

{elseif $content == "page_details"}
{include file="pages_pages/page_details.tpl"}

{elseif $content == "manufacturer"}
{include file="addons/manufacturers/manufacturer.tpl"}

{elseif $content == "manufacturers"}
{include file="addons/manufacturers/manufacturers.tpl"}

{elseif $content == "sitemap"}
{include file="sitemap_pages/sitemap.tpl"}

{elseif $content == "exceptions"}
{*include file="exceptions_pages/exceptions_list.tpl"*}

{elseif $content == "search"}
{include file="search_pages/search.tpl"}

{elseif $content == "orders_download"}
{include file="orders_pages/download.tpl"}

{elseif $content == "forms"}
{include file="forms_pages/forms.tpl"}

{elseif $content == "comparison"}
{include file="products_pages/comparison.tpl"}

{elseif $content == "aff_banner_categories"}
{include file="categories_pages/categories_list.tpl"}

{**[ADDONS_DATA]**}
{elseif $content == "wishlist"}
{include file="addons/wishlist/wishlist.tpl"}

{elseif $content == "news"}
{include file="addons/news_and_emails/news.tpl"}

{elseif $content == "news_details"}
{include file="addons/news_and_emails/news_details.tpl"}

{elseif $content == "events"}
{include file="addons/gift_registry/events.tpl"}

{elseif $content == "discussion"}
{include file="addons/discussion/discussion.tpl"}

{elseif $content == "promotions"}
{include file="addons/promotions/promotions.tpl"}

{elseif $content == "userlog"}
{include file="addons/reward_points/userlog.tpl"}

{elseif $content == "gift_cert_add" || $content == "gift_cert_update"}
{include file="addons/gift_certificates/gift_certificates_update.tpl"}

{elseif $content == "gift_cert_verification"}
{include file="addons/gift_certificates/gift_certificates_verification.tpl"}

{elseif $content == "lm_list"}
{include file="addons/listmania/list.tpl"}

{elseif $content == "rma_returns"}
{include file="addons/rma/rma_returns.tpl"}

{elseif $content == "rma_create_return"}
{include file="addons/rma/rma_create_return.tpl"}

{elseif $content == "rma_return_details"}
{include file="addons/rma/rma_return_details.tpl"}

{**[/ADDONS_DATA]**}

{else}
{include file="welcome.tpl"}
{/if}
...




But I’m wondering if these conditions work anywhere in the cart… :confused:

The variable $content is accessible in any template file. So are $target, $mode.

[quote name=‘illusion’]

I would like to have a [info] button besides the [buy now] button, wherever the [buy now] button appears. To make the [info] button appear besides the [buy now] button, I would need to include it in the “buy_now.tpl”.



To avoid the [buy now] button appearing in the homepage and/or in the product detail’s page, I would need to combine two conditions. Something like:



IF homepage OR product-detail-page
DO NOT SHOW [buy now] BUTTON
ELSE
SHOW [buy now] BUTTON


[/QUOTE]



Never mind, got it working :wink:



Thanks for all the tips!

Hm… a little stupid I didn’t post it here before, went looking for it again… :smiley:



In this case it IS homepage, only!


{*** if homepage - BEGIN ***}
{if $current_url == "$index_script"}
DO THIS
{else}
DO THAT
{/if}
{*** if homepage - END ***}




Cheers

Hi again guys, long time no see.



I want to have a little something in my product details page whenever that product has extra images. Nothing otherwise. The thing I came accross and didn’t work was:



{* show the little something only when there are extra images *}
{if $product.image_pairs}


{/if}




Any ideas? Using 1.3.5sp2

Hello Snorocket,


[quote name=‘snorocket’]this should work:


{if $category.category_id == '357' || $category.category_id == '358' || $category.category_id == '359'}
*do this*
{else}
*do that*
{/if}
[/QUOTE]



Thank you, :wink:





Lee Li Pop