View Single Post
  #22  
Old 01-01-2004, 10:54 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Since I've seen many requests for a "how the color changes happen on aheadgames?" Here's my take on how to achieve this easily.

First thing that needs to be established is the root category, keeping the same category ID's is important.

Second, add a bit of custom code to customer/home.tpl replacing the style sheet reference link with something similar to this:
Code:
<link rel="stylesheet" href="{$SkinDir}/{if $cat eq "250"}skin1_blue.css{elseif $cat eq "251}skin1_red.css{/if}">
Note that your category ID's will differ as to what color you want to switch into.

Third, you will need to create these new style sheets for each color change that you want to switch into on particular cats.

Also, if you notice on aheadgames, after clicking a root cat, and viewing a subcat of the selected root cat, the simple script above will need to know the root category of the sub category as to keep the proper skin style sheet color.

Code:
http://www.aheadgames.com/cart/customer/home.php?cat=350&topcat=249

Note that cat=350 is a subcat of 249, which is being specified in the links.

So you will need to modify your categories.tpl to keep a tab on the root category of the current select subcat.

OR, Here's a more simpler approach that won't require you to specify the rootcat of any product link that needs to stay the same color in your anchor or ahref links:

Edit customer/cateogries.php and modify the $categories_data SQL query to:
Code:
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

Note we are now keeping tabs of root_category_name, category_name

Now you would need to change the {if} statements we have setup in customer/home.tpl to reflect these new changes.

Code:
<link rel="stylesheet" href="{$SkinDir}/{if $root_category_name eq "Root category one"}skin1_blue.css{elseif $root_category_name eq eq "Root category two"}skin1_red.css{/if}">
NOTE that you will now specify the root category name vs the ID, so make sure your if statements are setup case senstive.

Anyhow, if this still isn't very clear, please feel free to PM me for a service request to have it setup on your x-cart.

Kudos!
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote