コード例 #1
0
ファイル: Grid.php プロジェクト: technomagegithub/magento
    protected function _toHtml()
    {
        //------------------------------
        $urls = Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing', array('_current' => true));
        $path = 'adminhtml_ebay_listing/getCategoryChooserHtml';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/getCategorySpecificHtml';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/saveCategoryTemplate';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $urls = json_encode($urls);
        //------------------------------
        //------------------------------
        $translations = json_encode(array('eBay Categories' => $this->__('eBay Categories'), 'Specifics' => $this->__('Specifics'), 'Compatibility Attribute ePIDs' => $this->__('Compatibility Attribute ePIDs')));
        //------------------------------
        //------------------------------
        $constants = Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Category');
        //------------------------------
        $html = <<<HTML
<script type="text/javascript">

    M2ePro.url.add({$urls});
    M2ePro.translator.add({$translations});
    M2ePro.php.setConstants({$constants},'Ess_M2ePro_Helper_Component_Ebay_Category');

</script>
HTML;
        //------------------------------
        if ($this->getRequest()->getParam('auto_actions')) {
            $html .= <<<HTML
<script type="text/javascript">
    Event.observe(window, 'load', function() {
        EbayListingAutoActionHandlerObj.loadAutoActionHtml();
    });
</script>
HTML;
        }
        //------------------------------
        //------------------------------
        if ($this->isMotorsSpecificsAvailable()) {
            $motorsSpecificsBlock = $this->getLayout()->createBlock('M2ePro/adminhtml_ebay_motor_specific_generateAttributeValue', '', array('products_grid_id' => $this->getId()));
            $html .= $motorsSpecificsBlock->toHtml();
        }
        //------------------------------
        return parent::_toHtml() . $html;
    }
コード例 #2
0
    protected function _toHtml()
    {
        if ($this->getRequest()->isXmlHttpRequest()) {
            return parent::_toHtml();
        }
        //------------------------------
        $urls = Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_listing_autoAction', array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing_categorySettings';
        $urls[$path] = $this->getUrl('*/' . $path, array('step' => 1, '_current' => true));
        $path = 'adminhtml_ebay_listing_productAdd/delete';
        $urls[$path] = $this->getUrl('*/' . $path, array('_current' => true));
        $path = 'adminhtml_ebay_listing_productAdd/validate';
        $urls[$path] = $this->getUrl('*/' . $path, array('_current' => true));
        $urls = json_encode($urls);
        //------------------------------
        $helper = Mage::helper('M2ePro');
        //------------------------------
        $translations = json_encode(array('Automatic Actions' => $helper->__('Automatic Actions'), 'Based on Magento Categories' => $helper->__('Based on Magento Categories'), 'You must select at least 1 category.' => $helper->__('You must select at least 1 category.'), 'Rule with the same title already exists.' => $helper->__('Rule with the same title already exists.')));
        //------------------------------
        $js = <<<HTML
<script type="text/javascript">
    M2ePro.url.add({$urls});
    M2ePro.translator.add({$translations});

    EbayListingAutoActionHandlerObj = new EbayListingAutoActionHandler();
</script>
HTML;
        return parent::_toHtml() . $js;
    }
コード例 #3
0
ファイル: Grid.php プロジェクト: ReeceCrossland/essua-m2epro
    protected function _toHtml()
    {
        /** @var $helper Ess_M2ePro_Helper_Data */
        $helper = Mage::helper('M2ePro');
        // ---------------------------------------
        $urls = $helper->getControllerActions('adminhtml_ebay_listing', array('_current' => true));
        $path = 'adminhtml_ebay_listing/getCategoryChooserHtml';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/getCategorySpecificHtml';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/saveCategoryTemplate';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/runTransferring';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_log/listing';
        $urls[$path] = $this->getUrl('*/adminhtml_ebay_log/listing', array('id' => $this->getListing()->getId()));
        $path = 'adminhtml_ebay_listing/getEstimatedFees';
        $urls[$path] = $this->getUrl('*/' . $path, array('listing_id' => $this->getListing()->getId()));
        $urls['adminhtml_ebay_listing/getTransferringUrl'] = $this->getUrl('*/adminhtml_ebay_listing/view');
        $urls = array_merge($urls, $helper->getControllerActions('adminhtml_ebay_motor'));
        $urls = json_encode($urls);
        // ---------------------------------------
        if ($this->getMotorsType() == Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID) {
            $motorsTypeTitle = 'ePID';
        } else {
            $motorsTypeTitle = 'kType';
        }
        //------------------------------
        $translations = json_encode(array('eBay Categories' => $helper->__('eBay Categories'), 'of Product' => Mage::helper('M2ePro')->__('of Product'), 'Specifics' => $helper->__('Specifics'), 'Compatibility Attribute ePIDs' => $helper->__('Compatibility Attribute ePIDs'), 'Payment for Translation Service' => $helper->__('Payment for Translation Service'), 'Payment for Translation Service. Help' => $helper->__('Payment for Translation Service'), 'Specify a sum to be credited to an Account.' => $helper->__('Specify a sum to be credited to an Account.' . ' If you are planning to order more Items for Translation in future,' . ' you can credit the sum greater than the one needed for current Translation.' . ' Click <a href="%url%" target="_blank">here</a> to find out more.', Mage::helper('M2ePro/Module_Support')->getDocumentationUrl(NULL, NULL, 'x/BQAJAQ#SellonanothereBaySite-Account')), 'Amount to Pay.' => $helper->__('Amount to Pay'), 'Insert amount to be credited to an Account' => $helper->__('Insert amount to be credited to an Account.'), 'Confirm' => $helper->__('Confirm'), 'Add Compatible Vehicles' => $helper->__('Add Compatible Vehicles'), 'Save Filter' => $helper->__('Save Filter'), 'Save as Group' => $helper->__('Save as Group'), 'Set Note' => $helper->__('Set Note'), 'View Items' => $helper->__('Selected %items_title%s', $motorsTypeTitle), 'View Filters' => $helper->__('Selected Filters'), 'View Groups' => $helper->__('Selected Groups'), 'Selected Items' => $helper->__('Selected %items_title%s', $motorsTypeTitle), 'Selected Filters' => $helper->__('Selected Filters'), 'Selected Groups' => $helper->__('Selected Groups'), 'Motor Item' => $motorsTypeTitle, 'Note' => $helper->__('Note'), 'Filter' => $helper->__('Filter'), 'Group' => $helper->__('Group'), 'kType' => $helper->__('kType'), 'ePID' => $helper->__('ePID'), 'Type' => $helper->__('Type'), 'Year From' => $helper->__('Year From'), 'Year To' => $helper->__('Year To'), 'Body Style' => $helper->__('Body Style')));
        // ---------------------------------------
        // ---------------------------------------
        $constants = $helper->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Category');
        // ---------------------------------------
        $component = Ess_M2ePro_Helper_Component_Ebay::NICK;
        $temp = Mage::helper('M2ePro/Data_Session')->getValue('products_ids_for_list', true);
        $productsIdsForList = empty($temp) ? '' : $temp;
        $gridId = $component . 'ListingViewGrid' . $this->getListing()->getId();
        $ignoreListings = json_encode(array($this->getListing()->getId()));
        $logViewUrl = $this->getUrl('*/adminhtml_ebay_log/listing', array('id' => $this->getListing()->getId(), 'back' => $helper->makeBackUrlParam('*/adminhtml_ebay_listing/view', array('id' => $this->getListing()->getId()))));
        $getErrorsSummary = $this->getUrl('*/adminhtml_listing/getErrorsSummary');
        $taskCompletedMessage = $helper->escapeJs($helper->__('Task completed. Please wait ...'));
        $taskCompletedSuccessMessage = $helper->escapeJs($helper->__('"%task_title%" Task has successfully completed.'));
        // M2ePro_TRANSLATIONS
        // %task_title%" Task has completed with warnings. <a target="_blank" href="%url%">View Log</a> for details.
        $tempString = '"%task_title%" Task has completed with warnings.' . ' <a target="_blank" href="%url%">View Log</a> for details.';
        $taskCompletedWarningMessage = $helper->escapeJs($helper->__($tempString));
        // M2ePro_TRANSLATIONS
        // "%task_title%" Task has completed with errors. <a target="_blank" href="%url%">View Log</a> for details.
        $tempString = '"%task_title%" Task has completed with errors. ' . ' <a target="_blank" href="%url%">View Log</a> for details.';
        $taskCompletedErrorMessage = $helper->escapeJs($helper->__($tempString));
        $sendingDataToEbayMessage = $helper->escapeJs($helper->__('Sending %product_title% Product(s) data on eBay.'));
        $viewAllProductLogMessage = $helper->escapeJs($helper->__('View All Product Log.'));
        $listingLockedMessage = $helper->escapeJs($helper->__('The Listing was locked by another process. Please try again later.'));
        $listingEmptyMessage = $helper->escapeJs($helper->__('Listing is empty.'));
        $selectItemsMessage = $helper->escapeJs($helper->__('Please select Items.'));
        $selectActionMessage = $helper->escapeJs($helper->__('Please select Action.'));
        $successWord = $helper->escapeJs($helper->__('Success'));
        $noticeWord = $helper->escapeJs($helper->__('Notice'));
        $warningWord = $helper->escapeJs($helper->__('Warning'));
        $errorWord = $helper->escapeJs($helper->__('Error'));
        $closeWord = $helper->escapeJs($helper->__('Close'));
        $prepareData = $this->getUrl('*/adminhtml_listing_moving/prepareMoveToListing');
        $getMoveToListingGridHtml = $this->getUrl('*/adminhtml_ebay_listing_settings_moving/moveToListingGrid');
        $getFailedProductsGridHtml = $this->getUrl('*/adminhtml_listing_moving/getFailedProductsGrid');
        $tryToMoveToListing = $this->getUrl('*/adminhtml_listing_moving/tryToMoveToListing');
        $moveToListing = $this->getUrl('*/adminhtml_listing_moving/moveToListing');
        $successfullyMovedMessage = $helper->escapeJs($helper->__('Product(s) was successfully Moved.'));
        $productsWereNotMovedMessage = $helper->escapeJs($helper->__('Product(s) was not Moved. <a target="_blank" href="%url%">View Log</a> for details.'));
        $someProductsWereNotMovedMessage = $helper->escapeJs($helper->__('Some Product(s) was not Moved. <a target="_blank" href="%url%">View Log</a> for details.'));
        $popupTitle = $helper->escapeJs($helper->__('Moving eBay Items'));
        $popupTitleSingle = $helper->escapeJs($helper->__('Moving eBay Item'));
        $failedProductsPopupTitle = $helper->escapeJs($helper->__('Product(s) failed to move'));
        $motorsType = '';
        if ($this->isMotorsAvailable()) {
            $motorsType = $this->getMotorsType();
        }
        $html = <<<HTML
<script type="text/javascript">

    M2ePro.url.add({$urls});
    M2ePro.translator.add({$translations});
    M2ePro.php.setConstants({$constants},'Ess_M2ePro_Helper_Component_Ebay_Category');

    M2ePro.productsIdsForList = '{$productsIdsForList}';

    M2ePro.url.logViewUrl = '{$logViewUrl}';
    M2ePro.url.getErrorsSummary = '{$getErrorsSummary}';

    M2ePro.url.prepareData = '{$prepareData}';
    M2ePro.url.getGridHtml = '{$getMoveToListingGridHtml}';
    M2ePro.url.getFailedProductsGridHtml = '{$getFailedProductsGridHtml}';
    M2ePro.url.tryToMoveToListing = '{$tryToMoveToListing}';
    M2ePro.url.moveToListing = '{$moveToListing}';

    M2ePro.text.popup_title = '{$popupTitle}';
    M2ePro.text.popup_title_single = '{$popupTitleSingle}';
    M2ePro.text.failed_products_popup_title = '{$failedProductsPopupTitle}';

    M2ePro.text.task_completed_message = '{$taskCompletedMessage}';
    M2ePro.text.task_completed_success_message = '{$taskCompletedSuccessMessage}';
    M2ePro.text.task_completed_warning_message = '{$taskCompletedWarningMessage}';
    M2ePro.text.task_completed_error_message = '{$taskCompletedErrorMessage}';

    M2ePro.text.sending_data_message = '{$sendingDataToEbayMessage}';
    M2ePro.text.view_all_product_log_message = '{$viewAllProductLogMessage}';

    M2ePro.text.listing_locked_message = '{$listingLockedMessage}';
    M2ePro.text.listing_empty_message = '{$listingEmptyMessage}';

    M2ePro.text.select_items_message = '{$selectItemsMessage}';
    M2ePro.text.select_action_message = '{$selectActionMessage}';

    M2ePro.text.success_word = '{$successWord}';
    M2ePro.text.notice_word = '{$noticeWord}';
    M2ePro.text.warning_word = '{$warningWord}';
    M2ePro.text.error_word = '{$errorWord}';
    M2ePro.text.close_word = '{$closeWord}';

    M2ePro.text.successfully_moved = '{$successfullyMovedMessage}';
    M2ePro.text.products_were_not_moved = '{$productsWereNotMovedMessage}';
    M2ePro.text.some_products_were_not_moved = '{$someProductsWereNotMovedMessage}';

    M2ePro.customData.componentMode = '{$component}';
    M2ePro.customData.gridId = '{$gridId}';
    M2ePro.customData.ignoreListings = '{$ignoreListings}';

    Event.observe(window, 'load', function() {
        EbayListingTransferringHandlerObj = new EbayListingTransferringHandler();
        EbayListingSettingsGridHandlerObj.movingHandler.setOptions(M2ePro);

        EbayListingTransferringPaymentHandlerObj = new EbayListingTransferringPaymentHandler();

        EbayMotorsHandlerObj = new EbayMotorsHandler({$this->getListing()->getId()}, '{$motorsType}');
    });

</script>
HTML;
        // ---------------------------------------
        if ($this->getRequest()->getParam('auto_actions')) {
            $html .= <<<HTML
<script type="text/javascript">
    Event.observe(window, 'load', function() {
        ListingAutoActionHandlerObj.loadAutoActionHtml();
    });
</script>
HTML;
        }
        // ---------------------------------------
        return parent::_toHtml() . $html;
    }