Skip to content
This repository was archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Apply PR #101 to new module version
Browse files Browse the repository at this point in the history
  • Loading branch information
David Paz committed Mar 21, 2016
1 parent 319eef8 commit 54a8528
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions src/app/code/community/FACTFinder/Core/Model/Export/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -861,25 +861,51 @@ protected function _exportImageAndDeepLink($productIndex, $productData, $storeId
$imageType = Mage::getStoreConfig('factfinder/export/suggest_image_type', $storeId);
$imageSize = Mage::getStoreConfig('factfinder/export/suggest_image_size', $storeId);

$product = Mage::getModel('catalog/product');
$product->setStoreId($storeId);
$product->load($productData['entity_id']);

$image = $this->_imageHelper->init($product, $imageType);
//$product = Mage::getModel('catalog/product');
//$product->setStoreId($storeId);
//$product->load($productData['entity_id']);
//
//$image = $this->_imageHelper->init($product, $imageType);
if (isset($imageSize) && $imageSize > 0) {
$image->resize($imageSize);
}

$image = (string) $image;
list($width, $height) = explode('x', strtolower($imageSize));
$imageBaseFile = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productData['entity_id'], $imageType, $storeId);
$imageModel = Mage::getModel('catalog/product_image')
->setWidth($width)
->setHeight($height)
->setDestinationSubdir($imageType)
->setBaseFile($imageBaseFile);

if ($storeId !== null) {
$image = str_replace($baseAdminUrl, $currentBaseUrl, $image);
if(!$imageModel->isCached()) {
$imageModel->resize();
}
$productImage = $imageModel->getUrl();

$productUrl = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter('entity_id', $productData['entity_id'])
->setStoreId($storeId)
->addUrlRewrite()
->getSelect()->limit(1);

$productUrl->getFirstItem()->getProductUrl();

//$image->resize($imageSize);

if ($storeId !== null) {
$productImage = str_replace($baseAdminUrl, $currentBaseUrl, $productImage);
}

$productIndex[] = $productImage;
$productIndex[] = $productUrl;
}

$productIndex[] = $image;
$productIndex[] = $product->getProductUrl();
//$image = (string) $image;

//$productIndex[] = $image;
//$productIndex[] = $product->getProductUrl();

$product->clearInstance();
//$product->clearInstance();
}

return $productIndex;
Expand Down

0 comments on commit 54a8528

Please sign in to comment.