Beispiel #1
0
 protected function addCategoriesPath(&$data, \Ess\M2ePro\Model\Listing $listing)
 {
     $marketplaceId = $listing->getData('marketplace_id');
     $accountId = $listing->getAccountId();
     if (isset($data['category_main_mode'])) {
         if ($data['category_main_mode'] == \Ess\M2ePro\Model\Ebay\Template\Category::CATEGORY_MODE_EBAY) {
             $data['category_main_path'] = $this->getHelper('Component\\Ebay\\Category\\Ebay')->getPath($data['category_main_id'], $marketplaceId);
         } else {
             $data['category_main_path'] = null;
         }
     }
     if (isset($data['category_secondary_mode'])) {
         if ($data['category_secondary_mode'] == \Ess\M2ePro\Model\Ebay\Template\Category::CATEGORY_MODE_EBAY) {
             $data['category_secondary_path'] = $this->getHelper('Component\\Ebay\\Category\\Ebay')->getPath($data['category_secondary_id'], $marketplaceId);
         } else {
             $data['category_secondary_path'] = null;
         }
     }
     if (isset($data['store_category_main_mode'])) {
         if ($data['store_category_main_mode'] == \Ess\M2ePro\Model\Ebay\Template\Category::CATEGORY_MODE_EBAY) {
             $data['store_category_main_path'] = $this->getHelper('Component\\Ebay\\Category\\Store')->getPath($data['store_category_main_id'], $accountId);
         } else {
             $data['store_category_main_path'] = null;
         }
     }
     if (isset($data['store_category_secondary_mode'])) {
         if ($data['store_category_secondary_mode'] == \Ess\M2ePro\Model\Ebay\Template\Category::CATEGORY_MODE_EBAY) {
             $data['store_category_secondary_path'] = $this->getHelper('Component\\Ebay\\Category\\Store')->getPath($data['store_category_secondary_id'], $accountId);
         } else {
             $data['store_category_secondary_path'] = null;
         }
     }
 }
Beispiel #2
0
 private function getDataFromListing(\Ess\M2ePro\Model\Listing $source, array $params = array())
 {
     $accountId = $source->getAccountId();
     $marketplaceId = $source->getMarketplaceId();
     $storeId = $source->getStoreId();
     $attributeSets = $this->getHelper('Magento\\AttributeSet')->getAll(\Ess\M2ePro\Helper\Magento\AbstractHelper::RETURN_TYPE_IDS);
     $templates = array();
     foreach ($this->templateManager->getAllTemplates() as $nick) {
         $manager = $this->templateManagerFactory->create()->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);
 }
Beispiel #3
0
    protected function _toHtml()
    {
        $allIdsStr = $this->getGridIdsJson();
        if ($this->getRequest()->isXmlHttpRequest()) {
            $this->js->add(<<<JS
    EbayListingProductCategorySettingsModeProductGridObj.afterInitPage();
    EbayListingProductCategorySettingsModeProductGridObj.getGridMassActionObj().setGridIds('{$allIdsStr}');
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->jsUrl->add($this->getUrl('*/ebay_category/getChooserEditHtml', array('account_id' => $this->listing->getAccountId(), 'marketplace_id' => $this->listing->getMarketplaceId())), 'ebay_category/getChooserEditHtml');
        // ---------------------------------------
        // ---------------------------------------
        $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] = $this->__($text);
        // M2ePro_TRANSLATIONS
        // Are you sure?
        $text = 'Are you sure?';
        $translations[$text] = $this->__($text);
        // M2ePro_TRANSLATIONS
        // eBay could not assign Categories for %product_tite% Products.
        $text = 'eBay could not assign Categories for %product_title% Products.';
        $translations[$text] = $this->__($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] = $this->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Category
        $text = 'Set eBay Category';
        $translations[$text] = $this->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Category for Product(s)
        $text = 'Set eBay Category for Product(s)';
        $translations[$text] = $this->__($text);
        // M2ePro_TRANSLATIONS
        // Set eBay Primary Category for Product(s)
        $text = 'Set eBay Primary Category for Product(s)';
        $translations[$text] = $this->__($text);
        $this->jsTranslator->addTranslations($translations);
        // ---------------------------------------
        // ---------------------------------------
        $this->jsPhp->addConstants($this->getHelper('Data')->getClassConstants('\\Ess\\M2ePro\\Helper\\Component\\Ebay\\Category'));
        // ---------------------------------------
        $getSuggested = json_encode((bool) $this->getHelper('Data\\GlobalData')->getValue('get_suggested'));
        $this->js->addOnReadyJs(<<<JS
require([
    'M2ePro/Ebay/Listing/Product/Category/Settings/Mode/Product/Grid',
    'M2ePro/Ebay/Listing/Product/Category/Settings/Mode/Product/SuggestedSearch',
    'M2ePro/Plugin/ProgressBar',
    'M2ePro/Plugin/AreaWrapper'
], function(){

    window.WrapperObj = new AreaWrapper('products_container');
    window.ProgressBarObj = new ProgressBar('products_progress_bar');
    
    window.EbayListingProductCategorySettingsModeProductGridObj
            = new EbayListingProductCategorySettingsModeProductGrid('{$this->getId()}');
    EbayListingProductCategorySettingsModeProductSuggestedSearchObj
            = new EbayListingProductCategorySettingsModeProductSuggestedSearch();
    
    EbayListingProductCategorySettingsModeProductGridObj.afterInitPage();
    EbayListingProductCategorySettingsModeProductGridObj.getGridMassActionObj().setGridIds('{$allIdsStr}');
    
    if ({$getSuggested}) {
        EbayListingProductCategorySettingsModeProductGridObj.getSuggestedCategoriesForAll();
    }
    

})
JS
);
        return parent::_toHtml();
    }
Beispiel #4
0
 public function fillCategoriesPaths(array &$data, \Ess\M2ePro\Model\Listing $listing)
 {
     $ebayCategoryHelper = $this->getHelper('Component\\Ebay\\Category\\Ebay');
     $ebayStoreCategoryHelper = $this->getHelper('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 = $this->getHelper('Magento\\Attribute')->getAttributeLabel($data[$key . '_attribute'], $listing->getStoreId());
             $data[$key . '_path'] = 'Magento Attribute' . ' > ' . $attributeLabel;
         }
     }
 }