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

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-14-2008, 01:14 PM
  Christopher728's Avatar 
Christopher728 Christopher728 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: CA
Posts: 46
 

Default 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
__________________
X-cart versions 4.1.11, 4.1.9 & 4.1.8
Reply With Quote
  #2  
Old 10-15-2008, 06:05 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default 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.
Reply With Quote
  #3  
Old 10-15-2008, 08:32 AM
  Christopher728's Avatar 
Christopher728 Christopher728 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: CA
Posts: 46
 

Default 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.
__________________
X-cart versions 4.1.11, 4.1.9 & 4.1.8
Reply With Quote
  #4  
Old 10-16-2008, 01:03 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default 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
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #5  
Old 10-16-2008, 04:53 PM
  Christopher728's Avatar 
Christopher728 Christopher728 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: CA
Posts: 46
 

Default 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!
__________________
X-cart versions 4.1.11, 4.1.9 & 4.1.8
Reply With Quote
  #6  
Old 10-16-2008, 05:01 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default 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.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #7  
Old 10-16-2008, 05:55 PM
  Christopher728's Avatar 
Christopher728 Christopher728 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: CA
Posts: 46
 

Default 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.
__________________
X-cart versions 4.1.11, 4.1.9 & 4.1.8
Reply With Quote
  #8  
Old 10-17-2008, 04:48 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default 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}
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #9  
Old 10-17-2008, 11:14 AM
  Christopher728's Avatar 
Christopher728 Christopher728 is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: CA
Posts: 46
 

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

Well, I tried that, and several variations thereof, but still no luck
__________________
X-cart versions 4.1.11, 4.1.9 & 4.1.8
Reply With Quote
  #10  
Old 10-17-2008, 03:04 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default 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.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
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 02:31 PM.

   

 
X-Cart forums © 2001-2020