X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Changing the background color based on Category (https://forum.x-cart.com/showthread.php?t=54616)

Shamun 07-16-2010 08:19 PM

Re: Changing the background color based on Category
 
Quote:

Originally Posted by minfinger
Alright I will this weekend. If I can't nail this, I think I'll get paid :D


If you cant do something then you get paid?
Sorry bud, but I'm firing you and taking your job 8)

ARW VISIONS 07-16-2010 08:24 PM

Re: Changing the background color based on Category
 
Lol!!!!!!!!!!!!!!!!!!!!!!:d/

gb2world 07-16-2010 08:43 PM

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.

minfinger 07-17-2010 06:45 AM

Re: Changing the background color based on Category
 
Tal LOL Typo...

Gb2world, yeah I think that's the problem as well I'm trying to do this mod to the Bestsellers list first.

Tal, you suggestion did not work. The TPL treated it like now class had been assigned in the <ul> I removed the class="bestsellers-products-item" from the original tpl and got the same results.

$bestsellers.cat didn't work either.

minfinger 07-17-2010 09:17 AM

Re: Changing the background color based on Category
 
I think the biggest problem is that Cat is not either established yet or I don't no with the call is for it.

Well I figured out that if I put in if $cat eq "Males" that it would change to blue, if the puppy is not a male, it doesn't go pink.

I have no idea, grr x-cart!

minfinger 07-17-2010 09:20 AM

Re: Changing the background color based on Category
 
I think it needs to be setup in the <li> and not the <ul>

The <ul> is outside of the {foreach} so it's static.

gb2world 07-17-2010 10:38 AM

Re: Changing the background color based on Category
 
Quote:

I think the biggest problem is that Cat is not either established yet or I don't no with the call is for it.

Webmaster mode answers those questions. If you do not see it, you need to add a query to the php to retrieve it for the template. If you do see it - you know what it is called.


All times are GMT -8. The time now is 09:46 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.