public function getInitUrl()
 {
     $product = Mage::registry('current_product');
     if ($product) {
         $block = new Mage_Catalog_Block_Product_View();
         $addToCartUrl = $block->getSubmitUrl($product);
         $params = Mage::helper('occ')->getUrlParams($addToCartUrl);
     } else {
         $params = array();
     }
     return $this->getUrl('occ/index/init', $params);
 }
 protected function _toHtml()
 {
     if (!(!$this->helper('customerprices')->isEnabled() || (!$this->helper('customerprices')->isHidePrice() || $this->helper('customer')->isLoggedIn())) && strpos($this->getTemplate(), '/addto') > 0) {
         return '';
     }
     return parent::_toHtml();
 }
 public function _construct()
 {
     parent::_construct();
     $this->_attrShowImage = Mage::helper('configurableoptionthumbnail')->getAttributeShowImage();
     $this->_productAttr = $this->getArrAtributeCode();
     $this->atributeFillter();
 }
Exemple #4
0
 /**
  * Constructor
  */
 public function _construct()
 {
     parent::_construct();
     if (!$this->getTemplate()) {
         $this->setTemplate('payperrentals/catalog/product/view.phtml');
     }
 }
Exemple #5
0
 /**
  * Get JSON encripted configuration array which can be used for JS dynamic
  * price calculation depending on product options
  *
  * @return string
  */
 public function getJsonConfig()
 {
     if (!Mage::helper('rewards')->isBaseMageVersionAtLeast('1.4')) {
         return parent::getJsonConfig();
     }
     $config = array();
     $_request = Mage::getSingleton('tax/calculation')->getRateRequest(false, false, false);
     $_request->setProductClassId($this->getProduct()->getTaxClassId());
     $defaultTax = Mage::getSingleton('tax/calculation')->getRate($_request);
     $_request = Mage::getSingleton('tax/calculation')->getRateRequest();
     $_request->setProductClassId($this->getProduct()->getTaxClassId());
     $currentTax = Mage::getSingleton('tax/calculation')->getRate($_request);
     $_regularPrice = $this->getProduct()->getPrice();
     $_finalPrice = $this->getProduct()->getFinalPrice();
     $_priceInclTax = Mage::helper('tax')->getPrice($this->getProduct(), $_finalPrice, true);
     $_priceExclTax = Mage::helper('tax')->getPrice($this->getProduct(), $_finalPrice);
     $config = array('productId' => $this->getProduct()->getId(), 'priceFormat' => Mage::app()->getLocale()->getJsPriceFormat(), 'includeTax' => Mage::helper('tax')->priceIncludesTax() ? 'true' : 'false', 'showIncludeTax' => Mage::helper('tax')->displayPriceIncludingTax(), 'showBothPrices' => Mage::helper('tax')->displayBothPrices(), 'productPrice' => Mage::helper('core')->currency($_finalPrice, false, false), 'productOldPrice' => Mage::helper('core')->currency($_regularPrice, false, false), 'skipCalculate' => $_priceExclTax != $_priceInclTax ? 0 : 1, 'defaultTax' => $defaultTax, 'currentTax' => $currentTax, 'idSuffix' => '_clone', 'oldPlusDisposition' => 0, 'plusDisposition' => 0, 'oldMinusDisposition' => 0, 'minusDisposition' => 0);
     $responseObject = new Varien_Object();
     Mage::dispatchEvent('catalog_product_view_config', array('response_object' => $responseObject));
     if (is_array($responseObject->getAdditionalOptions())) {
         foreach ($responseObject->getAdditionalOptions() as $option => $value) {
             $config[$option] = $value;
         }
     }
     return Mage::helper('core')->jsonEncode($config);
 }
 protected function _toHtml()
 {
     if (!$this->helper('customerprices')->isShowListBlock($this->getProduct()) && strpos($this->getTemplate(), '/addto') > 0) {
         return '';
     }
     return parent::_toHtml();
 }
Exemple #7
0
 /**
  * ugly fix for Magento 1.9 form keys
  */
 public function _afterToHtml($html)
 {
     $formkey = Mage::getSingleton('core/session')->getFormKey();
     $formkey = "/form_key/" . $formkey . "/";
     $html = preg_replace("/\\/form_key\\/[a-zA-Z0-9,.-]+\\//", $formkey, $html);
     return parent::_afterToHtml($html);
 }
Exemple #8
0
 protected function _prepareLayout()
 {
     $product = $this->getProduct();
     if (!$product) {
         return parent::_prepareLayout();
     }
     if (!Mage::getStoreConfig('ammeta/product/enabled')) {
         return parent::_prepareLayout();
     }
     $hlp = Mage::helper('ammeta');
     //templates configuration for products in categories
     $config = $hlp->getConfigByProduct($product);
     // product attribute => template name
     $pairs = array('meta_title' => 'title', 'meta_description' => 'description', 'meta_keyword' => 'keywords', 'short_description' => 'short_description', 'description' => 'full_description');
     foreach ($pairs as $attrCode => $patternName) {
         if ($product->getData($attrCode)) {
             continue;
         }
         $pattern = Mage::getStoreConfig('ammeta/product/' . $patternName);
         foreach ($config as $item) {
             if ($item->getData($patternName)) {
                 // get first not empty pattern
                 $pattern = $item->getData($patternName);
                 break;
             }
         }
         if ($pattern) {
             $product->setData($attrCode, $hlp->parse($product, $pattern));
         }
     }
     return parent::_prepareLayout();
 }
Exemple #9
0
 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $_layoutData = parent::_prepareLayout();
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $headBlock->addLinkRel('image_src', $product->getImageUrl());
         $baseUrl = Mage::getBaseUrl();
         if (!strpos($this->helper('core/url')->getCurrentUrl(), "?")) {
             $currentUrl = $this->helper('core/url')->getCurrentUrl();
         } else {
             $currentUrl = substr($this->helper('core/url')->getCurrentUrl(), 0, strpos($this->helper('core/url')->getCurrentUrl(), "?"));
         }
         if ($currentUrl === $baseUrl) {
             $_defaultTitle = htmlspecialchars(html_entity_decode(trim(Mage::getStoreConfig('design/head/default_title')), ENT_QUOTES, 'UTF-8'));
             $headBlock->setTitle($_defaultTitle);
             $headBlock->setDescription(Mage::getStoreConfig('design/head/default_description'));
             $headBlock->setKeywords(Mage::getStoreConfig('design/head/default_keywords'));
             $params = array('_ignore_category' => true);
             $headBlock->removeItem('link_rel', $product->getUrlModel()->getUrl($product, $params));
             $headBlock->addLinkRel('canonical', $baseUrl);
         }
     }
     //        return parent::_prepareLayout();
     return $_layoutData;
 }
 public function getCacheTags()
 {
     if (!$this->_isCacheActive()) {
         return parent::getCacheTags();
     }
     return array(Mage_Catalog_Model_Product::CACHE_TAG, Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getProduct()->getId());
 }
Exemple #11
0
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $html = parent::_toHtml();
     if ($this->_helper()->getConfigValue('general', 'enabled')) {
         $html = $this->_insertRichSnippets($html);
     }
     return $html;
 }
 protected function _toHtml()
 {
     $localHtmlContent = "Yay! Overridden by " . get_class($this);
     $parentHtml = parent::_toHtml();
     // It's the Fukken Magick I don't understand a bit
     // makes multiple calls to the method, and thus I compare against alias
     $htmlContent = 'product.info' == $this->_alias ? $localHtmlContent . $parentHtml : $parentHtml;
     return $htmlContent;
 }
Exemple #13
0
 public function getProduct()
 {
     if (!is_null($this->_product)) {
         return $this->_product;
     } elseif (!is_null($this->getData("product"))) {
         return $this->getData("product");
     }
     return parent::getProduct();
 }
Exemple #14
0
 /**
  * Returns product price block html
  *
  * @param Mage_Catalog_Model_Product $product
  * @param boolean $displayMinimalPrice
  */
 public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
 {
     $html = parent::getPriceHtml($product, $displayMinimalPrice, $idSuffix);
     $container = new Varien_Object();
     $container->setHtml($html);
     Mage::dispatchEvent('block_catalog_product_get_price_html', array('block' => $this, 'container' => $container));
     $html = $container->getHtml();
     return $html;
 }
 public function getMinimalQty($product)
 {
     $minimalQty = parent::getMinimalQty($product);
     if (!$minimalQty) {
         return $minimalQty;
     }
     $stockItem = $product->getStockItem();
     return $stockItem->getIsQtyDecimal() ? $minimalQty : ceil($minimalQty);
 }
 protected function _tohtml()
 {
     if ($this->getFromXml() == 'yes' && !Mage::helper('prodfaqs')->isProductFaqsEnable()) {
         return parent::_toHtml();
     }
     $this->setLinksforProduct();
     $this->setTemplate("prodfaqs/ask.phtml");
     return parent::_toHtml();
 }
 public function getSubmitUrl($product, $additional = array(), $ajax = true)
 {
     if (!$ajax) {
         return parent::getSubmitUrl($product, $additional);
     }
     if (!$this->hasCustomAddToCartUrl()) {
         $this->setCustomAddToCartUrl($this->helper('weltpixel_quickview/cart')->getAddUrlForPrduct($product, $additional));
     }
     return parent::getSubmitUrl($product, $additional);
 }
 public function _prepareLayout()
 {
     $product = Mage::registry('current_product');
     $product_type = $product->getTypeId();
     if ($product_type == "grouped") {
         $this->setTemplate('callforprice/callforprice_grouped.phtml');
     } else {
         $this->setTemplate('callforprice/callforprice_simple.phtml');
     }
     return parent::_prepareLayout();
 }
Exemple #19
0
 /**
  * Prepare layout
  *
  * @return Enterprise_GiftRegistry_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $block = $this->getLayout()->getBlock('customize.button');
     if ($block && $this->_isGiftRegistryRedirect()) {
         $block->setTemplate('giftregistry/product/customize.phtml');
     }
     $block = $this->getLayout()->getBlock('product.info.addtocart');
     if ($block && $this->_isGiftRegistryRedirect()) {
         $block->setTemplate('giftregistry/product/addtocart.phtml');
         $block->setAddToGiftregistryUrl($this->getAddToGiftregistryUrl());
     }
     return parent::_prepareLayout();
 }
Exemple #20
0
 /**
  * initialize options block
  * 
  * (non-PHPdoc)
  * @see Mage_Core_Block_Abstract::_beforeToHtml()
  */
 protected function _beforeToHtml()
 {
     if (!$this->getItem()) {
         return parent::_beforeToHtml();
     }
     $wrapperBlock = $this->getLayout()->createBlock('catalog/product_view', 'additional.product.info.customoptions.wrapper', array('template' => 'catalog/product/view/options/wrapper.phtml', 'product_id' => $this->getItem()->getProductId()));
     $this->append($wrapperBlock, 'wrapper');
     /* @var $optionsBlock SSE_EditCustomOptions_Block_Options */
     $optionsBlock = $this->getLayout()->createBlock(SSE_EditCustomOptions_Block_Options::ALIAS, 'additional.product.info.customoptions.options');
     $optionsBlock->init($this->getItem());
     $wrapperBlock->append($optionsBlock, 'options');
     return parent::_beforeToHtml();
 }
Exemple #21
0
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription($product->getDescription());
         }
         $robots = $product->getMetaRobots();
         if ($robots) {
             $headBlock->setRobots($robots);
         } else {
             $headBlock->setRobots($product->getMetaRobots());
         }
         if ($this->helper('catalog/product')->canUseCanonicalTag()) {
             $params = array('_ignore_category' => true);
             $headBlock->addLinkRel('canonical', $product->getUrlModel()->getUrl($product, $params));
         }
     }
     return parent::_prepareLayout();
 }
Exemple #22
0
 /**
  * Product view block, don't cache if rendered with cart item update
  *
  * @param Mage_Catalog_Block_Product_View $block
  */
 public function applyProductView(Mage_Catalog_Block_Product_View $block)
 {
     // The "messages" block is session-dependent, don't cache
     if (Mage::helper('cache')->responseHasMessages()) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Cart stuff is session-dependent
     $request = $block->getRequest();
     if ($request->getModuleName() == 'checkout' && $request->getControllerName() == 'cart' && $request->getActionName() == 'configure' && $request->getParam('id')) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Set cache tags
     $tags = array(Mage_Catalog_Model_Product::CACHE_TAG . '_' . $block->getProduct()->getId());
     $block->setData('cache_tags', $tags);
     // Set cache keys
     $keys = $this->_getBasicKeys($block);
     $_taxCalculator = Mage::getModel('tax/calculation');
     $_customer = Mage::getSingleton('customer/session')->getCustomer();
     $_product = $block->getProduct();
     $keys = array_merge($keys, array($_product->getId(), $_customer->getGroupId(), $_taxCalculator->getRate($_taxCalculator->getRateRequest()->setProductClassId($_product->getTaxClassId()))));
     $block->setData('cache_key', $this->_getCacheKey($keys, $block));
 }
 /** @return Mage_Catalog_Model_Product */
 function getProduct()
 {
     $product = parent::getProduct();
     $this->applyName($product);
     return $product;
 }
Exemple #24
0
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $this->getProduct()->setShortDescription(null);
     return parent::_toHtml();
 }
Exemple #25
0
 /**
  * Retrieve block cache tags
  *
  * @return array
  */
 public function getCacheTags()
 {
     return array_merge(parent::getCacheTags(), array('POPUP_BLOCK'));
 }
Exemple #26
0
 protected function _toHtml()
 {
     if ($this->isAvailable()) {
         return parent::_toHtml();
     }
 }
Exemple #27
0
 /**
  * return an array of the earn rules using the current session (date,wid,gid,pid)
  * This should be changed to return all rules for the product ignoring just the group id
  *
  * @return array() 
  */
 public function getEarnRules()
 {
     $product = Mage::getModel('rewards/catalog_product')->load(parent::getProduct()->getId());
     return $product->getDistriRules();
 }
 public function __construct()
 {
     parent::__construct();
     $this->setTemplate('adodis/ajaxcart/product/configurable/form.phtml');
 }
Exemple #29
0
 /**
  * Internal constructor
  *
  */
 protected function _construct()
 {
     parent::_construct();
     $this->addData(array('cache_lifetime' => 3600, 'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getProduct()->getId()), 'cache_key' => self::CACHE_TAG . '_' . Mage::app()->getStore()->getCode() . '_' . $this->getProduct()->getId()));
 }
Exemple #30
0
 /**
  * Retrieve url for direct adding product to cart
  *
  * @param Mage_Catalog_Model_Product $product
  * @param array $additional
  * @return string
  */
 public function getAddToCartUrl($product, $additional = array())
 {
     $url = parent::getAddToCartUrl($product, $additional);
     $url = str_replace('/checkout/', '/awmobile/', $url);
     return $url;
 }