Esempio n. 1
0
 private function match()
 {
     $this->validate();
     /** @var \Ess\M2ePro\Model\Amazon\Listing\Product\Variation\Matcher\Attribute $attributeMatcher */
     $attributeMatcher = $this->modelFactory->getObject('Amazon\\Listing\\Product\\Variation\\Matcher\\Attribute');
     if (!is_null($this->magentoProduct)) {
         if ($this->magentoProduct->isGroupedType()) {
             $this->matchedTheme = null;
             return $this;
         }
         $attributeMatcher->setMagentoProduct($this->magentoProduct);
     }
     if (!empty($this->sourceAttributes)) {
         $attributeMatcher->setSourceAttributes($this->sourceAttributes);
         $attributeMatcher->canUseDictionary(false);
     }
     foreach ($this->themes as $themeName => $themeAttributes) {
         $attributeMatcher->setDestinationAttributes($themeAttributes['attributes']);
         if ($attributeMatcher->isAmountEqual() && $attributeMatcher->isFullyMatched()) {
             $this->matchedTheme = $themeName;
             break;
         }
     }
     return $this;
 }
Esempio n. 2
0
 private function match()
 {
     if (!is_null($this->magentoProduct) && $this->magentoProduct->isGroupedType() && !$this->magentoProduct->getVariationVirtualAttributes()) {
         $channelAttribute = reset($this->destinationAttributes);
         $this->matchedAttributes = array(\Ess\M2ePro\Model\Magento\Product\Variation::GROUPED_PRODUCT_ATTRIBUTE_LABEL => $channelAttribute);
         return;
     }
     if ($this->matchByNames()) {
         return;
     }
     if (!$this->canUseDictionary) {
         return;
     }
     if ($this->matchByLocalVocabulary()) {
         return;
     }
     $this->matchByServerVocabulary();
 }