本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Other类的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Other类的具体用法?PHP Ess_M2ePro_Model_Listing_Other怎么用?PHP Ess_M2ePro_Model_Listing_Other使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ess_M2ePro_Model_Listing_Other类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isExistProductAction
public function isExistProductAction(Ess_M2ePro_Model_Listing_Other $listingOtherInstance, $action, array $params = array())
{
$newListingsOtherId = $listingOtherInstance->getId();
$params['status_changer'] = Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_SYNCH;
if (!isset($this->_actionsProducts[$newListingsOtherId])) {
return false;
}
if ($this->_actionsProducts[$newListingsOtherId]['action'] != $action) {
return false;
}
$tempExistItem = $this->_actionsProducts[$newListingsOtherId];
foreach ($params as $tempParamKey => $tempParamValue) {
if (!isset($tempExistItem['params'][$tempParamKey])) {
return false;
}
if (is_array($tempExistItem['params'][$tempParamKey]) && is_array($tempParamValue)) {
foreach ($tempParamValue as $tempParamKeyTwo => $tempParamValueTwo) {
if (!isset($tempExistItem['params'][$tempParamKey][$tempParamKeyTwo])) {
return false;
}
if ($tempExistItem['params'][$tempParamKey][$tempParamKeyTwo] != $tempParamValueTwo) {
return false;
}
}
continue;
}
if ($tempExistItem['params'][$tempParamKey] != $tempParamValue) {
return false;
}
}
return true;
}
示例2: __construct
public function __construct(array $params = array(), Ess_M2ePro_Model_Listing_Other $otherListing)
{
$defaultParams = array('status_changer' => Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_UNKNOWN);
$params = array_merge($defaultParams, $params);
$this->otherListing = $otherListing;
parent::__construct($params, $this->otherListing->getMarketplace(), $this->otherListing->getAccount(), NULL);
}
示例3: logListingOtherMessage
public function logListingOtherMessage(Ess_M2ePro_Model_Listing_Other $listingOther, array $messageData, $priority = Ess_M2ePro_Model_Log_Abstract::PRIORITY_MEDIUM)
{
if ($this->storeMode) {
$this->storedMessages[] = array('type' => $this->initLogType($messageData[Ess_M2ePro_Model_Connector_Protocol::MESSAGE_TYPE_KEY]), 'text' => $messageData[Ess_M2ePro_Model_Connector_Protocol::MESSAGE_TEXT_KEY]);
return;
}
$this->getListingOtherLog()->addProductMessage($listingOther->getId(), $this->initiator, $this->actionId, $this->action, $messageData[Ess_M2ePro_Model_Connector_Protocol::MESSAGE_TEXT_KEY], $this->initLogType($messageData[Ess_M2ePro_Model_Connector_Protocol::MESSAGE_TYPE_KEY]), $priority);
}
示例4: isMeetStopRequirements
private function isMeetStopRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
{
// eBay available status
//--------------------
if (!$listingOther->isListed()) {
return false;
}
if (!$listingOther->isStoppable()) {
return false;
}
if (is_null($listingOther->getProductId())) {
return false;
}
if ($this->_runnerActions->isExistProductAction($listingOther, Ess_M2ePro_Model_Connector_Server_Ebay_Item_Dispatcher::ACTION_STOP, array())) {
return false;
}
//--------------------
// Correct synchronization
//--------------------
if (!$listingOther->getAccount()->getChildObject()->isOtherListingsMappedSynchronizationEnabled()) {
return false;
}
//--------------------
// Check filters
//--------------------
if ($listingOther->getChildObject()->getSynchronizationModel()->isStopStatusDisabled()) {
if ($listingOther->getMagentoProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
return true;
}
}
if ($listingOther->getChildObject()->getSynchronizationModel()->isStopOutOfStock()) {
if (!$listingOther->getMagentoProduct()->getStockAvailability()) {
return true;
}
}
if ($listingOther->getChildObject()->getSynchronizationModel()->isStopWhenQtyHasValue()) {
$productQty = $listingOther->getChildObject()->getMappedQty();
if (!is_null($productQty)) {
/** @var $ebaySynchronizationTemplate Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization */
$ebaySynchronizationTemplate = $listingOther->getChildObject()->getSynchronizationModel();
$typeQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMax();
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_LESS && $productQty <= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_MORE && $productQty >= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
return true;
}
}
}
//--------------------
return false;
}
示例5: isMeetStopRequirements
private function isMeetStopRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
{
// eBay available status
//--------------------
if (!$listingOther->isListed()) {
return false;
}
if (!$listingOther->isStoppable()) {
return false;
}
if (is_null($listingOther->getProductId())) {
return false;
}
if ($this->getRunner()->isExistProduct($listingOther, Ess_M2ePro_Model_Listing_Product::ACTION_STOP, array())) {
return false;
}
//--------------------
/** @var $ebaySynchronizationTemplate Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization */
$ebaySynchronizationTemplate = $listingOther->getChildObject()->getSynchronizationModel();
// Correct synchronization
//--------------------
if (!$ebaySynchronizationTemplate->isMode()) {
return false;
}
//--------------------
// Check filters
//--------------------
if ($ebaySynchronizationTemplate->isStopStatusDisabled()) {
if (!$listingOther->getMagentoProduct()->isStatusEnabled()) {
return true;
}
}
if ($ebaySynchronizationTemplate->isStopOutOfStock()) {
if (!$listingOther->getMagentoProduct()->isStockAvailability()) {
return true;
}
}
if ($ebaySynchronizationTemplate->isStopWhenQtyHasValue()) {
$productQty = $listingOther->getChildObject()->getMappedQty();
if (!is_null($productQty)) {
$typeQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMax();
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_LESS && $productQty <= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_MORE && $productQty >= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
return true;
}
}
}
//--------------------
return false;
}
示例6: __construct
public function __construct(array $params = array(), Ess_M2ePro_Model_Listing_Other $otherListing)
{
$defaultParams = array('status_changer' => Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_UNKNOWN);
$params = array_merge($defaultParams, $params);
if (isset($params['logs_action_id'])) {
$this->logsActionId = (int) $params['logs_action_id'];
unset($params['logs_action_id']);
} else {
$this->logsActionId = Mage::getModel('M2ePro/Listing_Other_Log')->getNextActionId();
}
$this->otherListing = $otherListing;
parent::__construct($params, $this->otherListing->getMarketplace(), $this->otherListing->getAccount(), NULL);
}
示例7: setMarketplaceByOtherListingProduct
protected function setMarketplaceByOtherListingProduct(Ess_M2ePro_Model_Listing_Other $otherListing)
{
if (!is_null($this->marketplace) && $this->marketplace->getId() == $otherListing->getMarketplaceId()) {
return;
}
$this->marketplace = Mage::helper('M2ePro/Component_Amazon')->getObject('Marketplace', $otherListing->getMarketplaceId());
}
示例8: setAccountByOtherListingProduct
protected function setAccountByOtherListingProduct(Ess_M2ePro_Model_Listing_Other $otherListing)
{
if (!is_null($this->account) && $this->account->getId() == $otherListing->getAccountId()) {
return;
}
$this->account = Mage::helper('M2ePro/Component_Buy')->getCachedObject('Account', $otherListing->getAccountId());
$this->mappingSettings = NULL;
}
示例9: addProductFromOther
public function addProductFromOther(Ess_M2ePro_Model_Listing_Other $listingOtherProduct, $checkingMode = false, $checkHasProduct = true)
{
if (!$listingOtherProduct->getProductId()) {
return false;
}
$productId = $listingOtherProduct->getProductId();
$result = $this->getParentObject()->addProduct($productId, $checkingMode, $checkHasProduct);
if ($checkingMode) {
return $result;
}
if (!$result instanceof Ess_M2ePro_Model_Listing_Product) {
return false;
}
$listingProduct = $result;
$listingProduct->getChildObject()->getBuyItem()->setData('store_id', $this->getParentObject()->getStoreId())->save();
$dataForUpdate = array('general_id' => $listingOtherProduct->getChildObject()->getGeneralId(), 'sku' => $listingOtherProduct->getChildObject()->getSku(), 'online_price' => $listingOtherProduct->getChildObject()->getOnlinePrice(), 'online_qty' => $listingOtherProduct->getChildObject()->getOnlineQty(), 'condition' => $listingOtherProduct->getChildObject()->getCondition(), 'condition_note' => $listingOtherProduct->getChildObject()->getConditionNote(), 'shipping_standard_rate' => $listingOtherProduct->getChildObject()->getShippingStandardRate(), 'shipping_expedited_mode' => $listingOtherProduct->getChildObject()->getShippingExpeditedMode(), 'shipping_expedited_rate' => $listingOtherProduct->getChildObject()->getShippingExpeditedRate(), 'status' => $listingOtherProduct->getStatus(), 'status_changer' => $listingOtherProduct->getStatusChanger());
$listingProduct->addData($dataForUpdate)->save();
return $listingProduct;
}
示例10: isMeetRelistRequirements
private function isMeetRelistRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
{
// eBay available status
//--------------------
if ($listingOther->isListed()) {
return false;
}
if (!$listingOther->isRelistable()) {
return false;
}
if (is_null($listingOther->getProductId())) {
return false;
}
if ($this->_runnerActions->isExistProductAction($listingOther, Ess_M2ePro_Model_Connector_Ebay_Item_Dispatcher::ACTION_RELIST, array())) {
return false;
}
//--------------------
// Correct synchronization
//--------------------
if (!$listingOther->getAccount()->getChildObject()->isOtherListingsMappedSynchronizationEnabled()) {
return false;
}
if (!$listingOther->getChildObject()->getSynchronizationModel()->isRelistMode()) {
return false;
}
if ($listingOther->getChildObject()->getSynchronizationModel()->isRelistFilterUserLock() && $listingOther->getStatusChanger() == Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_USER) {
return false;
}
//--------------------
// Check filters
//--------------------
if ($listingOther->getChildObject()->getSynchronizationModel()->isRelistStatusEnabled()) {
if ($listingOther->getMagentoProduct()->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
return false;
}
}
if ($listingOther->getChildObject()->getSynchronizationModel()->isRelistIsInStock()) {
if (!$listingOther->getMagentoProduct()->getStockAvailability()) {
return false;
}
}
if ($listingOther->getChildObject()->getSynchronizationModel()->isRelistWhenQtyHasValue()) {
$productQty = $listingOther->getChildObject()->getMappedQty();
if (!is_null($productQty)) {
$result = false;
/** @var $ebaySynchronizationTemplate Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization */
$ebaySynchronizationTemplate = $listingOther->getChildObject()->getSynchronizationModel();
$typeQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueMax();
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_LESS && $productQty <= $minQty) {
$result = true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_MORE && $productQty >= $minQty) {
$result = true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
$result = true;
}
if (!$result) {
return false;
}
}
}
//--------------------
return true;
}
示例11: addProductFromOther
/**
* @param Ess_M2ePro_Model_Listing_Other $listingOtherProduct
* @param bool $checkingMode
* @param bool $checkHasProduct
* @return bool|Ess_M2ePro_Model_Listing_Product
* @throws Ess_M2ePro_Model_Exception_Logic
*/
public function addProductFromOther(Ess_M2ePro_Model_Listing_Other $listingOtherProduct, $checkingMode = false, $checkHasProduct = true)
{
if (!$listingOtherProduct->getProductId()) {
return false;
}
$productId = $listingOtherProduct->getProductId();
$result = $this->getParentObject()->addProduct($productId, $checkingMode, $checkHasProduct);
if ($checkingMode) {
return $result;
}
if (!$result instanceof Ess_M2ePro_Model_Listing_Product) {
return false;
}
$listingProduct = $result;
/** @var Ess_M2ePro_Model_Amazon_Listing_Product $amazonListingProduct */
$amazonListingProduct = $listingProduct->getChildObject();
$variationManager = $amazonListingProduct->getVariationManager();
if ($variationManager->isRelationParentType()) {
$variationManager->switchModeToAnother();
}
$amazonListingProduct->getAmazonItem()->setData('store_id', $this->getParentObject()->getStoreId())->save();
/** @var Ess_M2ePro_Model_Amazon_Listing_Other $amazonListingOther */
$amazonListingOther = $listingOtherProduct->getChildObject();
$dataForUpdate = array('general_id' => $amazonListingOther->getGeneralId(), 'sku' => $amazonListingOther->getSku(), 'online_price' => $amazonListingOther->getOnlinePrice(), 'online_qty' => $amazonListingOther->getOnlineQty(), 'is_afn_channel' => (int) $amazonListingOther->isAfnChannel(), 'is_isbn_general_id' => (int) $amazonListingOther->isIsbnGeneralId(), 'status' => $listingOtherProduct->getStatus(), 'status_changer' => $listingOtherProduct->getStatusChanger());
$listingProduct->addData($dataForUpdate)->save();
return $listingProduct;
}
示例12: addProductFromOther
public function addProductFromOther(Ess_M2ePro_Model_Listing_Other $listingOtherProduct)
{
if (!$listingOtherProduct->getProductId()) {
return false;
}
$productId = $listingOtherProduct->getProductId();
$listingProduct = $this->getParentObject()->addProduct($productId);
if (!$listingProduct instanceof Ess_M2ePro_Model_Listing_Product) {
return false;
}
$listingProduct->getChildObject()->getAmazonItem()->setData('store_id', $this->getParentObject()->getStoreId())->save();
$dataForUpdate = array('general_id' => $listingOtherProduct->getChildObject()->getGeneralId(), 'sku' => $listingOtherProduct->getChildObject()->getSku(), 'online_price' => $listingOtherProduct->getChildObject()->getOnlinePrice(), 'online_qty' => $listingOtherProduct->getChildObject()->getOnlineQty(), 'is_afn_channel' => (int) $listingOtherProduct->getChildObject()->isAfnChannel(), 'is_isbn_general_id' => (int) $listingOtherProduct->getChildObject()->isIsbnGeneralId(), 'start_date' => $listingOtherProduct->getChildObject()->getStartDate(), 'end_date' => $listingOtherProduct->getChildObject()->getEndDate(), 'status' => $listingOtherProduct->getStatus(), 'status_changer' => $listingOtherProduct->getStatusChanger());
$listingProduct->addData($dataForUpdate)->save();
return $listingProduct;
}
示例13: inspectRevisePriceRequirements
private function inspectRevisePriceRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
{
// Prepare actions params
//--------------------
$actionParams = array('only_data' => array('price' => true));
//--------------------
// eBay available status
//--------------------
if (!$listingOther->isListed()) {
return false;
}
if (!$listingOther->isRevisable()) {
return false;
}
if (is_null($listingOther->getProductId())) {
return false;
}
if ($this->getRunner()->isExistProduct($listingOther, Ess_M2ePro_Model_Listing_Product::ACTION_REVISE, $actionParams)) {
return false;
}
//--------------------
/* @var $ebaySynchronizationTemplate Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization */
$ebaySynchronizationTemplate = $listingOther->getChildObject()->getSynchronizationModel();
// Correct synchronization
//--------------------
if (!$ebaySynchronizationTemplate->isMode()) {
return false;
}
if (!$ebaySynchronizationTemplate->isReviseWhenChangePrice()) {
return false;
}
//--------------------
// Check filters
//--------------------
$ebayListingOther = $listingOther->getChildObject();
$currentPrice = $ebayListingOther->getMappedPrice();
if (is_null($currentPrice)) {
return false;
}
$onlinePrice = $ebayListingOther->getOnlinePrice();
if ($currentPrice != $onlinePrice) {
$this->getRunner()->addProduct($listingOther, Ess_M2ePro_Model_Listing_Product::ACTION_REVISE, $actionParams);
return true;
}
//--------------------
return false;
}
示例14: logOtherListingMessage
private function logOtherListingMessage(Ess_M2ePro_Model_Listing_Other $otherListing, $action, $oldValue, $newValue, $messagePostfix = '')
{
// M2ePro_TRANSLATIONS
// From [%from%] to [%to%].
$log = Mage::getModel('M2ePro/Listing_Other_Log');
$log->setComponentMode($otherListing->getComponentMode());
$oldValue = strlen($oldValue) > 150 ? substr($oldValue, 0, 150) . ' ...' : $oldValue;
$newValue = strlen($newValue) > 150 ? substr($newValue, 0, 150) . ' ...' : $newValue;
$messagePostfix = trim(trim($messagePostfix), '.');
if (!empty($messagePostfix)) {
$messagePostfix = ' ' . $messagePostfix;
}
$log->addProductMessage($otherListing->getId(), Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION, NULL, $action, Mage::getModel('M2ePro/Log_Abstract')->encodeDescription('From [%from%] to [%to%]' . $messagePostfix . '.', array('!from' => $oldValue, '!to' => $newValue)), Ess_M2ePro_Model_Log_Abstract::TYPE_NOTICE, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
}
示例15: modifyAndLogListingOther
private function modifyAndLogListingOther(Ess_M2ePro_Model_Listing_Other $listingOther, $status, $duplicateItemId = null)
{
/** @var Ess_M2ePro_Model_Listing_Other_Log $logModel */
$logModel = Mage::getModel('M2ePro/Listing_Other_Log');
$logModel->setComponentMode(Ess_M2ePro_Helper_Component_Ebay::NICK);
$logActionId = $logModel->getNextActionId();
$statusLogMessage = $this->getStatusLogMessage($listingOther->getStatus(), $status);
$logModel->addProductMessage($listingOther->getId(), Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION, $logActionId, Ess_M2ePro_Model_Listing_Other_Log::ACTION_CHANNEL_CHANGE, $statusLogMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
$additionalData = $listingOther->getAdditionalData();
unset($additionalData['last_failed_action_data']);
$listingOther->addData(array('status' => $status, 'additional_data' => json_encode($additionalData)))->save();
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($listingOther->getId(), Ess_M2ePro_Helper_Data::INITIATOR_EXTENSION, $logActionId, Ess_M2ePro_Model_Listing_Other_Log::ACTION_CHANNEL_CHANGE, $duplicateDeletedMessage, Ess_M2ePro_Model_Log_Abstract::TYPE_WARNING, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
}