| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Customizing right side column | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() We are creating a lot of resources that are specific to certain categories. I have created a tpl containing links to these resources for several categories but I am not sure how to make the correct file show on the correct category.
For example, if I have a category called dogs, I want to show all our dog resource links on the right side. Same with birds, fish, etc. each will have its own resource link section that I only want to show when you are on the relevant category. Code I have tried and diod not work: <!-- right bar --> {if $main neq "catalog" || $current_category.category eq "11"} {include file="customer/main/dogs.tpl"} {/if} ------ {if $main neq "catalog" && $current_category.category eq "11"} {include file="customer/main/dogs.tpl"} {/if} ------ {if $current_category.category eq "11"} {include file="customer/main/dogs.tpl"} {/if} ----- {if $current_category eq "11"} {include file="customer/main/dogs.tpl"} {/if} ------ none of these seemed to do the trick. Anyone got any ideas on how to have a file show only for a select category? Thanks!
__________________
live: 4.3.2 w/below Mods On Sale MAP Mod Power Filter Mega Menu ezupsell youtube Dev: 4.4.1 |
|||||||
#2
|
|||||||
|
|||||||
![]() You're looking for {$current_category.categoryid} if its for 4.3
May also want {$current_category.parentid} if it's a subcategory of dogs. |
|||||||
#3
|
|||||||
|
|||||||
![]() Tal, Thank you for your reply. I still cannot seem to get this to work properly.
I have tried: {if $current_category.parentid eq "11" || $current_category.categoryid eq "11"} {include file="xxx/.tpl"} {/if} {if $current_category.parentid eq "11"} {include file="xxx/.tpl"} {/if} {if $current_category.categoryid eq "11"} {include file="xxx/.tpl"} {/if} Oddly when i tried {if $current_category.categoryid neq "11"} {include file="xxx/.tpl"} {/if} the tpl showed on a different category and only appeared on this 1 category? What this 1 category had that no other one had was featured product. Not sure if that is just coincidence or if featured products are affecting this some how? Is there a x-cart smarty cheat sheet or some other x-cart smarty resource? How can I know what variables are available to try. current_category.categoryid seems logical.. not sure what else to try. The tpl did pull using 'neq' so I can safely assume the path and the the tpl file itself are not the issue. Thanks! Balinor/Moderator - should this be thread moved to program logic forum?
__________________
live: 4.3.2 w/below Mods On Sale MAP Mod Power Filter Mega Menu ezupsell youtube Dev: 4.4.1 |
|||||||
#4
|
|||||||
|
|||||||
![]() I tried teh below and it did work with a different tpl file, so code is correct. thanks again Tal, just need figure the issue in the tpl I created.
{if $current_category.categoryid eq "11"} {include file="xxx/.tpl"} {/if} thanks!
__________________
live: 4.3.2 w/below Mods On Sale MAP Mod Power Filter Mega Menu ezupsell youtube Dev: 4.4.1 |
|||||||
#5
|
|||||||
|
|||||||
![]() Go to admin settings and in the general options area at the very bottom is a checkmark to enable/disable debug mode. Turn that on and whenever you view a page you'll get a pop-up with all available variable names and arrays.
It's formated as {$varName.$arrayName} when you want to access them on a tpl. So a var with the name of $foo had an array with a var inside with a name of bar then you would use {$foo.bar} in the tpl. $current_category.categoryid = Only for the current category. Look at the url and you'll see the number for the category. $current_category.parentid = Only for the parent category. Go up one level and you'll see it. |
|||||||
|
#6
|
|||||||
|
|||||||
![]() Good stuff.. I got it all working perfectly now using:
{if $current_category.categoryid eq"11" || $current_category.parentid eq "11"} fixed tpl, all is golden. thanks again
__________________
live: 4.3.2 w/below Mods On Sale MAP Mod Power Filter Mega Menu ezupsell youtube Dev: 4.4.1 |
|||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|