klaviyo / magento2-klaviyo

37 stars 51 forks source link

Getting product Image #13

Closed srenon closed 5 years ago

srenon commented 6 years ago

view/frontend/templates/product/viewed.phtml

Is there a reason you are getting a random image from the product image gallery using

$_product_image_url = null;
// Check to see if we have an image for this product.
 foreach ($_product->getMediaGalleryImages() as $_product_image) {
       if (!$_product_image->getDisabled()) {
           $_product_image_url = $_imagehelper
               ->init($_product, 'product_base_image')
               ->setImageFile($_product_image->getFile())
               ->getUrl();
                break;
       }
 }

instead of getting the main product image from the product?

$_product_image_url = $_imagehelper->init($_product, 'product_base_image')->getUrl();
srenon commented 5 years ago

@remstone7 ... this is not fixed

https://github.com/klaviyo/magento2-klaviyo/blob/master/Block/Catalog/Product/ViewedProduct.php#L155

remstone7 commented 5 years ago

will reopen, we can handle this differently and next release -> we've always grabbed the first image from the mediaGallery, certainly a better way to handle.

srenon commented 5 years ago

Give me 10 minutes to create a PR with a fix