0

Hi this is my code in view.phtml,

<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
    var assocIMG =  // Added  - Removed { here, causes issues with other scripts when not working with a configurable product.
<?php
    if ($_product->getTypeId() == "configurable") {
        echo "{";
        $associated_products = $_product->loadByAttribute('sku', $_product->getSku())->getTypeInstance()->getUsedProducts();
        foreach ($associated_products as $assoc)
            $dados[] = $assoc->getId().":'".($assoc->image == "no_selection" || $assoc->image == "" ? $this->helper('catalog/image')->init($_product, 'image', $_product->image)->resize(365,400) : $this->helper('catalog/image')->init($assoc, 'image', $assoc->image)->resize(365,400))."'";
    } else {
        $dados[] =  "''";
    }
    echo implode(',', $dados );     
    if ($_product->getTypeId() == "configurable") {
        echo "}";
    }
    ?>
</script>

And i'n my configurable.js,

var productNo = intersect(selectedAssocProducts) || selectedAssocProducts[attributeId][0];
alert(assocIMG[productNo]);

Giving me http://localhost/vinoth/liveinnew/media/catalog/product/cache/1/image/365x400/9df78eab33525d08d6e5fb8d27136e95/S/L/SLP-DB-1_24.jpg

IS there any way to get full image of the product instead of resized ?

I've tried removing resizing condition in view.phtml but it's affetcing all.

Did anyone know how to solve this ?

1

You can get the full size image like this:

$this->helper('catalog/image')->init($assoc, 'image', $assoc->image).

Place this where you need it.

  • that's affecting all images. I need both full image and re-sized image. Because for product zoom i need full image. – Vinoth Jul 25 '14 at 5:57
  • @Vinoth. Edited my answer. – Marius Jul 25 '14 at 5:58

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.