0

I am new to magento2, I'm testing fresh copy of Magento 2.1.7.

I want to display Product image in place of color swatches on product detail page for Color Attribute. In the admin section, i choose (Use Product Image for Swatch if Possible) to YES.

But Product detail page still showing color swatches rather than Product image. If I run reindex and clean command in CLI Product image appear on the first load and disappear if I refresh the page again.

Website URL:

http://staffordtest.com.au/women/tops-women/jackets-women/neve-studio-dance-jacket.html

IS THIS MAGENTO BUG?

  • (Use Product Image for Swatch if Possible) where this option is available @gilbertsohal I am trying same to achive – siddhesh Jul 25 '17 at 14:10
  • 1
    Hi siddhesh please follow below Store > Attribute > Product > Color (Attribute) > Attribute Properties > Use Product Image for Swatch if Possible Hope this will help. I find in my research if i disable EAV types and attributes in Cache Management Product image appear for swatches. I think this is bug in magento! – gilbertsohal Jul 26 '17 at 22:55
0

Create attribute of color and add them at that time they ask for color swatch also

and at the time of add product select that attribute and color

  • No luck! I try your way @Jaimin – gilbertsohal Jul 9 '17 at 22:55
0

This is a bug in Magento Swatches module: Magento\Swatches\Helper\Data::getSwatchAttributesAsArray() does not populate additional_data field into attribute's fields, but its callee relies on it.

Those fields are populated by another blocks if and only if they are not cached. That's why dropping of cache helps to render swatches properly.

What you need to do is call to patch it:

    foreach ($swatchAttributes as $swatchAttribute) {
        // The next line should be added!
        $this->populateAdditionalDataEavAttribute($swatchAttribute);
        $swatchAttribute->setStoreId($this->storeManager->getStore()->getId());

You can use vaimo/composer-patches to make and install patch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.