public function getGalleryImages()
 {
     if ($this->_all === null) {
         if (class_exists('FlintDigital_SimpleProductData_Block_Product_View_Media')) {
             $block = new FlintDigital_SimpleProductData_Block_Product_View_Media();
             $collection = $block->getGalleryImages();
         } else {
             $collection = parent::getGalleryImages();
         }
         if (empty($collection) || $collection->getSize() == 0) {
             $productMediaConfig = Mage::getModel('catalog/product_media_config');
             $image = $this->getProduct()->getImage();
             if ($image != 'no_selection') {
                 $img['url'] = $productMediaConfig->getMediaUrl($image);
                 $img['id'] = null;
                 $img['path'] = $productMediaConfig->getMediaPath($image);
                 $collection = new Varien_Data_Collection();
                 $collection->addItem(new Varien_Object($img));
             }
         }
         $videosInit = new IWD_Productvideo_Block_Frontend_Init();
         $this->_all = new Varien_Data_Collection();
         if ($videosInit->getThumbnailsPosition() == 'before') {
             $this->_completeCollectionWithVideo();
         }
         foreach ($collection as $item) {
             $this->_all->addItem($item);
         }
         if ($videosInit->getThumbnailsPosition() == 'after') {
             $this->_completeCollectionWithVideo();
         }
     }
     return $this->_all;
 }
Example #2
0
 function _construct()
 {
     parent::_construct();
     if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $this->getProduct()->getTypeId()) {
         $usedAttributes = $this->getProduct()->getTypeInstance(true)->getUsedProductAttributes($this->getProduct());
         $productData = array();
         foreach ($usedAttributes as $attribute) {
             $optionValue = Mage::app()->getRequest()->getParam($attribute->getAttributeCode(), -1);
             if (-1 != $optionValue) {
                 foreach ($this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct()) as $simpleProduct) {
                     if ($simpleProduct->isSaleable() && $simpleProduct->getData($attribute->getAttributeCode()) == $optionValue) {
                         $simpleProduct->load();
                         if (count($simpleProduct->getMediaGalleryImages()) > 0 && $simpleProduct->getImage()) {
                             $simpleProduct->setData('enable_zoom_plugin', Mage::registry('product')->getData('enable_zoom_plugin'));
                             $products[] = $simpleProduct;
                             // unset produt without assingend secound attribute
                             foreach ($products as $key => $val) {
                                 if ($val->getData($attribute->getAttributeCode()) != $optionValue) {
                                     unset($products[$key]);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (isset($products) && is_array($products) && count($products) > 0) {
             $this->setProduct($products[0]);
         }
     }
 }
Example #3
0
 public function _toHtml()
 {
     // If default template was overridden, save for use later when outputting images gallery.
     $this->_oldTemplate = $this->getTemplate() ? $this->getTemplate() : 'catalog/product/view/media.phtml';
     // Change template to videogallery template.
     $this->setTemplate(Mage::helper('videogallery')->getVideoTemplate());
     return parent::_toHtml();
 }
Example #4
0
 public function _toHtml()
 {
     if (Mage::getStoreConfig('niveus_productvideo/settings/enable')) {
         $html = parent::_toHtml();
         $html .= $this->getChildHtml('media_video');
         return $html;
     } else {
         $html = parent::_toHtml();
     }
     return $html;
 }
Example #5
0
 function _construct()
 {
     parent::_construct();
     $modules = Mage::getConfig()->getNode('modules')->children();
     $modulesArray = (array) $modules;
     if (!isset($modulesArray['SMDesign_Colorswatch']) || isset($modulesArray['SMDesign_Colorswatch']) && $modulesArray['SMDesign_Colorswatch']->active == false) {
         return $this;
         // Colorswatch module is not available.
     }
     $id = (int) Mage::app()->getRequest()->getParam('id');
     $inCartProduct = null;
     $requestByCart = array();
     if ($id) {
         $quoteItem = Mage::getSingleton('checkout/cart')->getQuote()->getItemById($id);
         if ($quoteItem) {
             $selectedOption = $quoteItem->getOptionByCode('simple_product');
             $inCartProduct = Mage::getModel('catalog/product')->load($selectedOption['product_id']);
             if ($inCartProduct->getImage()) {
                 $inCartProduct->setData('enable_zoom_plugin', 1);
                 $this->setProduct($inCartProduct);
             }
         }
     }
     if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $this->getProduct()->getTypeId()) {
         $usedAttributes = $this->getProduct()->getTypeInstance(true)->getUsedProductAttributes($this->getProduct());
         $productData = array();
         foreach ($usedAttributes as $attribute) {
             if (Mage::getModel('colorswatch/attribute_settings')->getConfig($attribute->getId(), 'allow_attribute_to_change_main_image')) {
                 $optionValue = Mage::app()->getRequest()->getParam($attribute->getAttributeCode(), $inCartProduct ? $inCartProduct->getData($attribute->getAttributeCode()) : -1);
                 //                    if (-1 != $optionValue) {
                 foreach ($this->getProduct()->getTypeInstance(true)->getUsedProducts(null, $this->getProduct()) as $simpleProduct) {
                     if ($simpleProduct->isSaleable() && $simpleProduct->getData($attribute->getAttributeCode()) == $optionValue) {
                         $simpleProduct->load();
                         if (count($simpleProduct->getMediaGalleryImages()) > 0 && $simpleProduct->getImage()) {
                             $simpleProduct->setData('enable_zoom_plugin', 1);
                             $products[] = $simpleProduct;
                             // unset produt without assingend secound attribute
                             foreach ($products as $key => $val) {
                                 if ($val->getData($attribute->getAttributeCode()) != $optionValue) {
                                     unset($products[$key]);
                                 }
                             }
                         }
                     }
                 }
                 //                    }
             }
         }
         if (isset($products) && is_array($products) && count($products) > 0) {
             $this->setProduct($products[0]);
         }
     }
 }
Example #6
0
 public function _prepareLayout()
 {
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         $headBlock->setTitle(Mage::helper('designer')->__('Your Design on Product') . ' - ' . $headBlock->getDefaultTitle());
     }
     //echo '<pre>sasas';print_r($this->getProduct());exit;
     $block = $this->getLayout()->getBlock('product.info.media');
     if ($block) {
         $block->setSubmitRouteData(array('route' => 'designer/product/index', 'params' => array('id' => $this->getRequest()->getParam('id'))));
     }
     // Set custom template with 'Update Cart' button
     $block = $this->getLayout()->getBlock('product.info.media');
     if ($block) {
         $block->setTemplate('a2bizz/catalog/product/view/media.phtml');
     }
     //echo '<pre>';print_r($block->getData());exit;
     return parent::_prepareLayout();
 }
 public function _prepareLayout()
 {
     return parent::_prepareLayout();
 }
Example #8
0
 public function _construct()
 {
     parent::_construct();
     $this->_store_id = Mage::app()->getStore()->getStoreId();
 }
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->helper('mp_slideshow')->appendAssetsToHeadBlock($this->getLayout()->getBlock('head'));
     return $this;
 }
Example #10
0
 protected function _afterToHtml($html)
 {
     $html .= '';
     return parent::_afterToHtml($html);
 }
Example #11
0
 public function __construct()
 {
     parent::__construct();
 }