当前位置: 首页>>代码示例>>PHP>>正文


PHP Ess_M2ePro_Model_Listing_Product::setData方法代码示例

本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Product::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Product::setData方法的具体用法?PHP Ess_M2ePro_Model_Listing_Product::setData怎么用?PHP Ess_M2ePro_Model_Listing_Product::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ess_M2ePro_Model_Listing_Product的用法示例。


在下文中一共展示了Ess_M2ePro_Model_Listing_Product::setData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAddedListingProduct

 protected function processAddedListingProduct(Ess_M2ePro_Model_Listing_Product $listingProduct, array $params)
 {
     if (!empty($params['template_category_id'])) {
         $listingProduct->setData('template_category_id', $params['template_category_id']);
     }
     if (!empty($params['template_other_category_id'])) {
         $listingProduct->setData('template_other_category_id', $params['template_other_category_id']);
     }
     $listingProduct->save();
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:10,代码来源:Listing.php

示例2: process

 public function process()
 {
     if (is_null($this->listingProduct)) {
         throw new Ess_M2ePro_Model_Exception('Listing Product was not set.');
     }
     $this->getTypeModel()->enableCache();
     foreach ($this->getSortedProcessors() as $processor) {
         $this->getProcessorModel($processor)->process();
     }
     $this->listingProduct->setData('variation_parent_need_processor', 0);
     $this->listingProduct->save();
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:12,代码来源:Processor.php

示例3: checkChangeAsNotVariationProduct

 private function checkChangeAsNotVariationProduct(Ess_M2ePro_Model_Listing_Product $listingProduct)
 {
     /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager $variationManager */
     $variationManager = $listingProduct->getChildObject()->getVariationManager();
     $isVariationMagentoProduct = $listingProduct->getMagentoProduct()->isProductWithVariations();
     if ($isVariationMagentoProduct || !$variationManager->isVariationProduct()) {
         return false;
     }
     $variationManager->getTypeModel()->clearTypeData();
     if ($variationManager->isRelationParentType()) {
         $listingProduct->setData('general_id', NULL);
         $listingProduct->setData('is_general_id_owner', Ess_M2ePro_Model_Amazon_Listing_Product::IS_GENERAL_ID_OWNER_NO);
         $listingProduct->setData('status', Ess_M2ePro_Model_Listing_Product::STATUS_NOT_LISTED);
         $listingProduct->deleteInstance();
     } else {
         $variationManager->setSimpleType();
     }
     return true;
 }
开发者ID:ppkowalski,项目名称:M2E,代码行数:19,代码来源:Updater.php

示例4: saveVariationsSets

 protected function saveVariationsSets(Ess_M2ePro_Model_Listing_Product $listingProduct, $variations)
 {
     if (!isset($variations['set'])) {
         return;
     }
     $additionalData = $listingProduct->getData('additional_data');
     $additionalData = is_null($additionalData) ? array() : json_decode($additionalData, true);
     $additionalData['variations_sets'] = $variations['set'];
     $listingProduct->setData('additional_data', json_encode($additionalData))->save();
 }
开发者ID:ppkowalski,项目名称:M2E,代码行数:10,代码来源:Updater.php

示例5: checkChangeAsNotVariationProduct

 private function checkChangeAsNotVariationProduct(Ess_M2ePro_Model_Listing_Product $listingProduct)
 {
     /** @var Ess_M2ePro_Model_Buy_Listing_Product_Variation_Manager $variationManager */
     $variationManager = $listingProduct->getChildObject()->getVariationManager();
     $isVariationMagentoProduct = $listingProduct->getMagentoProduct()->isProductWithVariations();
     if ($isVariationMagentoProduct || !$variationManager->isVariationProduct()) {
         return false;
     }
     $variationManager->clearVariationData();
     $listingProduct->setData('is_variation_product', 0)->save();
     return true;
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:12,代码来源:Updater.php

示例6: saveVariationsData

 protected function saveVariationsData(Ess_M2ePro_Model_Listing_Product $listingProduct, $variationsData)
 {
     $additionalData = $listingProduct->getData('additional_data');
     $additionalData = is_null($additionalData) ? array() : (array) json_decode($additionalData, true);
     if (isset($variationsData['set'])) {
         $additionalData['variations_sets'] = $variationsData['set'];
     }
     if (isset($variationsData['additional']['attributes'])) {
         $additionalData['configurable_attributes'] = $variationsData['additional']['attributes'];
     }
     $listingProduct->setData('additional_data', json_encode($additionalData))->save();
 }
开发者ID:ReeceCrossland,项目名称:essua-m2epro,代码行数:12,代码来源:Updater.php

示例7: updateVariations

 public function updateVariations(Ess_M2ePro_Model_Listing_Product $listingProduct)
 {
     $options = array();
     if ($listingProduct->getMagentoProduct()->isProductWithoutVariations()) {
         $listingProduct->setData('is_variation_product', Ess_M2ePro_Model_Play_Listing_Product::IS_VARIATION_PRODUCT_NO)->save();
         if ($listingProduct->getChildObject()->isVariationMatched()) {
             $listingProduct->getChildObject()->updateVariationOptions($options);
             $listingProduct->getChildObject()->unsetMatchedVariation();
         }
         return;
     }
     $listingProduct->setData('is_variation_product', Ess_M2ePro_Model_Play_Listing_Product::IS_VARIATION_PRODUCT_YES)->save();
     $magentoVariations = $listingProduct->getMagentoProduct()->getProductVariations();
     foreach ($magentoVariations['set'] as $attribute => $value) {
         $options[] = array('attribute' => $attribute, 'option' => NULL);
     }
     if (!$listingProduct->getChildObject()->isVariationMatched()) {
         $listingProduct->getChildObject()->updateVariationOptions($options);
         return;
     }
     // observe variation removal in Magento
     $currentVariation = $this->prepareCurrentVariations($listingProduct->getVariations(true));
     if (!isset($currentVariation[0]) || !isset($currentVariation[0]['options'])) {
         return;
     }
     $currentVariation = reset($currentVariation);
     $magentoVariations = $this->prepareMagentoVariations($magentoVariations);
     foreach ($magentoVariations as $magentoVariation) {
         if ($this->isEqualVariations($magentoVariation['options'], $currentVariation['options'])) {
             return;
         }
     }
     foreach ($listingProduct->getVariations(true) as $variation) {
         $variation->deleteInstance();
     }
     $listingProduct->getChildObject()->updateVariationOptions($options);
     $listingProduct->getChildObject()->unsetMatchedVariation();
 }
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:38,代码来源:Updater.php

示例8: processAddedListingProduct

 protected function processAddedListingProduct(Ess_M2ePro_Model_Listing_Product $listingProduct, array $params)
 {
     if (empty($params['template_description_id'])) {
         return;
     }
     /** @var Ess_M2ePro_Model_Amazon_Listing_Product $amazonListingProduct */
     $amazonListingProduct = $listingProduct->getChildObject();
     if (!$amazonListingProduct->getVariationManager()->isRelationParentType()) {
         $listingProduct->setData('template_description_id', $params['template_description_id']);
         $listingProduct->setData('is_general_id_owner', Ess_M2ePro_Model_Amazon_Listing_Product::IS_GENERAL_ID_OWNER_YES);
         $listingProduct->save();
         return;
     }
     $processor = $amazonListingProduct->getVariationManager()->getTypeModel()->getProcessor();
     if ($listingProduct->getMagentoProduct()->isBundleType() || $listingProduct->getMagentoProduct()->isSimpleTypeWithCustomOptions()) {
         $processor->process();
         return;
     }
     $detailsModel = Mage::getModel('M2ePro/Amazon_Marketplace_Details');
     $detailsModel->setMarketplaceId($listingProduct->getListing()->getMarketplaceId());
     /** @var Ess_M2ePro_Model_Template_Description $descriptionTemplate */
     $descriptionTemplate = Mage::helper('M2ePro/Component_Amazon')->getModel('Template_Description')->load($params['template_description_id']);
     /** @var Ess_M2ePro_Model_Amazon_Template_Description $amazonDescriptionTemplate */
     $amazonDescriptionTemplate = $descriptionTemplate->getChildObject();
     $possibleThemes = $detailsModel->getVariationThemes($amazonDescriptionTemplate->getProductDataNick());
     $productAttributes = $amazonListingProduct->getVariationManager()->getTypeModel()->getProductAttributes();
     foreach ($possibleThemes as $theme) {
         if (count($theme['attributes']) != count($productAttributes)) {
             continue;
         }
         $listingProduct->setData('template_description_id', $params['template_description_id']);
         $listingProduct->setData('is_general_id_owner', Ess_M2ePro_Model_Amazon_Listing_Product::IS_GENERAL_ID_OWNER_YES);
         break;
     }
     $listingProduct->save();
     $processor->process();
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:37,代码来源:Listing.php

示例9: updateAfterStopAction

 public function updateAfterStopAction(Ess_M2ePro_Model_Listing_Product $listingProduct, array $nativeRequestData = array(), array $params = array())
 {
     // Update Listing Product
     //---------------------
     $dataForUpdate = array('status' => Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED);
     if (isset($params['status_changer'])) {
         $dataForUpdate['status_changer'] = (int) $params['status_changer'];
     }
     if (isset($params['end_date_raw'])) {
         $dataForUpdate['end_date'] = Ess_M2ePro_Model_Connector_Server_Ebay_Abstract::ebayTimeToString($params['end_date_raw']);
     }
     $listingProduct->addData($dataForUpdate)->save();
     //---------------------
     // Save additional info
     //---------------------
     $additionalData = $listingProduct->getAdditionalData();
     $additionalData['ebay_item_fees'] = array();
     $listingProduct->setData('additional_data', json_encode($additionalData))->save();
     //---------------------
     // Update Variations
     //---------------------
     $productVariations = $listingProduct->getVariations(true);
     foreach ($productVariations as $variation) {
         /** @var $variation Ess_M2ePro_Model_Listing_Product_Variation */
         $dataForUpdate = array('add' => 0);
         if ($variation->getChildObject()->isListed()) {
             $dataForUpdate['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED;
         }
         $variation->addData($dataForUpdate)->save();
     }
     //---------------------
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:32,代码来源:Helper.php

示例10: matchEmptyChannelOptionsChild

 private function matchEmptyChannelOptionsChild(Ess_M2ePro_Model_Listing_Product $listingProduct)
 {
     /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager_Type_Relation_Child $typeModel */
     $typeModel = $listingProduct->getChildObject()->getVariationManager()->getTypeModel();
     $channelOptions = array_merge($this->getProcessor()->getTypeModel()->getUnusedChannelOptions(), $this->getProcessor()->getTypeModel()->getUsedChannelOptions(true));
     if (empty($channelOptions)) {
         return;
     }
     if (!$typeModel->isVariationProductMatched()) {
         return;
     }
     $matcher = $this->getOptionMatcher();
     $matcher->setDestinationOptions($channelOptions);
     $generalId = $matcher->getMatchedOptionGeneralId($typeModel->getProductOptions());
     if (is_null($generalId)) {
         return;
     }
     $existChild = $this->findChildByChannelOptions($channelOptions[$generalId]);
     if (!is_null($existChild)) {
         $this->getProcessor()->tryToDeleteChildListingProduct($existChild);
     }
     $listingProduct->setData('general_id', $generalId);
     $typeModel->setChannelVariation($channelOptions[$generalId]);
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:24,代码来源:Options.php

示例11: updateAfterAction

 public function updateAfterAction(Ess_M2ePro_Model_Listing_Product $listingProduct, array $nativeRequestData = array(), array $params = array(), $saveEbayQtySold = false)
 {
     if (!$listingProduct->getChildObject()->isListingTypeFixed() || !$listingProduct->getChildObject()->isVariationMode() || $listingProduct->getMagentoProduct()->isProductWithoutVariations()) {
         return;
     }
     $isImagesUploadError = isset($params['is_images_upload_error']) ? $params['is_images_upload_error'] : false;
     if (isset($nativeRequestData['variation_image']) && !$isImagesUploadError) {
         $additionalData = $listingProduct->getAdditionalData();
         $additionalData['ebay_product_variation_images_hash'] = sha1(json_encode($nativeRequestData['variation_image']));
         $listingProduct->setData('additional_data', json_encode($additionalData))->save();
     }
     // Delete Variations
     //-----------------------------
     $productVariations = $listingProduct->getVariations(true);
     foreach ($productVariations as $variation) {
         /** @var $variation Ess_M2ePro_Model_Listing_Product_Variation */
         $variation->getChildObject()->isDelete() && $variation->deleteInstance();
     }
     //-----------------------------
     // Update Variations
     //-----------------------------
     $productVariations = $listingProduct->getVariations(true);
     foreach ($productVariations as $variation) {
         /** @var $variation Ess_M2ePro_Model_Listing_Product_Variation */
         $dataForUpdate = array('online_price' => $variation->getChildObject()->getPrice(), 'add' => 0, 'delete' => 0, 'status' => Ess_M2ePro_Model_Listing_Product::STATUS_LISTED);
         if ($saveEbayQtySold) {
             $dataForUpdate['online_qty_sold'] = is_null($variation->getChildObject()->getOnlineQtySold()) ? 0 : $variation->getChildObject()->getOnlineQtySold();
             $dataForUpdate['online_qty'] = $variation->getChildObject()->getQty() + $dataForUpdate['online_qty_sold'];
         } else {
             $dataForUpdate['online_qty_sold'] = 0;
             $dataForUpdate['online_qty'] = $variation->getChildObject()->getQty();
         }
         if ($dataForUpdate['online_qty'] <= $dataForUpdate['online_qty_sold']) {
             $dataForUpdate['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_SOLD;
         }
         if ($dataForUpdate['online_qty'] <= 0) {
             $dataForUpdate['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_NOT_LISTED;
         }
         $variation->addData($dataForUpdate)->save();
     }
     //-----------------------------
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:42,代码来源:HelperVariations.php


注:本文中的Ess_M2ePro_Model_Listing_Product::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。