Exemple #1
0
 protected function _prepareMassaction()
 {
     // Set massaction identifiers
     // ---------------------------------------
     $this->setMassactionIdField('main_table.id');
     $this->getMassactionBlock()->setFormFieldName('ids');
     // ---------------------------------------
     // Set clear log action
     // ---------------------------------------
     $backUrl = Mage::helper('M2ePro')->makeBackUrlParam('*/adminhtml_common_listing/index', array('tab' => Ess_M2ePro_Block_Adminhtml_Common_ManageListings::TAB_ID_LISTING, 'channel' => Ess_M2ePro_Block_Adminhtml_Common_Component_Abstract::TAB_ID_BUY));
     $this->getMassactionBlock()->addItem('clear_logs', array('label' => Mage::helper('M2ePro')->__('Clear Log(s)'), 'url' => $this->getUrl('*/adminhtml_listing/clearLog', array('back' => $backUrl)), 'confirm' => Mage::helper('M2ePro')->__('Are you sure?')));
     // ---------------------------------------
     // Set remove listings action
     // ---------------------------------------
     $this->getMassactionBlock()->addItem('delete_listings', array('label' => Mage::helper('M2ePro')->__('Delete Listing(s)'), 'url' => $this->getUrl('*/adminhtml_common_buy_listing/delete', array('back' => $backUrl)), 'confirm' => Mage::helper('M2ePro')->__('Are you sure?')));
     // ---------------------------------------
     return parent::_prepareMassaction();
 }
    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;
    }