Example #1
0
 protected function _toHtml()
 {
     $this->setCanShow(true);
     Mage::dispatchEvent('adminhtml_catalog_product_edit_tab_attributes_create_html_before', array('block' => $this));
     if (!$this->getCanShow()) {
         return '';
     }
     $html = parent::_toHtml();
     $html .= Mage::helper('adminhtml/js')->getScript("var {$this->getJsObjectName()} = new Product.Attributes('{$this->getId()}');\n" . "{$this->getJsObjectName()}.setConfig(" . Mage::helper('core')->jsonEncode($this->getConfig()->getData()) . ");\n");
     return $html;
 }
Example #2
0
 /**
  * Apply Additional Attributes to the Button
  *
  * @return string
  */
 protected function _toHtml()
 {
     $cacheKey = $this->getCacheKey();
     if ($html = $this->_commonHelper()->getCache()->getPreparedHtml($cacheKey)) {
         return $html;
     } else {
         $html = parent::_toHtml();
         $injectAttributes = array();
         if ($additionalAttributes = $this->getAdditionalAttributes()) {
             $attributesStr = explode(" ", $additionalAttributes);
             foreach ($attributesStr as $attributeStr) {
                 if ($attributeStr) {
                     try {
                         $key = false;
                         $value = false;
                         list($key, $value) = explode("=", $attributeStr);
                         if ($key && $value) {
                             $value = trim($value, "\"'");
                             $injectAttributes[$key] = $value;
                         }
                     } catch (Exception $e) {
                         $this->_commonHelper()->getException()->logException($e);
                     }
                 }
             }
         }
         foreach ($this->_getAngularKeys() as $key) {
             if ($this->hasData($key)) {
                 $injectAttributes[$key] = $this->getData($key);
             }
         }
         if (count($injectAttributes)) {
             $dom = $this->_commonHelper()->getSimpleDOM()->str_get_dom($html);
             foreach ($dom->find("button") as $button) {
                 foreach ($injectAttributes as $key => $value) {
                     $button->setAttribute($key, $value);
                 }
             }
             $html = $dom->__toString();
         }
         $this->_commonHelper()->getCache()->savePreparedHtml($cacheKey, $html);
         return $html;
     }
 }
Example #3
0
 protected function _toHtml()
 {
     $html = parent::_toHtml();
     $html .= Mage::helper('adminhtml/js')->getScript("var {$this->getJsObjectName()} = new Product.Attributes('{$this->getId()}');\n" . "{$this->getJsObjectName()}.setConfig(" . Zend_Json::encode($this->getConfig()->getData()) . ");\n");
     return $html;
 }