예제 #1
0
 /**
  * Add image and deep link information to product row
  *
  * @param array $productIndex
  * @param array $productData
  * @param int   $storeId
  *
  * @return array
  */
 protected function _exportImageAndDeepLink($productIndex, $productData, $storeId)
 {
     if ($this->_getIfExportImageAndDeeplink($storeId)) {
         $baseAdminUrl = Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         if ($storeId !== null) {
             $currentBaseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         }
         $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);
         if (isset($imageSize) && $imageSize > 0) {
             $image->resize($imageSize);
         }
         $image = (string) $image;
         if ($storeId !== null) {
             $image = str_replace($baseAdminUrl, $currentBaseUrl, $image);
         }
         $productIndex[] = $image;
         $productIndex[] = $product->getProductUrl();
         $product->clearInstance();
     }
     return $productIndex;
 }
예제 #2
0
 /**
  * Add the nice cache name to the image model
  *
  * @param Mage_Catalog_Model_Product $product
  * @param string $attributeName
  * @param string  $imageFile
  * @return Netzarbeiter_NicerImageNames_Helper_Image
  */
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     parent::init($product, $attributeName, $imageFile);
     if (!Mage::getStoreConfig("catalog/nicerimagenames/disable_ext")) {
         $this->_getModel()->setNiceCacheName($this->_getNiceCacheName($attributeName));
     }
     return $this;
 }
예제 #3
0
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     if ($this->_isEnabled()) {
         $this->_configuration = $this->_getConfigHelper()->buildConfiguration();
         $this->_dimensions = Dimensions::null();
         $this->_attributeName = $attributeName;
         $this->_imageProvider = CloudinaryImageProvider::fromConfiguration($this->_configuration);
     }
     return parent::init($product, $attributeName, $imageFile);
 }
예제 #4
0
 /**
  * Add the nice cache name to the image model
  *
  * @param Mage_Catalog_Model_Product $product
  * @param string $attributeName One of 'image', 'small_image' or 'thumbnail'
  * @param string $imageFile
  * @return Toto_Watermarkplus_Helper_Image
  */
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     parent::init($product, $attributeName, $imageFile);
     if (!Mage::getStoreConfig("watermarkplus_options/settings/disable_ext")) {
         $this->_getModel()->setNiceCacheName($this->_getGeneratedNameForImageAttribute($attributeName));
     }
     if (Mage::getStoreConfig("watermarkplus_options/settings/generate_labels")) {
         $this->_setNicerImageLabels($attributeName);
     }
     return $this;
 }
예제 #5
0
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     if (!Mage::helper('magefm_cdn')->isEnabled()) {
         return parent::init($product, $attributeName, $imageFile);
     }
     $this->_reset();
     $this->_setModel(Mage::getModel('catalog/product_image'));
     $this->_getModel()->setDestinationSubdir($attributeName);
     $this->setProduct($product);
     if ($imageFile) {
         $this->setImageFile($imageFile);
     } else {
         $this->_getModel()->setBaseFile($this->getProduct()->getData($this->_getModel()->getDestinationSubdir()));
     }
     return $this;
 }
예제 #6
0
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     $ModuleName = Mage::app()->getRequest()->getModuleName();
     $ControllerName = Mage::app()->getRequest()->getControllerName();
     $ActionName = Mage::app()->getRequest()->getActionName();
     $RouteName = Mage::app()->getRequest()->getRouteName();
     $controller = "{$ModuleName}_{$ControllerName}_{$ActionName}";
     Mage::getModel('catalog/session')->setCurrentSimpleProduct(null);
     Mage::getModel('catalog/session')->setCurrentSimpleProductId(null);
     if ('catalog_product_view' == $controller && is_object($this->getProduct()) && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $this->getProduct()->getTypeId()) {
         $attributes = Mage::helper('core')->decorateArray($this->getProduct()->getTypeInstance(true)->getConfigurableAttributes($this->getProduct()));
         $selectedAttributeCode = false;
         foreach ($attributes as $attribute) {
             $selectedOption = Mage::app()->getRequest()->getParam($attribute->getProductAttribute()->getAttributeCode(), false);
             if ($selectedOption) {
                 $selectedAttributeCode = $attribute->getProductAttribute()->getAttributeCode();
             }
         }
         if ($selectedAttributeCode) {
             $allProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct());
             foreach ($allProducts as $simpleProduct) {
                 if ($simpleProduct->isSaleable() && $simpleProduct->getData($selectedAttributeCode) == Mage::app()->getRequest()->getParam($selectedAttributeCode)) {
                     $simpleProduct->load();
                     if (count($simpleProduct->getMediaGalleryImages()) > 0) {
                         $products[] = $simpleProduct;
                     }
                 }
             }
         }
         if (isset($products) && is_array($products) && count($products) > 0) {
             $product = $this->_currentSimpleProduct = $products[0];
             Mage::getModel('catalog/session')->setCurrentSimpleProduct($product);
             Mage::getModel('catalog/session')->setCurrentSimpleProductId($product->getId());
             if (Mage::getStoreConfig('smdesign_colorswatch/general/update_more_view')) {
                 $this->getProduct()->setData('media_gallery_images', $product->getMediaGalleryImages());
             }
         }
     }
     return parent::init($product, $attributeName, $imageFile);
 }
예제 #7
0
 /**
  * Initialize image by specified type
  *
  * @param string $imageType
  * @return Mage_Catalog_Helper_Image
  */
 protected function _init($imageType = 'image')
 {
     return $this->_helper->init(self::$_product, $imageType);
 }
예제 #8
0
 public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
 {
     parent::init($product, $attributeName, $imageFile);
     $this->backgroundColor(Mage::helper('yomarketsettings')->getImageBackgroundColor());
     return $this;
 }