本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Product::getListing方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Product::getListing方法的具体用法?PHP Ess_M2ePro_Model_Listing_Product::getListing怎么用?PHP Ess_M2ePro_Model_Listing_Product::getListing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Listing_Product
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Listing_Product::getListing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runManual
public function runManual(Ess_M2ePro_Model_Listing_Product $listingProduct, $query, Ess_M2ePro_Model_Marketplace $marketplace = NULL, Ess_M2ePro_Model_Account $account = NULL)
{
if (!$listingProduct->isNotListed() || empty($query)) {
return false;
}
$params = array('listing_product' => $listingProduct, 'query' => $query);
if (is_null($marketplace)) {
$marketplace = $listingProduct->getListing()->getMarketplace();
}
if (is_null($account)) {
$account = $listingProduct->getListing()->getAccount();
}
try {
$dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Amazon_Dispatcher');
$dispatcherObject->processConnector('search', 'manual', 'requester', $params, $marketplace, $account, 'Ess_M2ePro_Model_Amazon');
} catch (Exception $exception) {
Mage::helper('M2ePro/Module_Exception')->process($exception);
return false;
}
$result = Mage::helper('M2ePro/Data_Global')->getValue('temp_amazon_manual_search_asin_result');
Mage::helper('M2ePro/Data_Global')->unsetValue('temp_amazon_manual_search_asin_result');
if (!is_array($result)) {
return array();
}
return $result;
}
示例2: setLocks
public function setLocks($hash)
{
$this->listingProduct->addObjectLock(NULL, $hash);
$this->listingProduct->addObjectLock('in_action', $hash);
$this->listingProduct->addObjectLock('search_action', $hash);
$this->listingProduct->getListing()->addObjectLock(NULL, $hash);
$this->listingProduct->getListing()->addObjectLock('products_in_action', $hash);
$this->listingProduct->getListing()->addObjectLock('products_search_action', $hash);
$this->account->addObjectLock('products_in_action', $hash);
$this->account->addObjectLock('products_search_action', $hash);
$this->marketplace->addObjectLock('products_in_action', $hash);
$this->marketplace->addObjectLock('products_search_action', $hash);
$processingStatus = Ess_M2ePro_Model_Amazon_Listing_Product::GENERAL_ID_SEARCH_STATUS_PROCESSING;
$this->listingProduct->getChildObject()->setData('general_id_search_status', $processingStatus)->save();
}
示例3: getQueryParam
private function getQueryParam(Ess_M2ePro_Model_Listing_Product $listingProduct, $step)
{
$validation = Mage::helper('M2ePro');
switch ($step) {
case self::STEP_ASIN_ISBN:
$query = $listingProduct->getChildObject()->getGeneralId();
empty($query) && ($query = $listingProduct->getChildObject()->getAddingGeneralId());
if (!Mage::helper('M2ePro/Component_Amazon')->isASIN($query) && !$validation->isISBN($query)) {
$query = false;
}
break;
case self::STEP_UPC_EAN:
$query = $listingProduct->getChildObject()->getWorldwideId();
empty($query) && ($query = $listingProduct->getChildObject()->getAddingWorldwideId());
if (!$validation->isEAN($query) && !$validation->isUPC($query)) {
$query = false;
}
break;
case self::STEP_MAGENTO_TITLE:
$query = false;
if ($listingProduct->getListing()->getChildObject()->isSearchByMagentoTitleModeEnabled()) {
$query = $listingProduct->getChildObject()->getActualMagentoProduct()->getName();
}
break;
default:
throw new Exception('Step is out of knowledge base.');
}
return $query;
}
示例4: getSearchType
private function getSearchType()
{
/* @var $listing Ess_M2ePro_Model_Buy_Listing */
$listing = $this->listingProduct->getListing()->getChildObject();
$searchType = false;
if ($listing->isGeneralIdGeneralIdMode()) {
$searchType = 'sku';
}
return $searchType;
}
示例5: getSearchMethod
private function getSearchMethod(Ess_M2ePro_Model_Listing_Product $listingProduct, $step)
{
/** @var $listing Ess_M2ePro_Model_Play_Listing */
$listing = $listingProduct->getListing()->getChildObject();
if ($step == self::STEP_GENERAL_ID) {
if ($listing->isGeneralIdWorldwideMode() || $listing->isGeneralIdIsbnMode()) {
return 'byEanIsbn';
}
}
return 'byQuery';
}
示例6: getSearchType
private function getSearchType()
{
/* @var $listing Ess_M2ePro_Model_Buy_Listing */
$listing = $this->listingProduct->getListing()->getChildObject();
$searchType = false;
if ($listing->isGeneralIdGeneralIdMode()) {
$searchType = Ess_M2ePro_Model_Connector_Buy_Search_ByIdentifier_ItemsRequester::SEARCH_TYPE_GENERAL_ID;
}
if ($listing->isGeneralIdWorldwideMode()) {
$searchType = Ess_M2ePro_Model_Connector_Buy_Search_ByIdentifier_ItemsRequester::SEARCH_TYPE_UPC;
}
return $searchType;
}
示例7: getRequestData
public function getRequestData()
{
/** @var $listing Ess_M2ePro_Model_Buy_Listing */
$listing = $this->listingProduct->getListing()->getChildObject();
$searchType = false;
if ($listing->isGeneralIdGeneralIdMode()) {
$searchType = Ess_M2ePro_Model_Connector_Server_Buy_Search_Items::SEARCH_TYPE_GENERAL_ID;
}
if ($listing->isGeneralIdWorldwideMode()) {
$searchType = Ess_M2ePro_Model_Connector_Server_Buy_Search_Items::SEARCH_TYPE_UPC;
}
return $searchType ? array('search_type' => $searchType) : array();
}
示例8: unsetLocks
public function unsetLocks($hash, $fail = false, $message = NULL)
{
if (!$this->unsetProcessingLock) {
return;
}
$this->listingProduct->deleteObjectLocks(NULL, $hash);
$this->listingProduct->deleteObjectLocks('in_action', $hash);
$this->listingProduct->deleteObjectLocks('search_action', $hash);
$this->listingProduct->getListing()->deleteObjectLocks(NULL, $hash);
$this->listingProduct->getListing()->deleteObjectLocks('products_in_action', $hash);
$this->listingProduct->getListing()->deleteObjectLocks('products_search_action', $hash);
$this->getAccount()->deleteObjectLocks('products_in_action', $hash);
$this->getAccount()->deleteObjectLocks('products_search_action', $hash);
$this->getMarketplace()->deleteObjectLocks('products_in_action', $hash);
$this->getMarketplace()->deleteObjectLocks('products_search_action', $hash);
$processingStatus = Ess_M2ePro_Model_Amazon_Listing_Product::GENERAL_ID_SEARCH_STATUS_NONE;
$this->listingProduct->getChildObject()->setData('general_id_search_status', $processingStatus)->save();
if ($fail) {
$logModel = Mage::getModel('M2ePro/Listing_Log');
$logModel->setComponentMode(Ess_M2ePro_Helper_Component_Amazon::NICK);
$logModel->addListingMessage($this->listingProduct->getListingId(), Ess_M2ePro_Model_Log_Abstract::INITIATOR_UNKNOWN, NULL, Ess_M2ePro_Model_Listing_Log::ACTION_UNKNOWN, $message, Ess_M2ePro_Model_Log_Abstract::TYPE_ERROR, Ess_M2ePro_Model_Log_Abstract::PRIORITY_HIGH);
}
}
示例9: calculateCurrentData
private function calculateCurrentData()
{
if (!empty($this->currentQuery) || $this->currentStep > self::STEP_MAGENTO_TITLE) {
return;
}
switch ($this->currentStep) {
case self::STEP_UPC_EAN:
$tempQuery = $this->listingProduct->getChildObject()->getWorldwideId();
empty($tempQuery) && ($tempQuery = $this->listingProduct->getChildObject()->getAddingWorldwideId());
!empty($tempQuery) && ($this->currentStep = self::STEP_UPC_EAN);
!empty($tempQuery) && ($this->currentQuery = (string) $tempQuery);
break;
case self::STEP_MAGENTO_TITLE:
$tempQuery = '';
if ($this->listingProduct->getListing()->getChildObject()->isSearchByMagentoTitleModeEnabled()) {
$tempQuery = $this->listingProduct->getChildObject()->getActualMagentoProduct()->getName();
}
!empty($tempQuery) && ($this->currentStep = self::STEP_MAGENTO_TITLE);
!empty($tempQuery) && ($this->currentQuery = (string) $tempQuery);
break;
}
empty($this->currentQuery) && $this->currentStep++;
$this->calculateCurrentData();
}
示例10: getRequestData
public function getRequestData(Ess_M2ePro_Model_Listing_Product $listingProduct, array &$requestData)
{
$requestData['shipping'] = array();
/** @var $shippingTemplate Ess_M2ePro_Model_Ebay_Template_Shipping */
$shippingTemplate = $listingProduct->getChildObject()->getShippingTemplate();
$shippingTemplate->setMagentoProduct($listingProduct->getMagentoProduct());
$accountId = $listingProduct->getListing()->getAccountId();
$this->addLocalShippingData($shippingTemplate, $accountId, $requestData);
$this->addInternationalShippingData($shippingTemplate, $accountId, $requestData);
$this->addGlobalShippingProgramData($shippingTemplate, $requestData);
$this->addExcludedLocationsData($shippingTemplate, $requestData);
if ($shippingTemplate->isLocalShippingFlatEnabled() && $shippingTemplate->isLocalShippingRateTableEnabled() && !$shippingTemplate->isInternationalShippingCalculatedEnabled() && !isset($requestData['shipping']['calculated'])) {
$calculatedData = $this->getCalculatedData($shippingTemplate, $listingProduct);
unset($calculatedData['package_size']);
unset($calculatedData['originating_postal_code']);
unset($calculatedData['dimensions']);
$requestData['shipping']['calculated'] = $calculatedData;
}
$this->addAdditionalData($shippingTemplate, $requestData);
$this->addLocationData($shippingTemplate, $requestData);
$this->addInternationalTradeData($shippingTemplate, $requestData);
}
示例11: linkItem
private function linkItem(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
$data = array('general_id' => $listingProduct->getData('general_id'), 'sku' => $listingProduct->getData('sku'), 'status' => Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED);
$listingProduct->addData($data)->save();
$dataForAdd = array('account_id' => $listingProduct->getListing()->getAccountId(), 'marketplace_id' => $listingProduct->getListing()->getMarketplaceId(), 'sku' => $listingProduct->getData('sku'), 'product_id' => $listingProduct->getProductId(), 'store_id' => $listingProduct->getListing()->getStoreId());
if ($listingProduct->getChildObject()->isVariationsReady()) {
$variations = $listingProduct->getVariations(true);
/* @var $variation Ess_M2ePro_Model_Listing_Product_Variation */
$variation = reset($variations);
$options = $variation->getOptions();
$dataForAdd['variation_options'] = array();
foreach ($options as $optionData) {
$dataForAdd['variation_options'][$optionData['attribute']] = $optionData['option'];
}
$dataForAdd['variation_options'] = json_encode($dataForAdd['variation_options']);
}
Mage::getModel('M2ePro/Buy_Item')->setData($dataForAdd)->save();
$message = Mage::helper('M2ePro')->__('The product was found in your Rakuten.com inventory and linked by Reference ID.');
$this->addListingsProductsLogsMessage($listingProduct, $message, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_MEDIUM);
}
示例12: 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();
}
示例13: linkItem
private function linkItem(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
$data = array('general_id' => $listingProduct->getData('general_id'), 'is_isbn_general_id' => Mage::helper('M2ePro')->isISBN($listingProduct->getData('general_id')), 'sku' => $listingProduct->getData('sku'), 'status' => Ess_M2ePro_Model_Listing_Product::STATUS_STOPPED);
$listingProduct->addData($data)->save();
$dataForAdd = array('account_id' => $listingProduct->getListing()->getAccountId(), 'marketplace_id' => $listingProduct->getListing()->getMarketplaceId(), 'sku' => $listingProduct->getData('sku'), 'product_id' => $listingProduct->getProductId(), 'store_id' => $listingProduct->getListing()->getStoreId());
Mage::getModel('M2ePro/Amazon_Item')->setData($dataForAdd)->save();
$message = Mage::helper('M2ePro')->__('The product was found in your Amazon inventory and linked by SKU.');
$this->addListingsProductsLogsMessage($listingProduct, $message, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_MEDIUM);
}
示例14: addNotFoundAttributesMessage
public function addNotFoundAttributesMessage(Ess_M2ePro_Model_Listing_Product $listingProduct, $optionTitle, array $attributesCodes)
{
$attributesTitles = array();
foreach ($attributesCodes as $attributeCode) {
$attributesTitles[] = Mage::helper('M2ePro/Magento_Attribute')->getAttributeLabel($attributeCode, $listingProduct->getListing()->getStoreId());
}
$message = Mage::helper('M2ePro')->__('%s: attribute(s) %s were not found in this product and its value was not sent.', $optionTitle, implode(',', $attributesTitles));
$listingProduct->addAdditionalWarningMessage($message);
}
示例15: isMeetStopRequirements
/**
* @param Ess_M2ePro_Model_Listing_Product $listingProduct
* @return bool
* @throws Ess_M2ePro_Model_Exception_Logic
*/
public function isMeetStopRequirements(Ess_M2ePro_Model_Listing_Product $listingProduct)
{
if (!$listingProduct->isListed()) {
return false;
}
if (!$listingProduct->isStoppable() || $listingProduct->isHidden()) {
return false;
}
/** @var Ess_M2ePro_Model_Ebay_Listing_Product $ebayListingProduct */
$ebayListingProduct = $listingProduct->getChildObject();
$ebaySynchronizationTemplate = $ebayListingProduct->getEbaySynchronizationTemplate();
if (!$ebayListingProduct->isSetCategoryTemplate()) {
return false;
}
$variationResource = Mage::getResourceModel('M2ePro/Listing_Product_Variation');
if ($ebaySynchronizationTemplate->isStopStatusDisabled()) {
if (!$listingProduct->getMagentoProduct()->isStatusEnabled()) {
return true;
} else {
if ($ebayListingProduct->isVariationsReady()) {
$temp = $variationResource->isAllStatusesDisabled($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
return true;
}
}
}
}
if ($ebaySynchronizationTemplate->isStopOutOfStock()) {
if (!$listingProduct->getMagentoProduct()->isStockAvailability()) {
return true;
} else {
if ($ebayListingProduct->isVariationsReady()) {
$temp = $variationResource->isAllDoNotHaveStockAvailabilities($listingProduct->getId(), $listingProduct->getListing()->getStoreId());
if (!is_null($temp) && $temp) {
return true;
}
}
}
}
if ($ebaySynchronizationTemplate->isStopWhenQtyMagentoHasValue()) {
$productQty = (int) $listingProduct->getMagentoProduct()->getQty(true);
$typeQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyMagentoHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyMagentoHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyMagentoHasValueMax();
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_LESS && $productQty <= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_MORE && $productQty >= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
return true;
}
}
if ($ebaySynchronizationTemplate->isStopWhenQtyCalculatedHasValue()) {
$productQty = (int) $ebayListingProduct->getQty();
$typeQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyCalculatedHasValueType();
$minQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyCalculatedHasValueMin();
$maxQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyCalculatedHasValueMax();
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_LESS && $productQty <= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_MORE && $productQty >= $minQty) {
return true;
}
if ($typeQty == Ess_M2ePro_Model_Ebay_Template_Synchronization::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
return true;
}
}
return false;
}