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_Bundle_Adminhtml_Bundle_Product_EditController
  • Mage_Bundle_Adminhtml_Bundle_SelectionController
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Checkbox
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Multi
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Radio
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Select
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Special
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
  • Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer
  • Mage_Bundle_Block_Adminhtml_Sales_Order_View_Items_Renderer
  • Mage_Bundle_Block_Catalog_Product_List_Partof
  • Mage_Bundle_Block_Catalog_Product_Price
  • Mage_Bundle_Block_Catalog_Product_View
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
  • Mage_Bundle_Block_Checkout_Cart_Item_Renderer
  • Mage_Bundle_Block_Sales_Order_Items_Renderer
  • Mage_Bundle_Helper_Catalog_Product_Configuration
  • Mage_Bundle_Helper_Data
  • Mage_Bundle_Model_CatalogIndex_Data_Bundle
  • Mage_Bundle_Model_Mysql4_Bundle
  • Mage_Bundle_Model_Mysql4_Indexer_Price
  • Mage_Bundle_Model_Mysql4_Indexer_Stock
  • Mage_Bundle_Model_Mysql4_Option
  • Mage_Bundle_Model_Mysql4_Option_Collection
  • Mage_Bundle_Model_Mysql4_Price_Index
  • Mage_Bundle_Model_Mysql4_Selection
  • Mage_Bundle_Model_Mysql4_Selection_Collection
  • Mage_Bundle_Model_Observer
  • Mage_Bundle_Model_Option
  • Mage_Bundle_Model_Price_Index
  • Mage_Bundle_Model_Product_Attribute_Source_Price_View
  • Mage_Bundle_Model_Product_Price
  • Mage_Bundle_Model_Product_Type
  • Mage_Bundle_Model_Resource_Bundle
  • Mage_Bundle_Model_Resource_Indexer_Price
  • Mage_Bundle_Model_Resource_Indexer_Stock
  • Mage_Bundle_Model_Resource_Option
  • Mage_Bundle_Model_Resource_Option_Collection
  • Mage_Bundle_Model_Resource_Price_Index
  • Mage_Bundle_Model_Resource_Selection
  • Mage_Bundle_Model_Resource_Selection_Collection
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment
  • Mage_Bundle_Model_Selection
  • Mage_Bundle_Model_Source_Option_Selection_Price_Type
  • Mage_Bundle_Model_Source_Option_Type
  • 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_Bundle
 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:  * Bundle Extended Attribures Block
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Bundle
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend
 35:     extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element
 36: {
 37:     const DYNAMIC = 0;
 38:     const FIXED = 1;
 39: 
 40:     /**
 41:      * Class constructor
 42:      */
 43:     public function __construct()
 44:     {
 45:         parent::__construct();
 46:         $this->setCanEditPrice(true);
 47:         $this->setCanReadPrice(true);
 48:     }
 49: 
 50:     /**
 51:      * Get Element Html
 52:      *
 53:      * @return string
 54:      */
 55:     public function getElementHtml()
 56:     {
 57:         $elementHtml = parent::getElementHtml();
 58: 
 59:         $switchAttributeCode = $this->getAttribute()->getAttributeCode().'_type';
 60:         $switchAttributeValue = $this->getProduct()->getData($switchAttributeCode);
 61: 
 62:         $html = '<select name="product[' . $switchAttributeCode . ']" id="' . $switchAttributeCode
 63:         . '" type="select" class="required-entry select next-toinput"'
 64:         . ($this->getProduct()->getId() && $this->getAttribute()->getAttributeCode() == 'price'
 65:             || $this->getElement()->getReadonly() ? ' disabled="disabled"' : '') . '>
 66:             <option value="">' . $this->__('-- Select --') . '</option>
 67:             <option ' . ($switchAttributeValue == self::DYNAMIC ? 'selected' : '')
 68:             . ' value="' . self::DYNAMIC . '">' . $this->__('Dynamic') . '</option>
 69:             <option ' . ($switchAttributeValue == self::FIXED ? 'selected' : '')
 70:             . ' value="' . self::FIXED . '">' . $this->__('Fixed') . '</option>
 71:         </select>';
 72: 
 73:         if (!($this->getAttribute()->getAttributeCode() == 'price'
 74:             && $this->getCanReadPrice() === false)
 75:         ) {
 76:             $html .= '<span class="next-toselect">' . $elementHtml . '</span>';
 77:         }
 78:         if ($this->getDisableChild() && !$this->getElement()->getReadonly()) {
 79:             $html .= "<script type=\"text/javascript\">
 80:                 function " . $switchAttributeCode . "_change() {
 81:                     if ($('" . $switchAttributeCode . "').value == '" . self::DYNAMIC . "') {
 82:                         if ($('" . $this->getAttribute()->getAttributeCode() . "')) {
 83:                             $('" . $this->getAttribute()->getAttributeCode() . "').disabled = true;
 84:                             $('" . $this->getAttribute()->getAttributeCode() . "').value = '';
 85:                             $('" . $this->getAttribute()->getAttributeCode() . "').removeClassName('required-entry');
 86:                         }
 87: 
 88:                         if ($('dynamic-price-warrning')) {
 89:                             $('dynamic-price-warrning').show();
 90:                         }
 91:                     } else {
 92:                         if ($('" . $this->getAttribute()->getAttributeCode() . "')) {";
 93: 
 94:             if ($this->getAttribute()->getAttributeCode() == 'price'
 95:                 && $this->getCanEditPrice() === false
 96:                 && $this->getCanReadPrice() === true
 97:                 && $this->getProduct()->isObjectNew()
 98:             ) {
 99:                 $defaultProductPrice = ($this->getDefaultProductPrice()) ? $this->getDefaultProductPrice() : "''";
100:                 $html .= "$('" . $this->getAttribute()->getAttributeCode() . "').value = " . $defaultProductPrice . ";";
101:             } else {
102:                 $html .= "$('" . $this->getAttribute()->getAttributeCode() . "').disabled = false;
103:                           $('" . $this->getAttribute()->getAttributeCode() . "').addClassName('required-entry');";
104:             }
105: 
106:             $html .= "}
107: 
108:                         if ($('dynamic-price-warrning')) {
109:                             $('dynamic-price-warrning').hide();
110:                         }
111:                     }
112:                 }";
113: 
114:             if (!($this->getAttribute()->getAttributeCode() == 'price'
115:                 && !$this->getCanEditPrice()
116:                 && !$this->getProduct()->isObjectNew())
117:             ) {
118:                 $html .= "$('" . $switchAttributeCode . "').observe('change', " . $switchAttributeCode . "_change);";
119:             }
120:             $html .= $switchAttributeCode . "_change();
121:             </script>";
122:         }
123:         return $html;
124:     }
125: 
126:     public function getProduct()
127:     {
128:         if (!$this->getData('product')){
129:             $this->setData('product', Mage::registry('product'));
130:         }
131:         return $this->getData('product');
132:     }
133: }
134: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0