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

Auto-Generated Color or Image Swatches from Product Options

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 05-16-2006, 01:17 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Yes, you can have multiple CSS files. Though most people may get away with the other method in this thread and just use images.

Here's an example in my product.tpl:

I show a manufactures logo. But, as I do not want to call the logo from the MySQL table and php, I use a Smarty variable replacement.
Code:
[img]{$ImagesDir}/brands/{$product.manufacturer|replace:' ':''}.gif[/img]

If I put an image in the skin1/images dir and in a folder called "brands", I could then call the images with a Smarty variable. But, some brands (and colors) would have multiple words. So I tweak the variable to replace "spaces" with no space. That's the |replace:' ':'' part of the code.

Using the other solution in this thread, you could then also use the "Product Option" itself to show an image with it's name. Easier than CSS if you only have a few brands or charts to display, but CSS works well if you have a lot of brands with a lot of color variations. Say I have 130 brands with 50 diff. color charts. It might only work to use the CSS technique and if statement method as you have done.

That way, you only get the core CSS skin1 file AND the one manufacturers CSS file for the color calls... a lot less code than calling all CSS files into the template structure. And as I mentioned a decent entry-level alternative vs. php and MySQL work which would be necessary if you actually wanted to assign a swatch image to the variant table. X-Cart did this for a site I know, but it was a bit complex and a few hundred dollar job. I'm sure they have the code for many specific needs.

- Mike
__________________
4.1.9
Reply With Quote
  #32  
Old 06-23-2006, 01:18 AM
 
dazybabes dazybabes is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 70
 

Default

Do you know how i can change the coding so that it looks at a specific variant ie colour/swatch variant rather than sizes?

we dont have that many colours usually black, white or hivis.

I just want it to bring in the colour swatch.tpl if there is a colour variant available and not have it bring in blank swatches for the sizes?
__________________
X-Cart Version 4.0.3
Reply With Quote
  #33  
Old 07-01-2006, 05:13 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

I have started trying to get this to work for 4.1.x and have managed to display one column of variants (colors only). Can anyone help me to: 1. Allow for 2 or 3 columns and 2. Display only available color swatches/names?
Code:
{capture name=dialog} {foreach from=$product_options item=v} {assign var="x" value="product_options[`$v.classid`]"} {/foreach} <table><tr> {foreach from=$v.options item=o} <td background="{$xcart_web_dir}images/S/{$product.manufacturer}_{$o.option_name|replace:" ":""|replace:"/":""}.gif">[img]{$ImagesDir}/spacer.gif[/img]</td> <td>{$o.option_name}</td></tr> {/foreach} </table> {/capture} {include file="dialog.tpl" title=$lng.lbl_color_chart content=$smarty.capture.dialog extra='width="100%"'}
With the current 4.1.x variant images, it's strange to not see an X-Cart coded swatch image display. I have used the manufacturers and the option name to get a static image to be used as a background, but there must be a more professional method to do this. Ideas?

My mod has a directory in the images dir. called "S" and the images are named "Brand_ColorTitle.gif".

Thank for helping me to develop this intermediary solution.

- Mike
__________________
4.1.9
Reply With Quote
  #34  
Old 03-06-2007, 04:02 PM
 
damian damian is offline
 

Newbie
  
Join Date: Feb 2007
Posts: 6
 

Default Re: Auto-Generated Color or Image Swatches from Product Options

Hi Mike,

Thanks a ton for sharing all your time on this. I've just read this whole thread and wanted to touch base with you to see what your current take on the best solution to this is... any advice would be greatly appreciated as I'm about to jump in to trying to get this mod to work.

Thanks!
Damian
__________________
-- Mindshare Studios
using X-Cart 4.1.7
fashion mosaic
fancy categories
x-magnifier
(pretty much all addons...)
Reply With Quote
  #35  
Old 01-11-2008, 03:19 AM
  Cyber Matrix's Avatar 
Cyber Matrix Cyber Matrix is offline
 

eXpert
  
Join Date: Dec 2006
Posts: 199
 

Default Re: Auto-Generated Color or Image Swatches from Product Options

Has any figured out how to put thumbnail images and place them under the product image for 4.1 verision as http://www.ridersinc.com/alpinestars-boots-supertech-r-2008-p100221.html is using it in addition to the dropdown that is comes with the cart?

I see how the drop down works by swamping images but I would also like to have thumbnails under the product image. Most people will not know to use the dropdown to see other images.
__________________
Cyber Matrix
-------------------
X-Cart 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 05:01 PM.

   

 
X-Cart forums © 2001-2020