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)
-   -   If a product option exists, display icon on products_t.tpl (https://forum.x-cart.com/showthread.php?t=42968)

Christopher728 10-14-2008 01:14 PM

If a product option exists, display icon on products_t.tpl
 
Hey Guys,
I want to have a little icon display next to the product thumbnail in products_t.tpl if a product has a certain option, such as color.

Does anyone know how that might be accomplished?

This doesn't work of course, but something along these lines - {if $products[product].product_options eq 'Color'}...{/if}

Thanks in advance.

EDIT: This cart is v4.1.11

Yurij 10-15-2008 06:05 AM

Re: If a product option exists, display icon on products_t.tpl
 
Quote:

Originally Posted by Christopher728
Hey Guys,
I want to have a little icon display next to the product thumbnail in products_t.tpl if a product has a certain option, such as color.

Does anyone know how that might be accomplished?

This doesn't work of course, but something along these lines - {if $products[product].product_options eq 'Color'}...{/if}

Thanks in advance.


What do you use for this:
product options or product variants or extra fileds?

PS. By default product data on products page does not contain information about product option/variants.

Christopher728 10-15-2008 08:32 AM

Re: If a product option exists, display icon on products_t.tpl
 
Quote:

Originally Posted by Yurij
What do you use for this:
product options or product variants or extra fileds?


Thanks for the response, I want to use it for variants. I thought it would be cool to have a little color wheel icon, and maybe some text, to indicate that particular product has color choices. I think most people would check, but I also think some people assume that the color in the thumbnail is all that is available.

I should also mention that this particular Cart is v4.1.11

Oh, and just in case I wasn't clear, I don't want the options available on the product listing page, just the icon/text if there are options.

Quote:

Originally Posted by Yurij
PS. By default product data on products page does not contain information about product option/variants.


Yes I know, I don't know why Qualiteam won't include that functionality.

JWait 10-16-2008 01:03 PM

Re: If a product option exists, display icon on products_t.tpl
 
Right now I include "4 Colors" or however many in the Product Title to let the customer know there are color choices, but a "colors" graphic would be cool.

It should be easy enough... if product_options >0 display graphic

Christopher728 10-16-2008 04:53 PM

Re: If a product option exists, display icon on products_t.tpl
 
Well, I'm half way there I think, I've figured out that if I put

Code:

{if $products[product].variantid}Icon here{/if}

It will display if there is a variant and not if there are no variants, but does anyone know how to target a specific class like color vs. size? How do you call the class?

Thanks to everyone that been looking into this!

JWait 10-16-2008 05:01 PM

Re: If a product option exists, display icon on products_t.tpl
 
I think the problem is variant IDs are a number, and it seems that for every product when you create a variant, lets say "color" in this instance, it creates the variations and assigns it a variant id number. The next product, even if it has the same "color" choices will have a new variant id number, at least that is the way I think it works, from what I have seen.

Christopher728 10-16-2008 05:55 PM

Re: If a product option exists, display icon on products_t.tpl
 
Well maybe I have to target the option itself instead of the variant. I've noticed that too, what you were saying about the id numbers. But I've also noticed in exported product csvs that in the variant section there is a column titled "!CLASS" which holds the option names like color or size, so there's gotta be a way to target that class, I just don't know enough about writing code to write it properly. Hopefully someone here knows how.

JWait 10-17-2008 04:48 AM

Re: If a product option exists, display icon on products_t.tpl
 
Well, the xcart_classes table contains "class" that appears to contain whatever you name your option... things like color, size, etc. and in my case "color" is repeated at least several times. That does look like what we need to look at to make the determination. the field productid is also in that table.

Maybe something like
{if $classes[productid].class ="color"}Icon here{/if}

Christopher728 10-17-2008 11:14 AM

Re: If a product option exists, display icon on products_t.tpl
 
Well, I tried that, and several variations thereof, but still no luck :(

JWait 10-17-2008 03:04 PM

Re: If a product option exists, display icon on products_t.tpl
 
I think we are going to have to look at the product.tpl and see how it calls the options. It possibly needs to be something like $product[productid].classes.class="color" Like you, I'm not very good at the php stuff, but this will be a learning experience.


All times are GMT -8. The time now is 02:00 PM.

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