本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Product::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Product::getStatus方法的具体用法?PHP Ess_M2ePro_Model_Listing_Product::getStatus怎么用?PHP Ess_M2ePro_Model_Listing_Product::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Listing_Product
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Listing_Product::getStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductStatusChanges
private function getProductStatusChanges(Ess_M2ePro_Model_Listing_Product $listingProduct, array $change)
{
$data = array();
$qty = (int) $change['quantity'] < 0 ? 0 : (int) $change['quantity'];
$qtySold = (int) $change['quantitySold'] < 0 ? 0 : (int) $change['quantitySold'];
if (($change['listingStatus'] == self::EBAY_STATUS_COMPLETED || $change['listingStatus'] == self::EBAY_STATUS_ENDED) && $qty == $qtySold) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_SOLD;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_COMPLETED) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ENDED) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_FINISHED;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE && $qty - $qtySold <= 0) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_HIDDEN;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_LISTED;
}
}
}
}
}
if ($listingProduct->getStatus() == $data['status']) {
return $data;
}
$data['status_changer'] = Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_COMPONENT;
$statusChangedFrom = Mage::helper('M2ePro/Component_Ebay')->getHumanTitleByListingProductStatus($listingProduct->getStatus());
$statusChangedTo = Mage::helper('M2ePro/Component_Ebay')->getHumanTitleByListingProductStatus($data['status']);
if (!empty($statusChangedFrom) && !empty($statusChangedTo)) {
// M2ePro_TRANSLATIONS
// Item Status was successfully changed from "%from%" to "%to%" .
$this->logReportChange($listingProduct, Mage::helper('M2ePro')->__('Item Status was successfully changed from "%from%" to "%to%" .', $statusChangedFrom, $statusChangedTo));
}
Mage::getModel('M2ePro/ProductChange')->addUpdateAction($listingProduct->getProductId(), Ess_M2ePro_Model_ProductChange::INITIATOR_SYNCHRONIZATION);
return $data;
}
示例2: getProductStatusChanges
private function getProductStatusChanges(Ess_M2ePro_Model_Listing_Product $listingProduct, array $change)
{
$data = array();
$qty = (int) $change['quantity'] < 0 ? 0 : (int) $change['quantity'];
$qtySold = (int) $change['quantitySold'] < 0 ? 0 : (int) $change['quantitySold'];
if (($change['listingStatus'] == self::EBAY_STATUS_COMPLETED || $change['listingStatus'] == self::EBAY_STATUS_ENDED) && $qty == $qtySold) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_SOLD;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_COMPLETED) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ENDED) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_FINISHED;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE && $qty - $qtySold <= 0) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_HIDDEN;
} else {
if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE) {
$data['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_LISTED;
}
}
}
}
}
if ($listingProduct->getStatus() == $data['status']) {
return $data;
}
Mage::getModel('M2ePro/ProductChange')->addUpdateAction($listingProduct->getProductId(), Ess_M2ePro_Model_ProductChange::INITIATOR_SYNCHRONIZATION);
$data['status_changer'] = Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_COMPONENT;
$this->logChangeOfStatus($listingProduct, $data['status']);
return $data;
}
示例3: prepareChangedListingsProducts
private function prepareChangedListingsProducts(Ess_M2ePro_Model_Listing_Product $tempListingProductModel, $ebayChange)
{
/** @var $tempEbayListingProductModel Ess_M2ePro_Model_Ebay_Listing_Product */
$tempEbayListingProductModel = $tempListingProductModel->getChildObject();
// Prepare eBay changes values
//--------------------------
$tempEbayChanges = array();
if ($tempEbayListingProductModel->isListingTypeAuction()) {
$tempEbayChanges['online_start_price'] = (double) $ebayChange['currentPrice'] < 0 ? 0 : (double) $ebayChange['currentPrice'];
}
if ($tempEbayListingProductModel->isListingTypeFixed()) {
$tempEbayChanges['online_buyitnow_price'] = (double) $ebayChange['currentPrice'] < 0 ? 0 : (double) $ebayChange['currentPrice'];
}
$tempEbayChanges['online_qty'] = (int) $ebayChange['quantity'] < 0 ? 0 : (int) $ebayChange['quantity'];
$tempEbayChanges['online_qty_sold'] = (int) $ebayChange['quantitySold'] < 0 ? 0 : (int) $ebayChange['quantitySold'];
if ($tempEbayListingProductModel->isListingTypeAuction()) {
$tempEbayChanges['online_qty'] = 1;
$tempEbayChanges['online_bids'] = (int) $ebayChange['bidCount'] < 0 ? 0 : (int) $ebayChange['bidCount'];
}
$tempEbayChanges['start_date'] = Ess_M2ePro_Model_Connector_Ebay_Abstract::ebayTimeToString($ebayChange['startTime']);
$tempEbayChanges['end_date'] = Ess_M2ePro_Model_Connector_Ebay_Abstract::ebayTimeToString($ebayChange['endTime']);
if ($tempEbayChanges['online_qty'] == $tempEbayChanges['online_qty_sold'] && ($ebayChange['listingStatus'] == self::EBAY_STATUS_COMPLETED || $ebayChange['listingStatus'] == self::EBAY_STATUS_ENDED)) {
$tempEbayChanges['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_SOLD;
} else {
if ($ebayChange['listingStatus'] == self::EBAY_STATUS_COMPLETED) {
$tempEbayChanges['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED;
} else {
if ($ebayChange['listingStatus'] == self::EBAY_STATUS_ENDED) {
$tempEbayChanges['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_FINISHED;
} else {
if ($ebayChange['listingStatus'] == self::EBAY_STATUS_ACTIVE) {
$tempEbayChanges['status'] = Ess_M2ePro_Model_Listing_Product::STATUS_LISTED;
}
}
}
}
if ($tempListingProductModel->getStatus() != $tempEbayChanges['status'] || $tempListingProductModel->getChildObject()->getOnlineQty() != $tempEbayChanges['online_qty'] || $tempListingProductModel->getChildObject()->getOnlineQtySold() != $tempEbayChanges['online_qty_sold']) {
Mage::getModel('M2ePro/ProductChange')->addUpdateAction($tempListingProductModel->getProductId(), Ess_M2ePro_Model_ProductChange::CREATOR_TYPE_SYNCHRONIZATION);
}
if ($tempEbayChanges['status'] != $tempListingProductModel->getStatus()) {
$tempEbayChanges['status_changer'] = Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_COMPONENT;
$tempLogMessage = '';
switch ($tempEbayChanges['status']) {
case Ess_M2ePro_Model_Listing_Product::STATUS_LISTED:
// Parser hack -> Mage::helper('M2ePro')->__('Item status was successfully changed to "Listed".');
$tempLogMessage = 'Item status was successfully changed to "Listed".';
break;
case Ess_M2ePro_Model_Listing_Product::STATUS_SOLD:
// Parser hack -> Mage::helper('M2ePro')->__('Item status was successfully changed to "Sold".');
$tempLogMessage = 'Item status was successfully changed to "Sold".';
break;
case Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED:
// Parser hack -> Mage::helper('M2ePro')->__('Item status was successfully changed to "Stopped".');
$tempLogMessage = 'Item status was successfully changed to "Stopped".';
break;
case Ess_M2ePro_Model_Listing_Product::STATUS_FINISHED:
// Parser hack -> Mage::helper('M2ePro')->__('Item status was successfully changed to "Finished".');
$tempLogMessage = 'Item status was successfully changed to "Finished".';
break;
}
$tempLog = Mage::getModel('M2ePro/Listing_Log');
$tempLog->setComponentMode(Ess_M2ePro_Helper_Component_Ebay::NICK);
$tempLog->addProductMessage($tempListingProductModel->getListingId(), $tempListingProductModel->getProductId(), $tempListingProductModel->getId(), Ess_M2ePro_Model_Log_Abstract::INITIATOR_EXTENSION, $this->getLogActionId(), Ess_M2ePro_Model_Listing_Log::ACTION_CHANGE_STATUS_ON_CHANNEL, $tempLogMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
}
//--------------------------
// Create changed listings products
//--------------------------
$changedListingsProducts = array('ebay_item_id' => $ebayChange['id'], 'listing_product' => array('instance' => $tempListingProductModel, 'changes' => $tempEbayChanges), 'listings_products_variations' => array());
//--------------------------
// Cancel when have not eBay variations
//--------------------------
if (!isset($ebayChange['variations']) || is_null($ebayChange['variations'])) {
return $changedListingsProducts;
}
//--------------------------
// Get listings products variations
//-----------------------
$tempVariations = $tempListingProductModel->getVariations(true);
if (count($tempVariations) == 0) {
return $changedListingsProducts;
}
//-----------------------
// Get listings products variations with options
//-----------------------
$tempVariationsWithOptions = array();
foreach ($tempVariations as $variation) {
/** @var $variation Ess_M2ePro_Model_Listing_Product_Variation */
$options = $variation->getOptions(true);
if (count($options) == 0) {
continue;
}
$tempVariationsWithOptions[] = array('variation' => $variation, 'options' => $options);
}
if (count($tempVariationsWithOptions) == 0) {
return $changedListingsProducts;
}
//-----------------------
// Search our variations for eBay variations
//--------------------------
foreach ($ebayChange['variations'] as $ebayVariation) {
//.........这里部分代码省略.........
示例4: 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);
}