- Posts: 47
- Thank you received: 0
Display Color Swatch
- MahonyTech
-
Topic Author
- Offline
Less
More
14 years 10 months ago #31456
by MahonyTech
Display Color Swatch was created by MahonyTech
My client sells t-shirts and sweatshirts. They have various styles that have various colors. I know how to display the right pictures when a certain color is selected, but they want to show a color swatch that let's the customer's know what colors that item comes in. Thus, if an item comes in Black, White and Blue they want to display a small black rectangle, a small white rectangle and a small black rectangle on all versions of the product. Is there a way to do that?
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31476
by nicolas
Replied by nicolas on topic Re: Display Color Swatch
There is always a way. But that will require custom coding as there is no such options in HikaShop.
Please Log in or Create an account to join the conversation.
- MahonyTech
-
Topic Author
- Offline
Less
More
- Posts: 47
- Thank you received: 0
14 years 10 months ago #31481
by MahonyTech
Replied by MahonyTech on topic Re: Display Color Swatch
I figured as much. Can you give me some advice on how to approach this? One thing I was thinking was to name the graphics the same name as the variant itself, but in looking at it, I don't think that will work. Any thoughts on what would be a good approach for doing this?
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31484
by nicolas
Replied by nicolas on topic Re: Display Color Swatch
You should edit the file "show" of the view "product" via the menu Display>Views and loop through the $this->element->main->characteristics array to display all the images of the values of the characteristics.
Please Log in or Create an account to join the conversation.
- MahonyTech
-
Topic Author
- Offline
Less
More
- Posts: 47
- Thank you received: 0
14 years 10 months ago #31488
by MahonyTech
Replied by MahonyTech on topic Re: Display Color Swatch
However, won't that also show the large pictures that are shown when we select "white" as a color? Or is there another place to add these pics?
Have a look at cma.mtsidevspace.com/index.php
Select Men's Apparel
Select Graphic Tees
Select CM Bars
Now you see it is black. Now select Heather Gray and X-Large and see it change to gray.
Won't that feature change if I change the code as you suggest?
Have a look at cma.mtsidevspace.com/index.php
Select Men's Apparel
Select Graphic Tees
Select CM Bars
Now you see it is black. Now select Heather Gray and X-Large and see it change to gray.
Won't that feature change if I change the code as you suggest?
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31513
by nicolas
Replied by nicolas on topic Re: Display Color Swatch
We're talking about having color images somewhere and displaying them with additional custom code on the product page based on the characteristics of the product.
That is not linked to the display of the images of the product/variants done by HikaShop by default. So that feature should not be impacted by the code you will add.
That is not linked to the display of the images of the product/variants done by HikaShop by default. So that feature should not be impacted by the code you will add.
Please Log in or Create an account to join the conversation.
14 years 5 months ago - 14 years 5 months ago #47239
by ranwaldo
Replied by ranwaldo on topic Re: Display Color Swatch
FYI: The following CSS will add a small color swatch to the dropdown select box.
Modify the characteristic number, option value number, and image names to match your configuration. The images are 28 x 14.
A word of warning: This works fine for Firefox 11, but not IE 9, Chrome 18, or Safari 5.
Code:
select#hikashop_product_characteristic_9 option {
background-repeat:no-repeat;
background-position:bottom left;
padding-left:30px;
}
select#hikashop_product_characteristic_9 option[value="7"] {
background-image:url(/images/colors/SwatchWhite.jpg);
}
select#hikashop_product_characteristic_9 option[value="8"] {
background-image:url(/images/colors/SwatchKhaki.jpg);
}
Modify the characteristic number, option value number, and image names to match your configuration. The images are 28 x 14.
A word of warning: This works fine for Firefox 11, but not IE 9, Chrome 18, or Safari 5.
Last edit: 14 years 5 months ago by ranwaldo. Reason: Add warning
Please Log in or Create an account to join the conversation.
14 years 5 months ago - 14 years 5 months ago #47287
by ranwaldo
Replied by ranwaldo on topic Re: Display Color Swatch
Here is another approach which works with Firefox, IE, Chrome, and Safari. Rather than using a swatch image, it just sets the background of the select option.
Code:
select#hikashop_product_characteristic_9 option[value="7"] {
background-color: #FFFFFF; color: #000000;
}
select#hikashop_product_characteristic_9 option[value="8"] {
background-color: #D4D487; color: #FFFFFF;
}
Last edit: 14 years 5 months ago by ranwaldo. Reason: Fix spelling
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
Time to create page: 0.237 seconds