コード例 #1
0
 /**
  * @return Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Matcher_Attribute
  */
 public function getMatcherAttributes()
 {
     if (empty($this->matcherAttributes)) {
         $this->matcherAttributes = Mage::getModel('M2ePro/Amazon_Listing_Product_Variation_Matcher_Attribute');
         $this->matcherAttributes->setMarketplaceId($this->getListingProduct()->getListing()->getMarketplaceId());
         $this->matcherAttributes->setMagentoProduct($this->getListingProduct()->getMagentoProduct());
         $this->matcherAttributes->setDestinationAttributes($this->getDestinationAttributes());
     }
     return $this->matcherAttributes;
 }
コード例 #2
0
    public function callbackColumnActions($value, $row, $column, $isExport)
    {
        $assignText = Mage::helper('M2ePro')->__('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 = Mage::helper('M2ePro')->__('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;
    <img id="map_link_error_icon_{$row->getId()}"
         class="tool-tip-image"
         style="vertical-align: middle; display: none;"
         src="{$iconWarningPath}">
    <span class="tool-tip-message tool-tip-warning tip-left" style="display:none;">
        <img src="{$iconHelpPath}">
        <span>{$msg}</span>
    </span>
</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 = Mage::helper('M2ePro')->__('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 = Mage::helper('M2ePro')->__('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 = Mage::helper('M2ePro')->__('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>
    <span id="map_link_{$row->getId()}"><span style="color: #808080">{$assignText}</span></span>&nbsp;
    <img id="map_link_error_icon_{$row->getId()}"
         class="tool-tip-image"
         style="vertical-align: middle;"
         src="{$iconWarningPath}">
    <span class="tool-tip-message tool-tip-warning tip-left" style="display:none;">
        <img src="{$iconHelpPath}">
        <span>{$msg}</span>
    </span>
</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 = Mage::helper('M2ePro')->__('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 = Mage::helper('M2ePro')->__('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;
    <img id="map_link_error_icon_{$row->getId()}"
         class="tool-tip-image"
         style="vertical-align: middle;"
         src="{$iconWarningPath}">
    <span class="tool-tip-message tool-tip-warning tip-left" style="display:none;">
        <img src="{$iconHelpPath}">
        <span>{$msg}</span>
    </span>
</span>
HTML;
    }