protected function _toHtml() { if ($this->getRequest()->isXmlHttpRequest()) { return parent::_toHtml(); } $urls = json_encode(array_merge(Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing'), Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing_productAdd'), Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_log'), Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_template'), array('adminhtml_common_listing/saveTitle' => Mage::helper('adminhtml')->getUrl('M2ePro/adminhtml_common_listing/saveTitle')))); $translations = json_encode(array('Cancel' => Mage::helper('M2ePro')->__('Cancel'), 'Save' => Mage::helper('M2ePro')->__('Save'), 'Edit Listing Title' => Mage::helper('M2ePro')->__('Edit Listing Title'))); $uniqueTitleTxt = Mage::helper('M2ePro')->escapeJs(Mage::helper('M2ePro')->__('The specified Title is already used for other Listing. Listing Title must be unique.')); $constants = Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay'); $javascriptsMain = <<<HTML <script type="text/javascript"> Event.observe(window, 'load', function() { M2ePro.url.add({$urls}); M2ePro.translator.add({$translations}); M2ePro.text.title_not_unique_error = '{$uniqueTitleTxt}'; M2ePro.php.setConstants( {$constants}, 'Ess_M2ePro_Helper_Component' ); EbayListingGridHandlerObj = new EbayListingGridHandler('{$this->getId()}'); EditListingTitleObj = new ListingEditListingTitle('{$this->getId()}'); }); </script> HTML; return parent::_toHtml() . $javascriptsMain; }