Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Customizing right side column

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-11-2010, 08:54 AM
 
golfland golfland is offline
 

Member
  
Join Date: Mar 2007
Posts: 26
 

Default Customizing right side column

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
Reply With Quote
  #2  
Old 08-11-2010, 10:47 AM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Customizing right side column

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.
__________________
- Shane Munroe
Reply With Quote
  #3  
Old 08-11-2010, 12:00 PM
 
golfland golfland is offline
 

Member
  
Join Date: Mar 2007
Posts: 26
 

Default Re: Customizing right side column

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
Reply With Quote
  #4  
Old 08-11-2010, 12:22 PM
 
golfland golfland is offline
 

Member
  
Join Date: Mar 2007
Posts: 26
 

Default Re: Customizing right side column

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
Reply With Quote
  #5  
Old 08-11-2010, 12:23 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Customizing right side column

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.
__________________
- Shane Munroe
Reply With Quote

The following user thanks Shamun for this useful post:
golfland (08-11-2010)
  #6  
Old 08-11-2010, 12:37 PM
 
golfland golfland is offline
 

Member
  
Join Date: Mar 2007
Posts: 26
 

Default Re: Customizing right side column

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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:09 AM.

   

 
X-Cart forums © 2001-2020