protected function _toHtml() { //------------------------------ $urls = Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing_categorySettings', array('_current' => true)); $path = 'adminhtml_ebay_listing_categorySettings'; $urls[$path] = $this->getUrl('*/' . $path, array('step' => 3, '_current' => true)); $urls = json_encode($urls); //------------------------------ //------------------------------ $translations = array(); // ->__('Done') $text = 'Done'; $translations[$text] = Mage::helper('M2ePro')->__($text); // ->__('Cancel') $text = 'Cancel'; $translations[$text] = Mage::helper('M2ePro')->__($text); // ->__('Set eBay Categories') $text = 'Set eBay Categories'; $translations[$text] = Mage::helper('M2ePro')->__($text); $translations = json_encode($translations); //------------------------------ //------------------------------ $constants = Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Category'); //------------------------------ $commonJs = <<<HTML <script type="text/javascript"> EbayListingCategoryCategoryGridHandlerObj.afterInitPage(); </script> HTML; $additionalJs = ''; if (!$this->getRequest()->isXmlHttpRequest()) { $additionalJs = <<<HTML <script type="text/javascript"> M2ePro.url.add({$urls}); M2ePro.translator.add({$translations}); M2ePro.php.setConstants({$constants},'Ess_M2ePro_Helper_Component_Ebay_Category'); EbayListingCategoryCategoryGridHandlerObj = new EbayListingCategoryCategoryGridHandler('{$this->getId()}'); </script> HTML; } return parent::_toHtml() . $additionalJs . $commonJs; }
protected function _toHtml() { // --------------------------------------- $urls = Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing_categorySettings', array('_current' => true)); $path = 'adminhtml_ebay_listing_categorySettings'; $urls[$path] = $this->getUrl('*/' . $path, array('step' => 3, '_current' => true)); $urls = json_encode($urls); // --------------------------------------- // --------------------------------------- $translations = array(); // M2ePro_TRANSLATIONS // Done $text = 'Done'; $translations[$text] = Mage::helper('M2ePro')->__($text); // M2ePro_TRANSLATIONS // Cancel $text = 'Cancel'; $translations[$text] = Mage::helper('M2ePro')->__($text); // M2ePro_TRANSLATIONS // Set eBay Categories $text = 'Set eBay Categories'; $translations[$text] = Mage::helper('M2ePro')->__($text); $translations = json_encode($translations); // --------------------------------------- // --------------------------------------- $constants = Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Category'); // --------------------------------------- $commonJs = <<<HTML <script type="text/javascript"> EbayListingCategoryCategoryGridHandlerObj.afterInitPage(); </script> HTML; $disableContinue = ''; if ($this->getCollection()->getSize() === 0) { $disableContinue = <<<JS \$('ebay_listing_category_continue_btn').addClassName('disabled').onclick = function() { return null; }; JS; } $additionalJs = ''; if (!$this->getRequest()->isXmlHttpRequest()) { $additionalJs = <<<HTML <script type="text/javascript"> {$disableContinue} M2ePro.url.add({$urls}); M2ePro.translator.add({$translations}); M2ePro.php.setConstants({$constants},'Ess_M2ePro_Helper_Component_Ebay_Category'); EbayListingCategoryCategoryGridHandlerObj = new EbayListingCategoryCategoryGridHandler('{$this->getId()}'); </script> HTML; } return parent::_toHtml() . $additionalJs . $commonJs; }
protected function _toHtml() { $beforeHtml = <<<HTML <style> div#{$this->getId()} div.grid { overflow-y: auto !important; height: 263px !important; } div#{$this->getId()} div.grid th { padding: 2px 4px !important; } div#{$this->getId()} div.grid td { padding: 2px 4px !important; } div#{$this->getId()} table.massaction div.right { display: block; } div#{$this->getId()} table.massaction td { padding: 1px 8px; } </style> HTML; $help = $this->getLayout()->createBlock('M2ePro/adminhtml_ebay_listing_product_sourceCategories_summary_help'); $beforeHtml .= <<<HTML <div style="margin: 15px 0 10px 0">{$help->toHtml()}</div> HTML; $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('M2ePro')->__('Close'), 'onclick' => 'Windows.getFocusedWindow().close()')); $afterHtml = <<<HTML <div class="clear"></div> <div class="right" style="margin-top: 15px"> {$button->toHtml()} </div> <div class="clear" style="padding: 10px 0"></div> HTML; $urls = array(); $path = 'adminhtml_ebay_listing_productAdd/removeSessionProductsByCategory'; $urls[$path] = $this->getUrl('*/' . $path); $urls = json_encode($urls); $js = ''; if (!$this->getRequest()->getParam('grid')) { $js .= <<<HTML <script type="text/javascript"> M2ePro.url.add({$urls}); EbayListingProductSourceCategoriesSummaryGridHandlerObj = new EbayListingProductSourceCategoriesSummaryGridHandler( '{$this->getId()}' ); </script> HTML; } $js .= <<<HTML <script type="text/javascript"> {$this->getCollection()->getSize()} || Windows.getFocusedWindow().close(); EbayListingProductSourceCategoriesSummaryGridHandlerObj.afterInitPage(); </script> HTML; if ($this->getRequest()->getParam('grid')) { $beforeHtml = $afterHtml = NULL; } return $beforeHtml . parent::_toHtml() . $afterHtml . $js; }
protected function _toHtml() { $addErrorJs = ''; if (count($this->getData('categories_data')) === 0) { $msg = Mage::helper('M2ePro')->__('Magento Categories are not specified for Products you are adding.'); $addErrorJs = <<<JS MagentoMessageObj['addError']('{$msg}'); \$('save_and_go_to_listing_view').addClassName('disabled').onclick = function() { return null; }; JS; } $javascriptsMain = <<<HTML <script type="text/javascript"> if (typeof ListingGridHandlerObj != 'undefined') { ListingGridHandlerObj.afterInitPage(); } {$addErrorJs} Event.observe(window, 'load', function() { setTimeout(function() { ListingGridHandlerObj.afterInitPage(); }, 350); }); </script> HTML; return parent::_toHtml() . $javascriptsMain; }