Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_ProductAlert_AddController
  • Mage_ProductAlert_Block_Email_Abstract
  • Mage_ProductAlert_Block_Email_Price
  • Mage_ProductAlert_Block_Email_Stock
  • Mage_ProductAlert_Block_Product_View
  • Mage_ProductAlert_Helper_Data
  • Mage_ProductAlert_Model_Email
  • Mage_ProductAlert_Model_Mysql4_Price
  • Mage_ProductAlert_Model_Mysql4_Price_Collection
  • Mage_ProductAlert_Model_Mysql4_Price_Customer_Collection
  • Mage_ProductAlert_Model_Mysql4_Stock
  • Mage_ProductAlert_Model_Mysql4_Stock_Collection
  • Mage_ProductAlert_Model_Mysql4_Stock_Customer_Collection
  • Mage_ProductAlert_Model_Observer
  • Mage_ProductAlert_Model_Price
  • Mage_ProductAlert_Model_Resource_Abstract
  • Mage_ProductAlert_Model_Resource_Price
  • Mage_ProductAlert_Model_Resource_Price_Collection
  • Mage_ProductAlert_Model_Resource_Price_Customer_Collection
  • Mage_ProductAlert_Model_Resource_Stock
  • Mage_ProductAlert_Model_Resource_Stock_Collection
  • Mage_ProductAlert_Model_Resource_Stock_Customer_Collection
  • Mage_ProductAlert_Model_Stock
  • Mage_ProductAlert_UnsubscribeController
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_ProductAlert
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Product view price and stock alerts
 29:  */
 30: class Mage_ProductAlert_Block_Product_View extends Mage_Core_Block_Template
 31: {
 32:     /**
 33:      * Current product instance
 34:      *
 35:      * @var null|Mage_Catalog_Model_Product
 36:      */
 37:     protected $_product = null;
 38: 
 39:     /**
 40:      * Helper instance
 41:      *
 42:      * @var null|Mage_ProductAlert_Helper_Data
 43:      */
 44:     protected $_helper = null;
 45: 
 46:     /**
 47:      * Check whether the stock alert data can be shown and prepare related data
 48:      *
 49:      * @return void
 50:      */
 51:     public function prepareStockAlertData()
 52:     {
 53:         if (!$this->_getHelper()->isStockAlertAllowed() || !$this->_product || $this->_product->isAvailable()) {
 54:             $this->setTemplate('');
 55:             return;
 56:         }
 57:         $this->setSignupUrl($this->_getHelper()->getSaveUrl('stock'));
 58:     }
 59: 
 60:     /**
 61:      * Check whether the price alert data can be shown and prepare related data
 62:      *
 63:      * @return void
 64:      */
 65:     public function preparePriceAlertData()
 66:     {
 67:         if (!$this->_getHelper()->isPriceAlertAllowed()
 68:             || !$this->_product || false === $this->_product->getCanShowPrice()
 69:         ) {
 70:             $this->setTemplate('');
 71:             return;
 72:         }
 73:         $this->setSignupUrl($this->_getHelper()->getSaveUrl('price'));
 74:     }
 75: 
 76:     /**
 77:      * Get current product instance
 78:      *
 79:      * @return Mage_ProductAlert_Block_Product_View
 80:      */
 81:     protected function _prepareLayout()
 82:     {
 83:         $product = Mage::registry('current_product');
 84:         if ($product && $product->getId()) {
 85:             $this->_product = $product;
 86:         }
 87: 
 88:         return parent::_prepareLayout();
 89:     }
 90: 
 91:     /**
 92:      * Retrieve helper instance
 93:      *
 94:      * @return Mage_ProductAlert_Helper_Data|null
 95:      */
 96:     protected function _getHelper()
 97:     {
 98:         if (is_null($this->_helper)) {
 99:             $this->_helper = Mage::helper('productalert');
100:         }
101:         return $this->_helper;
102:     }
103: }
104: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0