本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Product::getAdditionalData方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Product::getAdditionalData方法的具体用法?PHP Ess_M2ePro_Model_Listing_Product::getAdditionalData怎么用?PHP Ess_M2ePro_Model_Listing_Product::getAdditionalData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Listing_Product
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Listing_Product::getAdditionalData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setListAttemptData
private function setListAttemptData(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
$additionalData = $listingProduct->getAdditionalData();
$additionalData['last_list_attempt_date'] = Mage::helper('M2ePro')->getCurrentGmtDate();
$listingProduct->setSettings('additional_data', $additionalData);
$listingProduct->save();
}
示例2: isTriedToList
protected function isTriedToList(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
$listingProductAdditionalData = $listingProduct->getAdditionalData();
if (empty($listingProductAdditionalData['last_list_attempt_date'])) {
return false;
}
$lastListAttemptDate = new DateTime($listingProductAdditionalData['last_list_attempt_date'], new DateTimeZone('UTC'));
$minDate = new DateTime('now', new DateTimeZone('UTC'));
$minDate->modify('- 3 days');
if ((int) $lastListAttemptDate->format('U') < (int) $minDate->format('U')) {
return false;
}
return true;
}
示例3: isMeetListRequirements
/**
* @param Ess_M2ePro_Model_Listing_Product $listingProduct
* @return bool
* @throws Ess_M2ePro_Model_Exception
* @throws Ess_M2ePro_Model_Exception_Logic
* @throws Exception
*/
public function isMeetListRequirements(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
if (!$listingProduct->isNotListed() || $listingProduct->isBlocked()) {
return false;
}
if (!$listingProduct->isListable()) {
return false;
}
/** @var Ess_M2ePro_Model_Amazon_Listing_Product $amazonListingProduct */
$amazonListingProduct = $listingProduct->getChildObject();
$variationManager = $amazonListingProduct->getVariationManager();
$searchGeneralId = $amazonListingProduct->getListingSource()->getSearchGeneralId();
$searchWorldwideId = $amazonListingProduct->getListingSource()->getSearchWorldwideId();
if ($variationManager->isVariationProduct()) {
if ($variationManager->isPhysicalUnit() && !$variationManager->getTypeModel()->isVariationProductMatched()) {
return false;
}
if ($variationManager->isRelationParentType() && $amazonListingProduct->getGeneralId()) {
return false;
}
if ($variationManager->isRelationChildType()) {
if (!$amazonListingProduct->getGeneralId() && !$amazonListingProduct->isGeneralIdOwner()) {
return false;
}
}
if ($variationManager->isIndividualType()) {
if (!$amazonListingProduct->getGeneralId() && ($listingProduct->getMagentoProduct()->isSimpleTypeWithCustomOptions() || $listingProduct->getMagentoProduct()->isBundleType())) {
return false;
}
}
if ($variationManager->isRelationParentType() && empty($searchGeneralId) && !$amazonListingProduct->isGeneralIdOwner()) {
return false;
}
}
if (!$amazonListingProduct->getGeneralId() && !$amazonListingProduct->isGeneralIdOwner() && empty($searchGeneralId) && empty($searchWorldwideId)) {
return false;
}
$amazonSynchronizationTemplate = $amazonListingProduct->getAmazonSynchronizationTemplate();
if (!$amazonSynchronizationTemplate->isListMode()) {
return false;
}
if ($listingProduct->isLockedObject('in_action')) {
return false;
}
$variationResource = Mage::getResourceModel('M2ePro/Listing_Product_Variation');
$additionalData = $listingProduct->getAdditionalData();
if ($amazonSynchronizationTemplate->isListStatusEnabled()) {
if (!$listingProduct->getMagentoProduct()->isStatusEnabled()) {
// M2ePro_TRANSLATIONS
// Product was not automatically Listed according to the List Rules in Synchronization Policy. Status of Magento Product is Disabled (%date%) though in Synchronization Rules “Product Status” is set to Enabled.
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Status of Magento Product is Disabled (%date%) though in Synchronization Rules “Product Status”
is set to Enabled.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
} else {
if ($variationManager->isPhysicalUnit() && $variationManager->getTypeModel()->isVariationProductMatched()) {
$temp = $variationResource->isAllStatusesDisabled($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
// M2ePro_TRANSLATIONS
// Product was not automatically Listed according to the List Rules in Synchronization Policy. Status of Magento Product Variation is Disabled (%date%) though in Synchronization Rules “Product Status“ is set to Enabled.
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Status of Magento Product Variation is Disabled (%date%) though in Synchronization Rules
“Product Status“ is set to Enabled.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
}
}
}
}
if ($amazonSynchronizationTemplate->isListIsInStock()) {
if (!$listingProduct->getMagentoProduct()->isStockAvailability()) {
// M2ePro_TRANSLATIONS
// Product was not automatically Listed according to the List Rules in Synchronization Policy. Stock Availability of Magento Product is Out of Stock though in Synchronization Rules “Stock Availability” is set to In Stock.
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Stock Availability of Magento Product is Out of Stock though in
Synchronization Rules “Stock Availability” is set to In Stock.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
} else {
if ($variationManager->isPhysicalUnit() && $variationManager->getTypeModel()->isVariationProductMatched()) {
$temp = $variationResource->isAllDoNotHaveStockAvailabilities($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
// M2ePro_TRANSLATIONS
// Product was not automatically Listed according to the List Rules in Synchronization Policy. Stock Availability of Magento Product Variation is Out of Stock though in Synchronization Rules “Stock Availability” is set to In Stock.
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Stock Availability of Magento Product Variation is Out of Stock though
in Synchronization Rules “Stock Availability” is set to In Stock.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
//.........这里部分代码省略.........
示例4: updateProduct
protected function updateProduct(Ess_M2ePro_Model_Listing_Product $listingProduct, array $response)
{
$productData = array();
$descriptionTemplate = $listingProduct->getChildObject()->getDescriptionTemplate();
$oldDescriptionTemplateId = $descriptionTemplate->getId();
if (!isset($this->descriptionTemplatesIds[$oldDescriptionTemplateId]) && (trim($descriptionTemplate->getData('title_template')) != '#ebay_translated_title#' || trim($descriptionTemplate->getData('subtitle_template')) != '#ebay_translated_subtitle#' || trim($descriptionTemplate->getData('description_template')) != '#ebay_translated_description#')) {
$data = $descriptionTemplate->getDataSnapshot();
unset($data['id'], $data['update_date'], $data['create_date']);
$data['title'] = $data['title'] . Mage::helper('M2ePro')->__(' (Changed because Translation Service applied.)');
$data['title_mode'] = Ess_M2ePro_Model_Ebay_Template_Description::TITLE_MODE_CUSTOM;
$data['title_template'] = '#ebay_translated_title#';
$data['subtitle_mode'] = Ess_M2ePro_Model_Ebay_Template_Description::SUBTITLE_MODE_CUSTOM;
$data['subtitle_template'] = '#ebay_translated_subtitle#';
$data['description_mode'] = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_CUSTOM;
$data['description_template'] = '#ebay_translated_description#';
$data['is_custom_template'] = 1;
$newDescriptionTemplate = Mage::getModel('M2ePro/Ebay_Template_Manager')->setTemplate(Ess_M2ePro_Model_Ebay_Template_Manager::TEMPLATE_DESCRIPTION)->getTemplateBuilder()->build($data);
$this->descriptionTemplatesIds[$oldDescriptionTemplateId] = $newDescriptionTemplate->getId();
}
if (isset($this->descriptionTemplatesIds[$oldDescriptionTemplateId])) {
$productData['template_description_custom_id'] = $this->descriptionTemplatesIds[$oldDescriptionTemplateId];
$productData['template_description_mode'] = Ess_M2ePro_Model_Ebay_Template_Manager::MODE_CUSTOM;
}
$this->checkAndCreateMagentoAttributes(array('ebay_translated_title' => 'Ebay Translated Title', 'ebay_translated_subtitle' => 'Ebay Translated Subtitle'), 'text');
$this->checkAndCreateMagentoAttributes(array('ebay_translated_description' => 'Ebay Translated Description'), 'textarea');
$this->checkAndCreateMagentoProductAttributes($listingProduct->getMagentoProduct(), array('ebay_translated_title', 'ebay_translated_subtitle', 'ebay_translated_description'));
$listingProduct->getMagentoProduct()->setAttributeValue('ebay_translated_title', $response['title'])->setAttributeValue('ebay_translated_subtitle', $response['subtitle'])->setAttributeValue('ebay_translated_description', $response['description']);
//------------------------------
$categoryPath = !is_null($response['category']['primary_id']) ? Mage::helper('M2ePro/Component_Ebay_Category_Ebay')->getPath((int) $response['category']['primary_id'], $this->params['marketplace_id']) : '';
$response['category']['path'] = $categoryPath;
if ($categoryPath) {
$data = Mage::getModel('M2ePro/Ebay_Template_Category')->getDefaultSettings();
$data['category_main_id'] = (int) $response['category']['primary_id'];
$data['category_main_path'] = $categoryPath;
$data['marketplace_id'] = $this->params['marketplace_id'];
$data['specifics'] = $this->getSpecificsData($response['item_specifics']);
$productData['template_category_id'] = Mage::getModel('M2ePro/Ebay_Template_Category_Builder')->build($data)->getId();
} else {
$response['category']['primary_id'] = null;
}
$additionalData = $listingProduct->getAdditionalData();
$additionalData['translation_service']['to'] = array_merge($additionalData['translation_service']['to'], $response);
$productData['additional_data'] = json_encode($additionalData);
$listingProduct->addData($productData)->save();
$listingProduct->getChildObject()->addData(array('translation_status' => Ess_M2ePro_Model_Ebay_Listing_Product::TRANSLATION_STATUS_TRANSLATED, 'translated_date' => Mage::helper('M2ePro')->getCurrentGmtDate()))->save();
}
示例5: modifyAndLogListingProduct
private function modifyAndLogListingProduct(Ess_M2ePro_Model_Listing_Product $listingProduct, $status, $duplicateItemId = null)
{
/** @var Ess_M2ePro_Model_Listing_Log $logModel */
$logModel = Mage::getModel('M2ePro/Listing_Log');
$logModel->setComponentMode(Ess_M2ePro_Helper_Component_Ebay::NICK);
$logsActionId = $logModel->getNextActionId();
$statusLogMessage = $this->getStatusLogMessage($listingProduct->getStatus(), $status);
$logModel->addProductMessage($listingProduct->getData('listing_id'), $listingProduct->getData('product_id'), $listingProduct->getId(), Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION, $logsActionId, Ess_M2ePro_Model_Listing_Log::ACTION_CHANNEL_CHANGE, $statusLogMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
$additionalData = $listingProduct->getAdditionalData();
unset($additionalData['last_failed_action_data']);
$listingProduct->addData(array('status' => $status, 'additional_data' => json_encode($additionalData)))->save();
$listingProduct->getChildObject()->updateVariationsStatus();
if (is_null($duplicateItemId)) {
return;
}
// M2ePro_TRANSLATIONS
// Duplicated Item %item_id% was found and Stopped on eBay.
$textToTranslate = 'Duplicated Item %item_id% was found and stopped on eBay.';
$duplicateDeletedMessage = Mage::helper('M2ePro')->__($textToTranslate, $duplicateItemId);
$logModel->addProductMessage($listingProduct->getData('listing_id'), $listingProduct->getData('product_id'), $listingProduct->getId(), Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION, $logsActionId, Ess_M2ePro_Model_Listing_Log::ACTION_CHANNEL_CHANGE, $duplicateDeletedMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_WARNING, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
}
示例6: updateProductAfterAction
protected function updateProductAfterAction(Ess_M2ePro_Model_Listing_Product $listingProduct, array $nativeRequestData = array(), array $params = array(), $ebayItemsId = NULL, $saveSoldData = false)
{
$dataForUpdate = array('status' => Ess_M2ePro_Model_Listing_Product::STATUS_LISTED, 'additional_data' => $listingProduct->getAdditionalData());
!empty($nativeRequestData['title']) && ($dataForUpdate['online_title'] = $nativeRequestData['title']);
!empty($nativeRequestData['sku']) && ($dataForUpdate['online_sku'] = $nativeRequestData['sku']);
$dataForUpdate['additional_data']['is_eps_ebay_images_mode'] = $params['is_eps_ebay_images_mode'];
$isImagesUploadError = isset($params['is_images_upload_error']) ? $params['is_images_upload_error'] : false;
if (isset($nativeRequestData['images']['images']) && !$isImagesUploadError) {
$dataForUpdate['additional_data']['ebay_product_images_hash'] = sha1(json_encode($nativeRequestData['images']['images']));
}
!is_null($ebayItemsId) && ($dataForUpdate['ebay_item_id'] = (int) $ebayItemsId);
isset($params['status_changer']) && ($dataForUpdate['status_changer'] = (int) $params['status_changer']);
if (isset($nativeRequestData['category_main_id'])) {
$dataForUpdate['online_category'] = Mage::helper('M2ePro/Component_Ebay_Category_Ebay')->getPath($nativeRequestData['category_main_id'], $listingProduct->getMarketplace()->getId()) . ' (' . $nativeRequestData['category_main_id'] . ')';
}
if (isset($params['start_date_raw'])) {
$dataForUpdate['start_date'] = Ess_M2ePro_Model_Connector_Server_Ebay_Abstract::ebayTimeToString($params['start_date_raw']);
}
if (isset($params['end_date_raw'])) {
$dataForUpdate['end_date'] = Ess_M2ePro_Model_Connector_Server_Ebay_Abstract::ebayTimeToString($params['end_date_raw']);
}
if ($saveSoldData) {
$dataForUpdate['online_qty_sold'] = is_null($listingProduct->getChildObject()->getOnlineQtySold()) ? 0 : $listingProduct->getChildObject()->getOnlineQtySold();
$tempIsVariation = $nativeRequestData['is_variation_item'] && isset($nativeRequestData['variation']);
$tempUpdateFlag = $tempIsVariation || isset($nativeRequestData['qty']);
if ($tempUpdateFlag) {
$tempQty = $tempIsVariation ? $listingProduct->getChildObject()->getQty() : $nativeRequestData['qty'];
$dataForUpdate['online_qty'] = (int) $tempQty + (int) $dataForUpdate['online_qty_sold'];
}
} else {
$dataForUpdate['online_qty_sold'] = 0;
$tempIsVariation = $nativeRequestData['is_variation_item'] && isset($nativeRequestData['variation']);
$tempUpdateFlag = $tempIsVariation || isset($nativeRequestData['qty']);
if ($tempUpdateFlag) {
$tempQty = $tempIsVariation ? $listingProduct->getChildObject()->getQty() : $nativeRequestData['qty'];
$dataForUpdate['online_qty'] = $tempQty;
}
}
if ($listingProduct->getChildObject()->isListingTypeFixed()) {
$dataForUpdate['online_start_price'] = NULL;
$dataForUpdate['online_reserve_price'] = NULL;
$dataForUpdate['online_bids'] = NULL;
$tempIsVariation = $nativeRequestData['is_variation_item'] && isset($nativeRequestData['variation']);
$tempUpdateFlag = $tempIsVariation || isset($nativeRequestData['price_fixed']);
if ($tempUpdateFlag) {
if ($tempIsVariation) {
$tempPrice = NULL;
foreach ($nativeRequestData['variation'] as $variation) {
if ((int) $variation['qty'] <= 0) {
continue;
}
if (!is_null($tempPrice) && (double) $variation['price'] >= $tempPrice) {
continue;
}
$tempPrice = (double) $variation['price'];
}
} else {
$tempPrice = $nativeRequestData['price_fixed'];
}
$dataForUpdate['online_buyitnow_price'] = (double) $tempPrice;
}
} else {
!$saveSoldData && ($dataForUpdate['online_bids'] = 0);
if (isset($nativeRequestData['price_start'])) {
$dataForUpdate['online_start_price'] = (double) $nativeRequestData['price_start'];
}
if (isset($nativeRequestData['price_reserve'])) {
$dataForUpdate['online_reserve_price'] = (double) $nativeRequestData['price_reserve'];
}
if (isset($nativeRequestData['price_buyitnow'])) {
$dataForUpdate['online_buyitnow_price'] = (double) $nativeRequestData['price_buyitnow'];
}
}
$dataForUpdate['additional_data'] = json_encode($dataForUpdate['additional_data']);
$listingProduct->addData($dataForUpdate)->save();
}
示例7: modifyAndLogListingProduct
private function modifyAndLogListingProduct(Ess_M2ePro_Model_Listing_Product $listingProduct, $status, $duplicateItemId = null)
{
$additionalData = $listingProduct->getAdditionalData();
unset($additionalData['last_failed_action_data']);
$listingProduct->addData(array('status' => $status, 'additional_data' => json_encode($additionalData)))->save();
/** @var Ess_M2ePro_Model_Listing_Log $logModel */
$logModel = Mage::getModel('M2ePro/Listing_Log');
$logModel->setComponentMode(Ess_M2ePro_Helper_Component_Ebay::NICK);
$logActionId = $logModel->getNextActionId();
$statusLogMessage = $this->getStatusLogMessage($status);
Mage::log(print_r($listingProduct, true));
$logModel->addProductMessage($listingProduct->getData('listing_id'), $listingProduct->getData('product_id'), $listingProduct->getId(), Ess_M2ePro_Model_Log_Abstract::INITIATOR_EXTENSION, $logActionId, Ess_M2ePro_Model_Listing_Log::ACTION_CHANGE_STATUS_ON_CHANNEL, $statusLogMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
if (is_null($duplicateItemId)) {
return;
}
// ->__('Duplicated item %s was found and stopped on eBay.');
$duplicateDeletedMessage = sprintf('Duplicated item %s was found and stopped on eBay.', $duplicateItemId);
$logModel->addProductMessage($listingProduct->getData('listing_id'), $listingProduct->getData('product_id'), $listingProduct->getId(), Ess_M2ePro_Model_Log_Abstract::INITIATOR_EXTENSION, $logActionId, Ess_M2ePro_Model_Listing_Log::ACTION_CHANGE_STATUS_ON_CHANNEL, $duplicateDeletedMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_WARNING, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
}
示例8: isMeetListRequirements
public function isMeetListRequirements(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
if (!$listingProduct->isNotListed()) {
return false;
}
if (!$listingProduct->isListable()) {
return false;
}
/** @var Ess_M2ePro_Model_Ebay_Listing_Product $ebayListingProduct */
$ebayListingProduct = $listingProduct->getChildObject();
$ebaySynchronizationTemplate = $ebayListingProduct->getEbaySynchronizationTemplate();
if (!$ebaySynchronizationTemplate->isListMode()) {
return false;
}
$additionalData = $listingProduct->getAdditionalData();
if ($ebaySynchronizationTemplate->isScheduleEnabled() && (!$ebaySynchronizationTemplate->isScheduleIntervalNow() || !$ebaySynchronizationTemplate->isScheduleWeekNow())) {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the Schedule Settings in Synchronization Policy.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
}
if (!$ebayListingProduct->isSetCategoryTemplate()) {
return false;
}
$variationResource = Mage::getResourceModel('M2ePro/Listing_Product_Variation');
if ($ebaySynchronizationTemplate->isListStatusEnabled()) {
if (!$listingProduct->getMagentoProduct()->isStatusEnabled()) {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Status of Magento Product is Disabled (%date%) though in Synchronization Rules “Product Status”
is set to Enabled.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
} else {
if ($ebayListingProduct->isVariationsReady()) {
$temp = $variationResource->isAllStatusesDisabled($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Status of Magento Product Variation is Disabled (%date%) though in Synchronization Rules
“Product Status“ is set to Enabled.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
}
}
}
}
if ($ebaySynchronizationTemplate->isListIsInStock()) {
if (!$listingProduct->getMagentoProduct()->isStockAvailability()) {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Stock Availability of Magento Product is Out of Stock though in
Synchronization Rules “Stock Availability” is set to In Stock.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
} else {
if ($ebayListingProduct->isVariationsReady()) {
$temp = $variationResource->isAllDoNotHaveStockAvailabilities($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Stock Availability of Magento Product Variation is Out of Stock though
in Synchronization Rules “Stock Availability” is set to In Stock.', array('date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
$additionalData['synch_template_list_rules_note'] = $note;
$listingProduct->setSettings('additional_data', $additionalData)->save();
return false;
}
}
}
}
if ($ebaySynchronizationTemplate->isListWhenQtyMagentoHasValue()) {
$result = false;
$productQty = (int) $listingProduct->getMagentoProduct()->getQty(true);
$typeQty = (int) $ebaySynchronizationTemplate->getListWhenQtyMagentoHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getListWhenQtyMagentoHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getListWhenQtyMagentoHasValueMax();
$note = '';
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::LIST_QTY_LESS) {
if ($productQty <= $minQty) {
$result = true;
} else {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Quantity of Magento Product is %product_qty% though in Synchronization Rules
“Magento Quantity“ is set to less then %template_min_qty%.', array('!template_min_qty' => $minQty, '!product_qty' => $productQty, '!date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
}
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::LIST_QTY_MORE) {
if ($productQty >= $minQty) {
$result = true;
} else {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Quantity of Magento Product is %product_qty% though in Synchronization Rules
“Magento Quantity” is set to more then %template_min_qty%.', array('!template_min_qty' => $minQty, '!product_qty' => $productQty, '!date' => Mage::helper('M2ePro')->getCurrentGmtDate()));
}
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::LIST_QTY_BETWEEN) {
if ($productQty >= $minQty && $productQty <= $maxQty) {
$result = true;
} else {
$note = Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription('Product was not automatically Listed according to the List Rules in Synchronization Policy.
Quantity of Magento Product is %product_qty% though in Synchronization Rules
//.........这里部分代码省略.........
示例9: 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();
}
//-----------------------------
}