0

we are adding Custom options to the products with custom options Values as "Black" & "Green".

enter image description here

in frontend , its displaying like below image as in link1 :

enter image description here

But instead of text - Black & Green , i want to display images as below....

enter image description here

i uploaded Black & Green images to below path :

if custom option value is green, i want to display below image :

http://sbdev2.kidsdial.com:81/media/catalog/custom/green.png

if custom option value is black, i want to display below image :

http://sbdev2.kidsdial.com:81/media/catalog/custom/black.png

app/design/frontend/base/default/template/catalog/product/view/options/type/select.phtml

<?php /* @var $this Mage_Catalog_Block_Product_View_Options_Type_Select */ ?>
<?php $_option = $this->getOption() ?>
<dt><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo $this->escapeHtml($_option->getTitle()) ?></label></dt>
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
 <div class="input-box">
 <?php echo $this->getValuesHtml() ?>
 <?php if ($_option->getIsRequire()): ?>
 <?php if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX): ?>
 <span id="options-<?php echo $_option->getId() ?>-container"></span>
 <?php endif; ?>
 <?php endif;?>
 </div>
</dd>
asked Jan 18, 2017 at 13:20
0

5 Answers 5

1
answered Jan 19, 2017 at 9:45
2
  • Thanks , is there any chance that we can make it work with help of css - hiding text with css lable icons as here or atleast with php if condition like if text = black than display image..... Commented Jan 19, 2017 at 9:52
  • one more thing is we are using simple product with custom options, we are not using configurable product..... Commented Jan 19, 2017 at 10:05
0
2
  • Thanks for links, client dont want to use any extension, please check updated question, as we are using only 2 colors in entire site, black & green , i uploaded those images under media folder, instead of text, is there any way i can display that image ? Commented Jan 18, 2017 at 13:42
  • is there any chance that we can make it work with help of css - hiding text with css lable icons as here or atleast with php if condition like if text = black than display image..... Commented Jan 19, 2017 at 9:57
0
.product-options ul.options-list .label>label.Black
{ font-weight: normal;
width: 50px;
height: 50px;
border-radius: 50%;
background-image: url("http://sbdev2.kidsdial.com:81/media/catalog/custom/green.png") !important;
background-size: cover !important;
display: block;
color: transparent;
padding: 0 !important;
font-size: 0;
}
$(document).ready(function(){
var inner = Array();
inner = $(" .product-options ul.options-list .label>label");
for (i=0;i<inner.length;i++){
var classN = inner[i].innerText;
if (classN=="Black" || classN=="Green"){
inner.eq(i).addClass(classN);
}
}
});
answered Jan 19, 2017 at 18:01
0
0

Download free extesion from the below link :

http://hkpatel201.blogspot.in/2015/05/option-swatches-module-source.html

This extension is working fine on product listing & product detailed page for the custom option.

Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
answered Jan 19, 2017 at 9:08
1
  • Thanks , is there any chance that we can make it work with help of css - hiding text with css lable icons as here or atleast with php if condition like if text = black than display image..... Commented Jan 19, 2017 at 9:52
0

You can use this module

https://github.com/gaurangpadhiyar007/edge-magento-module-customoptionimage

Available as Free and Open Source.

answered Jan 30, 2018 at 6:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.