Esempio n. 1
0
 public function fillCategoriesPaths(array &$data, Ess_M2ePro_Model_Listing $listing)
 {
     $ebayCategoryHelper = Mage::helper('M2ePro/Component_Ebay_Category_Ebay');
     $ebayStoreCategoryHelper = Mage::helper('M2ePro/Component_Ebay_Category_Store');
     $temp = array('category_main' => array('call' => array($ebayCategoryHelper, 'getPath'), 'arg' => $listing->getMarketplaceId()), 'category_secondary' => array('call' => array($ebayCategoryHelper, 'getPath'), 'arg' => $listing->getMarketplaceId()), 'store_category_main' => array('call' => array($ebayStoreCategoryHelper, 'getPath'), 'arg' => $listing->getAccountId()), 'store_category_secondary' => array('call' => array($ebayStoreCategoryHelper, 'getPath'), 'arg' => $listing->getAccountId()));
     foreach ($temp as $key => $value) {
         if (!isset($data[$key . '_mode']) || !empty($data[$key . '_path'])) {
             continue;
         }
         if ($data[$key . '_mode'] == Ess_M2ePro_Model_Ebay_Template_Category::CATEGORY_MODE_EBAY) {
             $data[$key . '_path'] = call_user_func($value['call'], $data[$key . '_id'], $value['arg']);
         }
         if ($data[$key . '_mode'] == Ess_M2ePro_Model_Ebay_Template_Category::CATEGORY_MODE_ATTRIBUTE) {
             $attributeLabel = Mage::helper('M2ePro/Magento_Attribute')->getAttributeLabel($data[$key . '_attribute'], $listing->getStoreId());
             $data[$key . '_path'] = 'Magento Attribute' . ' -> ' . $attributeLabel;
         }
     }
 }
Esempio n. 2
0
    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));
        $path = 'adminhtml_ebay_category/getChooserEditHtml';
        $urls[$path] = $this->getUrl('*/' . $path, array('account_id' => $this->listing->getAccountId(), 'marketplace_id' => $this->listing->getMarketplaceId()));
        $urls = json_encode($urls);
        //------------------------------
        //------------------------------
        $translations = array();
        // M2ePro_TRANSLATIONS
        // You have not selected the Primary eBay Category for some products.
        $text = 'You have not selected the Primary eBay Category for some products.';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // Are you sure?
        $text = 'Are you sure?';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // eBay could not assign categories for %product_tite% products.
        $text = 'eBay could not assign categories for %product_title% products.';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // Suggested Categories were successfully received for %product_title% product(s).
        $text = 'Suggested Categories were successfully received for %product_title% product(s).';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Category
        $text = 'Set eBay Category';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Category for Product(s)
        $text = 'Set eBay Category for Product(s)';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Primary Category for Product(s)
        $text = 'Set eBay Primary Category for Product(s)';
        $translations[$text] = Mage::helper('M2ePro')->__($text);
        $translations = json_encode($translations);
        //------------------------------
        //------------------------------
        $constants = Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Category');
        //------------------------------
        $getSuggested = json_encode((bool) Mage::helper('M2ePro/Data_Global')->getValue('get_suggested'));
        $commonJs = <<<HTML
<script type="text/javascript">
    EbayListingCategoryProductGridHandlerObj.afterInitPage();
    EbayListingCategoryProductGridHandlerObj.getGridMassActionObj().setGridIds('{$this->getGridIdsJson()}');
</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');

    WrapperObj = new AreaWrapper('products_container');
    ProgressBarObj = new ProgressBar('products_progress_bar');

    EbayListingCategoryProductGridHandlerObj = new EbayListingCategoryProductGridHandler('{$this->getId()}');
    EbayListingCategoryProductSuggestedSearchHandlerObj = new EbayListingCategoryProductSuggestedSearchHandler();

    if ({$getSuggested}) {
        Event.observe(window, 'load', function() {
            EbayListingCategoryProductGridHandlerObj.getSuggestedCategoriesForAll();
        });
    }
</script>
HTML;
        }
        return parent::_toHtml() . $additionalJs . $commonJs;
    }
Esempio n. 3
0
 private function getDataFromListing(Ess_M2ePro_Model_Listing $source, array $params = array())
 {
     //------------------------------
     $accountId = $source->getAccountId();
     $marketplaceId = $source->getMarketplaceId();
     $storeId = $source->getStoreId();
     $attributeSets = Mage::helper('M2ePro/Magento_AttributeSet')->getAll(Ess_M2ePro_Helper_Magento_Abstract::RETURN_TYPE_IDS);
     //------------------------------
     //------------------------------
     $templates = array();
     foreach (Mage::getSingleton('M2ePro/Ebay_Template_Manager')->getAllTemplates() as $nick) {
         $manager = Mage::getModel('M2ePro/Ebay_Template_Manager')->setTemplate($nick)->setOwnerObject($source->getChildObject());
         $templateId = $manager->getIdColumnValue();
         $templateMode = $manager->getModeValue();
         $templates[$nick] = array('id' => $templateId, 'mode' => $templateMode, 'force_parent' => false);
     }
     //------------------------------
     return array('account_id' => $accountId, 'marketplace_id' => $marketplaceId, 'store_id' => $storeId, 'attribute_sets' => $attributeSets, 'display_use_default_option' => false, 'templates' => $templates);
 }