Пример #1
0
 /**
  * @return \Ess\M2ePro\Model\Amazon\Listing\Product\Variation\Matcher\Attribute
  */
 public function getMatcherAttributes()
 {
     if (empty($this->matcherAttributes)) {
         $this->matcherAttributes = $this->modelFactory->getObject('Amazon\\Listing\\Product\\Variation\\Matcher\\Attribute');
         $this->matcherAttributes->setMagentoProduct($this->getListingProduct()->getMagentoProduct());
         $this->matcherAttributes->setDestinationAttributes($this->getDestinationAttributes());
     }
     return $this->matcherAttributes;
 }
Пример #2
0
    public function callbackColumnActions($value, $row, $column, $isExport)
    {
        $assignText = $this->__('Assign');
        $iconWarningPath = $this->getSkinUrl('M2ePro/images/warning.png');
        $iconHelpPath = $this->getSkinUrl('M2ePro/images/i_notice.gif');
        if (!$this->listingProduct->getChildObject()->getVariationManager()->isVariationProduct() || $this->listingProduct->getChildObject()->getVariationManager()->isIndividualType()) {
            if (!$row->getData('is_variation_product')) {
                return <<<HTML
<a href="javascript:void(0);" onclick="ListingGridHandlerObj.productSearchHandler.mapToGeneralId(
    {$this->productId}, '{$row->getData('general_id')}');">{$assignText}</a>
HTML;
            }
            if (!$row->getData('bad_parent')) {
                $msg = $this->__('Please select necessary Options for this Amazon Product to be able to assign ASIN/ISBN.');
                return <<<HTML
<span>
    <span id="map_link_{$row->getId()}"><span style="color: #808080">{$assignText}</span></span>&nbsp;
    {$this->getTooltipHtml($msg, 'map_link_error_icon_' . $row->getId())}
</span>
<div id="template_map_link_{$row->getId()}" style="display: none;">
<a href="javascript:void(0);" onclick="ListingGridHandlerObj.productSearchHandler.mapToGeneralId(
    {$this->productId}, '%general_id%', '%options_data%'
);">{$assignText}</a>
</div>
HTML;
            }
        }
        if ($row->getData('is_variation_product') && !$row->getData('bad_parent')) {
            $msg = $this->__('Please map Amazon and Magento Attributes for this Amazon Product to be able to assign ASIN/ISBN.');
            $variations = $row->getData('variations');
            $destinationAttributes = array_keys($variations['set']);
            $this->matcherAttributes->setMagentoProduct($this->listingProduct->getMagentoProduct());
            $this->matcherAttributes->setDestinationAttributes($destinationAttributes);
            if ($this->matcherAttributes->isSourceAmountGreater()) {
                $msg = $this->__('Please map Magento and Amazon Attributes for this Amazon Product to be able to assign ASIN/ISBN.
                    Be careful, as the number of  Magento Attributes is more than the number of Attributes in Amazon
                    Parent Product. Thus you should select fixed Value for unmatched Magento Variational Attribute.');
            } else {
                if ($this->matcherAttributes->isDestinationAmountGreater()) {
                    $msg = $this->__('Please map Magento and Amazon Attributes for this Amazon Product to be able to assign ASIN/ISBN.
                    Be careful, as the number of Attributes in Amazon Parent Product is more than the number of
                    Magento Attributes. Thus you should select fixed Value for unmatched Amazon Variational Attribute.');
                }
            }
            return <<<HTML
<span>
    <div id="map_link_{$row->getId()}"><span style="color: #808080">{$assignText}</span></div>&nbsp;
    {$this->getTooltipHtml($msg, 'map_link_error_icon_' . $row->getId())}
</span>
<div id="template_map_link_{$row->getId()}" style="display: none;">
<a href="javascript:void(0);" onclick="ListingGridHandlerObj.productSearchHandler.mapToGeneralId(
    {$this->productId}, '{$row->getData('general_id')}', '%options_data%'
);">{$assignText}</a>
</div>
HTML;
        }
        $msg = $this->__('This ASIN/ISBN cannot be assigned to selected Magento Product. <br/>
             This Amazon Product has no Variations. <br/>
             Only Amazon Parent/Child Products can be assigned in "All Variations" Mode.');
        if ($row->getData('is_variation_product') && $row->getData('bad_parent')) {
            $msg = $this->__('This ASIN/ISBN cannot be assigned to selected Magento Product. <br/>
                 Amazon Service (API) does not return all required information about this Amazon Product.');
        }
        return <<<HTML
<span>
    <span id="map_link_{$row->getId()}"><span style="color: #808080">{$assignText}</span></span>&nbsp;
    {$this->getTooltipHtml($msg, 'map_link_error_icon_' . $row->getId())}
</span>
HTML;
    }