2

Is there a way to use the original image path instead of the cached one for the pinterest pinit button for products with multiple images?

domain_name/media/catalog/product/p/l/image.png

instead of:

domain_name/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/l/image.png

Using this line of code

$_baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$_baseUrl."catalog/product".$_product->getImage()

loads only the base image, regardless of the selected image

This is the code used in view.phtml for loading the pin it button:

<?php
  $_pinlink['url'] = $_product->getProductUrl();
  $_pinlink['media'] = $_baseUrl."catalog/product".$_product->getImage();
  $_pinlink['description'] = $_helper->productAttribute($_product, $_product->getName(), 'name') . " - " . strip_tags($_product->getDescription());?>
  <a href="http://pinterest.com/pin/create/button/?<?php echo http_build_query($_pinlink) ?>" class="pin-it-button" count-layout="horizontal"></a>
  <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

Thank you,

1
  • "loads only the base image, regardless of the selected image" - What do you mean with "selected image" in contrast to "base image"? Which image do you want to get the URL for? Commented Jul 14, 2015 at 17:03

0

Your Answer

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

Browse other questions tagged or ask your own question.