Re: Changing the background color based on Category
If the code does not work for you - this probably why:
The css you provided is from a bestsellers list. The link you provided appears to be products on a category page.
I believe the $cat variable is the main category for a product on the product page. It appears you might need a category being passed inside an array of products - a category for each product.
To see if category variables exist for the products in a list (bestsellers, featured products, etc.) - Open webmaster mode and look for the array that holds all the products. You should be able to recognize it. I think the bestsellers array is called $bestsellers. On a category page, the products array is called $products.
Inside those arrays, if you see a variable that you recognize as the main category for that product - then you use that variable in the array - something like $bestsellers.category. If it is not there - then you have to add a query to the php file to get the category and pass it to the template so it is available to you.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
|