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_GoogleBase_Adminhtml_Googlebase_ItemsController
  • Mage_GoogleBase_Adminhtml_Googlebase_SelectionController
  • Mage_GoogleBase_Adminhtml_Googlebase_TypesController
  • Mage_GoogleBase_Block_Adminhtml_Captcha
  • Mage_GoogleBase_Block_Adminhtml_Items
  • Mage_GoogleBase_Block_Adminhtml_Items_Item
  • Mage_GoogleBase_Block_Adminhtml_Items_Product
  • Mage_GoogleBase_Block_Adminhtml_Store_Switcher
  • Mage_GoogleBase_Block_Adminhtml_Types
  • Mage_GoogleBase_Block_Adminhtml_Types_Edit
  • Mage_GoogleBase_Block_Adminhtml_Types_Edit_Attributes
  • Mage_GoogleBase_Block_Adminhtml_Types_Edit_Form
  • Mage_GoogleBase_Block_Adminhtml_Types_Grid
  • 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_GoogleBase
 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:  * Adminhtml Google Base Types Mapping form block
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_GoogleBase
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: 
 35: class Mage_GoogleBase_Block_Adminhtml_Types_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
 36: {
 37:     public function __construct()
 38:     {
 39:         parent::__construct();
 40:         $this->_blockGroup = 'googlebase';
 41:         $this->_controller = 'adminhtml_types';
 42:         $this->_mode = 'edit';
 43:         $model = Mage::registry('current_item_type');
 44:         $this->_removeButton('reset');
 45:         $this->_updateButton('save', 'label', $this->__('Save Mapping'));
 46:         $this->_updateButton('save', 'id', 'save_button');
 47:         $this->_updateButton('delete', 'label', $this->__('Delete Mapping'));
 48:         if(!$model->getId()) {
 49:             $this->_removeButton('delete');
 50:         }
 51: 
 52:         $this->_formInitScripts[] = '
 53:             var itemType = function() {
 54:                 return {
 55:                     updateAttributes: function() {
 56:                         if ($("select_attribute_set").value != "" && $("select_itemtype").value != "" && itemType.confirmChanges())
 57:                         {
 58:                             var elements = [$("select_attribute_set"),$("select_itemtype"),$("select_target_country")].flatten();
 59:                             $(\'save_button\').disabled = true;
 60:                             new Ajax.Updater("attributes_details", "'.$this->getUrl('*/*/loadAttributes').'",
 61:                                 {
 62:                                     parameters:Form.serializeElements(elements),
 63:                                     evalScripts:true,
 64:                                     onComplete:function(){ $(\'save_button\').disabled = false; }
 65:                                 }
 66:                             );
 67:                         }
 68:                     },
 69: 
 70:                     reloadItemTypes: function() {
 71:                         if ($("select_target_country").value != "" && itemType.confirmChanges())
 72:                         {
 73:                             var elements = [$("select_attribute_set"),$("select_itemtype"),$("select_target_country")].flatten();
 74:                             new Ajax.Updater("gbase_itemtype_select", "'.$this->getUrl('*/*/loadItemTypes').'",
 75:                                 {
 76:                                     parameters:Form.serializeElements(elements),
 77:                                     evalScripts:true,
 78:                                     onComplete:function(){
 79:                                         $(\'save_button\').disabled = false;
 80:                                         Event.observe($("select_itemtype"), \'change\', itemType.updateAttributes);
 81:                                     }
 82:                                 }
 83:                             );
 84: 
 85:                             new Ajax.Updater("attribute_set_select", "'.$this->getUrl('*/*/loadAttributeSets').'",
 86:                                 {
 87:                                     parameters:Form.serializeElements(elements),
 88:                                     evalScripts:true,
 89:                                     onComplete:function(){
 90:                                         $(\'save_button\').disabled = false;
 91:                                         Event.observe($("select_attribute_set"), \'change\', itemType.updateAttributes);
 92:                                     }
 93:                                 }
 94:                             );
 95:                             $("attributes_details").innerHTML = "' . $this->__('Please, select Attribute Set and Google Item Type to load attributes') . '";
 96:                         }
 97:                     },
 98: 
 99:                     confirmChanges: function() {
100:                         var blocksCount = Element.select($("attributes_details"), "div[id^=gbase_attribute_]").length;
101:                         if (blocksCount > 0 && confirm("'.$this->__('Current Mapping will be reloaded. Continue?').'") || blocksCount == 0)
102:                         {
103:                             return true;
104:                         }
105:                         return false;
106:                     }
107:                 }
108:             }();
109: 
110:              Event.observe(window, \'load\', function(){
111:                  if ($("select_attribute_set")) {
112:                      Event.observe($("select_attribute_set"), \'change\', itemType.updateAttributes);
113:                  }
114:                  if ($("select_itemtype")) {
115:                      Event.observe($("select_itemtype"), \'change\', itemType.updateAttributes);
116:                  }
117:                  if ($("select_target_country")) {
118:                      Event.observe($("select_target_country"), \'change\', itemType.reloadItemTypes);
119:                  }
120:            });
121:         ';
122:     }
123: 
124:     public function getHeaderText()
125:     {
126:         if(!is_null(Mage::registry('current_item_type')->getId())) {
127:             return $this->__('Edit Item Type "%s"', $this->htmlEscape(Mage::registry('current_item_type')->getGbaseItemtype()));
128:         } else {
129:             return $this->__('New Item Type');
130:         }
131:     }
132: 
133:     public function getHeaderCssClass() {
134:         return 'icon-head head-customer-groups';
135:     }
136: 
137: }
138: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0