Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

can msgento change image according to it’s color attribute ?? 
 
kevinblack
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2011-05-10
 

file catalog/product/view/type/options/configurable.phml

<?php
$_product 
$this->getProduct();
$_attributes Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php 
if ($_product->isSaleable() && count($_attributes)):?>
    
<dl>
    
<?php foreach($_attributes as $_attribute): ?>
        <?php
        $_attributeId 
$_attribute->getAttributeId();
        
$_attributeInfo Mage::getModel('eav/entity_attribute')->load($_attributeId);
        
$_attributeLabel str_replace(' ','-',strtolower($_attributeInfo->getFrontendLabel()));
        
?>
            
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
                <
div class="input-box">
                    <
select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select kevin-black-<?php echo $_attributeLabel;?>">
                    <
option><?php echo $_attributeInfo->getFrontendLabel() ?></option>
                    </
select>
                </
div>
            </
dd>
        
<?php endforeach; ?>
    
</dl>
<
script type="text/javascript">
    var 
spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    
//kevin.qazware@gmail.com Change Text follow attribute Label
    
function changeFristText(){
        <?php 
foreach($_attributes as $_attribute): ?>
            <?php
            $_attributeId 
$_attribute->getAttributeId();
            
$_attributeInfo Mage::getModel('eav/entity_attribute')->load($_attributeId);
            
?>
            
var label '<?php echo $_attributeInfo->getFrontendLabel();?>';
            $$(
'select.kevin-black-'+label).each(function(elem){
                
var options elem.childElements();
                
options[0].update(label);
            
});
        
<?php endforeach;?>
    }
</script>
<?php 
endif;?>

in file : js/varien/configurable.js replace line 171 = element.options[0] = new Option(element.config.label, ‘’);

It for all attribute set .

File Attachments
QoptionLabel.zip  (File Size: 8KB - Downloads: 152)
 
Magento Community Magento Community
Magento Community
Magento Community
 
heyokdang
Jr. Member
 
Total Posts:  5
Joined:  2009-12-10
 

hi Occo,

great code, thank you so much wink good man.

can you tell me know how can i got the images based on selected value, i need this code or only need solutions so that i can got image and put in javascript code combine with value chose in dropdown option color ( super attribute).

Lighthouse.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kevinblack
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2011-05-10
 

See more and test in here :
http://extensions.qazware.com/extensions/q-color-swatches.html
and
http://extensions.qazware.com/extensions/q-options.html
cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
gari marcos
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-10-24
 
kevinblack - 05 March 2012 12:49 AM

See more and test in here :
http://extensions.qazware.com/extensions/q-color-swatches.html
and
http://extensions.qazware.com/extensions/q-options.html
cool smile

Instal ok, but it drops a “SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘[databasename].qcolorswatches’ doesn’t exist”

trying to install it on Magento 1.6.2.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
gari marcos
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-10-24
 
kevinblack - 05 March 2012 12:49 AM

See more and test in here :
http://extensions.qazware.com/extensions/q-color-swatches.html
and
http://extensions.qazware.com/extensions/q-options.html
cool smile

And it shows it on your demo Admin Panel…
http://qoptions.qazware.com/index.php/admin/catalog_product/edit/id/167/key/bd4dd41134edeca7e0d8b3611eb23abb/

 
Magento Community Magento Community
Magento Community
Magento Community
 
kevinblack
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2011-05-10
 
gari marcos - 06 March 2012 09:17 AM

kevinblack - 05 March 2012 12:49 AM
See more and test in here :
http://extensions.qazware.com/extensions/q-color-swatches.html
and
http://extensions.qazware.com/extensions/q-options.html
cool smile

And it shows it on your demo Admin Panel…
http://qoptions.qazware.com/index.php/admin/catalog_product/edit/id/167/key/bd4dd41134edeca7e0d8b3611eb23abb/

Thanks for reply about bug.
Check it again.
I was checked and upload it to my site.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gari marcos
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-10-24
 
kevinblack - 07 March 2012 01:58 AM

gari marcos - 06 March 2012 09:17 AM
kevinblack - 05 March 2012 12:49 AM
See more and test in here :
http://extensions.qazware.com/extensions/q-color-swatches.html
and
http://extensions.qazware.com/extensions/q-options.html
cool smile

And it shows it on your demo Admin Panel…
http://qoptions.qazware.com/index.php/admin/catalog_product/edit/id/167/key/bd4dd41134edeca7e0d8b3611eb23abb/

Thanks for reply about bug.
Check it again.
I was checked and upload it to my site.

Stil not working mate… Now I cant see the images I already uploaded, and so I cant assign colors and images.

 
Magento Community Magento Community
Magento Community
Magento Community
 
milali
Jr. Member
 
Total Posts:  26
Joined:  2012-01-08
 

what is the state of this?

I am looking at changing the main image based on what selection product you choose from the main category.

So they select <type> and it has 3 drop down options for sizes.

I would like the image to change based on the selection.

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Hi milali, do you think the Image-Based Dynamic Configurable Products extension may work for you?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gfxguru
Sr. Member
 
Total Posts:  186
Joined:  2008-11-20
 

Don’t you just hate it when extension developers spam the forums looking for victims to buy their product because they can’t create enough value in the product to make it speak for itself.

The reason the thread took off was because of a bit of source code someone contributed, we are not here to buy code that presents or limits some bit of functionality based on someone else’s business plan on possibly someone else’s code. If your product speaks for itself you shouldn’t have to constantly spam the forums....Telling someone of something that can help is different from beating someone with it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gfxguru
Sr. Member
 
Total Posts:  186
Joined:  2008-11-20
 

oh and BTW… Thank you for everyone’s that’s contributed! This is a much needed capability that I am looking to expand upon.  Anyone have any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gfxguru
Sr. Member
 
Total Posts:  186
Joined:  2008-11-20
 

Funny thing is this thread is how old? 4 years… wow.

 
Magento Community Magento Community
Magento Community
Magento Community
 
trouble.tribbles
Jr. Member
 
Total Posts:  17
Joined:  2010-04-13
 

Any ideas for allowing this functionality on a category page? I have my category pages set up with each product having a dropdown for color?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shiftins
Jr. Member
 
Total Posts:  2
Joined:  2012-09-04
 

Does anyone know where to put the code to make this work? I am not very good at coding.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gayanhewa
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2011-06-01
Ireland
 

I was able to successfully implent the above solution with Magento community 1.7 and Enterprise 1.12

Although i did some minor modifications the media.phtml as I removed the pop image load and added a main image swap on click for the thumbnails.

You can find the a post and a link to the source in Github <a href="http://gayanhewa.info/magento-image-color-switch-for-configurable-products-htm/">here</a>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top