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->createBlock('HelpBlock')->setData(['content' => $this->__('The Quantity of chosen Products in each Category is shown in brackets.<br/> If the Product belongs to several Categories, it is shown in each Category. And if you remove the Category with such Product it will be subtracted from each Category.')]); $beforeHtml .= <<<HTML <div style="margin: 15px 0 10px 0">{$help->toHtml()}</div> HTML; $path = 'ebay_listing_product_add/removeSessionProductsByCategory'; $this->jsUrl->add($this->getUrl('*/' . $path), $path); if (!$this->getRequest()->getParam('grid')) { $this->js->add(<<<JS require([ 'M2ePro/Ebay/Listing/Product/Add/Category/Summary/Grid' ],function() { EbayListingProductAddCategorySummaryGridObj = new EbayListingProductAddCategorySummaryGrid( '{$this->getId()}' ); }); JS ); } $this->js->add(<<<JS require([ 'M2ePro/Ebay/Listing/Product/Add/Category/Summary/Grid' ],function() { {$this->getCollection()->getSize()} || closeCategoriesPopup(); EbayListingProductAddCategorySummaryGridObj.afterInitPage(); }); JS ); if ($this->getRequest()->getParam('grid')) { $beforeHtml = NULL; } return $beforeHtml . parent::_toHtml(); }
protected function _toHtml() { if (count($this->getData('categories_data')) === 0) { $msg = $this->__('Magento Categories are not specified for Products you are adding.'); $this->js->add(<<<JS require([ 'M2ePro/Plugin/Messages' ],function(MessageObj) { MessageObj.addErrorMessage('{$msg}'); \$('save_and_go_to_listing_view').addClassName('disabled').onclick = function() { return null; }; }); JS ); } if ($this->getRequest()->isXmlHttpRequest()) { $this->js->add(<<<JS ListingGridHandlerObj.afterInitPage(); JS ); } return parent::_toHtml(); }
protected function _toHtml() { if ($this->getRequest()->isXmlHttpRequest()) { $this->js->add(<<<JS EbayListingProductCategorySettingsModeCategoryGridObj.afterInitPage(); JS ); return parent::_toHtml(); } // --------------------------------------- $this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Ebay\\Listing\\Product\\Category\\Settings', array('_current' => true))); $this->jsUrl->add($this->getUrl('*/ebay_listing_product_category_settings', array('step' => 3, '_current' => true)), 'ebay_listing_product_category_settings'); // --------------------------------------- // --------------------------------------- $this->jsTranslator->add('Done', $this->__('Done')); $this->jsTranslator->add('Set eBay Categories', $this->__('Set eBay Categories')); // --------------------------------------- // --------------------------------------- $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Helper\\Component\\Ebay\\Category')); // --------------------------------------- $disableContinue = ''; if ($this->getCollection()->getSize() === 0) { $disableContinue = <<<JS \$('ebay_listing_category_continue_btn').addClassName('disabled').onclick = function() { return null; }; JS; } $this->js->addOnReadyJs(<<<JS require([ 'M2ePro/Ebay/Listing/Product/Category/Settings/Mode/Category/Grid' ], function(){ {$disableContinue} EbayListingProductCategorySettingsModeCategoryGridObj = new EbayListingProductCategorySettingsModeCategoryGrid('{$this->getId()}'); EbayListingProductCategorySettingsModeCategoryGridObj.afterInitPage(); }); JS ); return parent::_toHtml(); }