private function getGeneralIdColumnValueNotEmptyGeneralId($row) { $generalId = $row->getData('general_id'); $url = $this->getHelper('Component\\Amazon')->getItemUrl($generalId, $this->listing->getMarketplaceId()); $generalIdOwnerHtml = ''; if ($row->getData('is_general_id_owner') == \Ess\M2ePro\Model\Amazon\Listing\Product::IS_GENERAL_ID_OWNER_YES) { $generalIdOwnerHtml = '<br/><span style="font-size: 10px; color: grey;">' . $this->__('creator of ASIN/ISBN') . '</span>'; } if ((int) $row->getData('amazon_status') != \Ess\M2ePro\Model\Listing\Product::STATUS_NOT_LISTED) { return <<<HTML <a href="{$url}" target="_blank">{$generalId}</a>{$generalIdOwnerHtml} HTML; } $generalIdSearchInfo = $row->getData('general_id_search_info'); if (!empty($generalIdSearchInfo)) { $generalIdSearchInfo = @json_decode($generalIdSearchInfo, true); } if (!empty($generalIdSearchInfo['is_set_automatic'])) { $tip = $this->__('ASIN/ISBN was found automatically'); $text = <<<HTML <a href="{$url}" target="_blank" title="{$tip}" style="color:#40AADB;">{$generalId}</a> HTML; } else { $text = <<<HTML <a href="{$url}" target="_blank">{$generalId}</a> HTML; } return $text . $generalIdOwnerHtml; }
private function getGeneralIdColumnValueNotEmptyGeneralId($row) { $generalId = $row->getData('general_id'); $url = $this->getHelper('Component\\Amazon')->getItemUrl($generalId, $this->listing->getMarketplaceId()); $generalIdOwnerHtml = ''; if ($row->getData('is_general_id_owner') == \Ess\M2ePro\Model\Amazon\Listing\Product::IS_GENERAL_ID_OWNER_YES) { $generalIdOwnerHtml = '<br/><span style="font-size: 10px; color: grey;">' . $this->__('creator of ASIN/ISBN') . '</span>'; } if ((int) $row->getData('amazon_status') != \Ess\M2ePro\Model\Listing\Product::STATUS_NOT_LISTED) { return <<<HTML <a href="{$url}" target="_blank">{$generalId}</a>{$generalIdOwnerHtml} HTML; } $generalIdSearchInfo = $row->getData('general_id_search_info'); if (!empty($generalIdSearchInfo)) { $generalIdSearchInfo = @json_decode($generalIdSearchInfo, true); } if (!empty($generalIdSearchInfo['is_set_automatic'])) { $tip = $this->__('ASIN/ISBN was found automatically'); $text = <<<HTML <a href="{$url}" target="_blank" title="{$tip}" style="color:#40AADB;">{$generalId}</a> HTML; } else { $text = <<<HTML <a href="{$url}" target="_blank">{$generalId}</a> HTML; } // --------------------------------------- $hasInActionLock = $this->getLockedData($row); $hasInActionLock = $hasInActionLock['in_action']; // --------------------------------------- if ($hasInActionLock) { return $text . $generalIdOwnerHtml; } $listingProductId = (int) $row->getData('id'); /** @var \Ess\M2ePro\Model\Listing\Product $listingProduct */ $listingProduct = $this->amazonFactory->getObjectLoaded('Listing\\Product', $listingProductId); /** @var \Ess\M2ePro\Model\Amazon\Listing\Product\Variation\Manager $variationManager */ $variationManager = $listingProduct->getChildObject()->getVariationManager(); $variationChildStatuses = $row->getData('variation_child_statuses'); if ($variationManager->isVariationParent() && !empty($variationChildStatuses)) { $variationChildStatuses = json_decode($variationChildStatuses, true); unset($variationChildStatuses[\Ess\M2ePro\Model\Listing\Product::STATUS_NOT_LISTED]); foreach ($variationChildStatuses as $variationChildStatus) { if (!empty($variationChildStatus)) { return $text . $generalIdOwnerHtml; } } } $tip = $this->__('Unassign ASIN/ISBN'); $text .= <<<HTML <a href="javascript:;" class="amazon-listing-view-icon amazon-listing-view-generalId-remove" onclick="ListingGridHandlerObj.productSearchHandler.showUnmapFromGeneralIdPrompt({$listingProductId});" title="{$tip}"> </a>{$generalIdOwnerHtml} HTML; return $text; }
public function callbackColumnGeneralId($value, $row, $column, $isExport) { if (is_null($value) || $value === '') { return $this->__('N/A'); } $url = $this->getHelper('Component\\Amazon')->getItemUrl($value, $this->listing->getMarketplaceId()); $parentAsinHtml = ''; $variationParentId = $row->getData('variation_parent_id'); if (!empty($variationParentId)) { $parentAsinHtml = '<br/><span style="display: block; margin-bottom: 5px; font-size: 10px; color: grey;">' . $this->__('child ASIN/ISBN<br/>of parent %parent_asin%', $this->getParentAsin($row->getData('id'))) . '</span>'; } $generalIdOwnerHtml = ''; if ($row->getData('is_general_id_owner') == 1) { $generalIdOwnerHtml = '<span style="font-size: 10px; color: grey; display: block;">' . $this->__('creator of ASIN/ISBN') . '</span>'; } return <<<HTML <a href="{$url}" target="_blank">{$value}</a>{$parentAsinHtml}{$generalIdOwnerHtml} HTML; }
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); }
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(); }
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; } } }