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: /**
 29:  * ProductAlert data helper
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_ProductAlert
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_ProductAlert_Helper_Data extends Mage_Core_Helper_Url
 36: {
 37:     /**
 38:      * Current product instance (override registry one)
 39:      *
 40:      * @var null|Mage_Catalog_Model_Product
 41:      */
 42:     protected $_product = null;
 43: 
 44:     /**
 45:      * Get current product instance
 46:      *
 47:      * @return Mage_Catalog_Model_Product
 48:      */
 49:     public function getProduct()
 50:     {
 51:         if (!is_null($this->_product)) {
 52:             return $this->_product;
 53:         }
 54:         return Mage::registry('product');
 55:     }
 56: 
 57:     /**
 58:      * Set current product instance
 59:      *
 60:      * @param Mage_Catalog_Model_Product $product
 61:      * @return Mage_ProductAlert_Helper_Data
 62:      */
 63:     public function setProduct($product)
 64:     {
 65:         $this->_product = $product;
 66:         return $this;
 67:     }
 68: 
 69:     public function getCustomer()
 70:     {
 71:         return Mage::getSingleton('customer/session');
 72:     }
 73: 
 74:     public function getStore()
 75:     {
 76:         return Mage::app()->getStore();
 77:     }
 78: 
 79:     public function getSaveUrl($type)
 80:     {
 81:         return $this->_getUrl('productalert/add/' . $type, array(
 82:             'product_id'    => $this->getProduct()->getId(),
 83:             Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl()
 84:         ));
 85:     }
 86: 
 87:     public function createBlock($block)
 88:     {
 89:         $error = Mage::helper('core')->__('Invalid block type: %s', $block);
 90:         if (is_string($block)) {
 91:             if (strpos($block, '/') !== false) {
 92:                 if (!$block = Mage::getConfig()->getBlockClassName($block)) {
 93:                     Mage::throwException($error);
 94:                 }
 95:             }
 96:             $fileName = mageFindClassFile($block);
 97:             if ($fileName!==false) {
 98:                 include_once ($fileName);
 99:                 $block = new $block(array());
100:             }
101:         }
102:         if (!$block instanceof Mage_Core_Block_Abstract) {
103:             Mage::throwException($error);
104:         }
105:         return $block;
106:     }
107: 
108:     /**
109:      * Check whether stock alert is allowed
110:      *
111:      * @return bool
112:      */
113:     public function isStockAlertAllowed()
114:     {
115:         return Mage::getStoreConfigFlag(Mage_ProductAlert_Model_Observer::XML_PATH_STOCK_ALLOW);
116:     }
117: 
118:     /**
119:      * Check whether price alert is allowed
120:      *
121:      * @return bool
122:      */
123:     public function isPriceAlertAllowed()
124:     {
125:         return Mage::getStoreConfigFlag(Mage_ProductAlert_Model_Observer::XML_PATH_PRICE_ALLOW);
126:     }
127: }
128: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0