本文整理汇总了PHP中Ess_M2ePro_Model_Listing_Other::getChildObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Listing_Other::getChildObject方法的具体用法?PHP Ess_M2ePro_Model_Listing_Other::getChildObject怎么用?PHP Ess_M2ePro_Model_Listing_Other::getChildObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Listing_Other
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Listing_Other::getChildObject方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()->getPlayItem()->setData('store_id', $this->getParentObject()->getStoreId())->save();
$dataForUpdate = array('general_id' => $listingOtherProduct->getChildObject()->getGeneralId(), 'play_listing_id' => $listingOtherProduct->getChildObject()->getPlayListingId(), 'link_info' => $listingOtherProduct->getChildObject()->getLinkInfo(), 'general_id_type' => $listingOtherProduct->getChildObject()->getGeneralIdType(), 'sku' => $listingOtherProduct->getChildObject()->getSku(), 'online_price_gbr' => $listingOtherProduct->getChildObject()->getOnlinePriceGbr(), 'online_price_euro' => $listingOtherProduct->getChildObject()->getOnlinePriceEuro(), 'online_shipping_price_gbr' => 0, 'online_shipping_price_euro' => 0, 'online_qty' => $listingOtherProduct->getChildObject()->getOnlineQty(), 'condition' => $listingOtherProduct->getChildObject()->getCondition(), 'condition_note' => $listingOtherProduct->getChildObject()->getConditionNote(), 'dispatch_to' => $listingOtherProduct->getChildObject()->getDispatchTo(), 'dispatch_from' => $listingOtherProduct->getChildObject()->getDispatchFrom(), 'status' => $listingOtherProduct->getStatus(), 'status_changer' => $listingOtherProduct->getStatusChanger());
$listingProduct->addData($dataForUpdate)->save();
return $listingProduct;
}
示例2: getTitleMappedMagentoProductId
protected function getTitleMappedMagentoProductId(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$temp = $otherListing->getChildObject()->getTitle();
if (empty($temp)) {
return NULL;
}
$attributeCode = NULL;
if ($this->getAccount()->getChildObject()->isOtherListingsMappingTitleModeDefault()) {
$attributeCode = 'name';
}
if ($this->getAccount()->getChildObject()->isOtherListingsMappingTitleModeCustomAttribute()) {
$attributeCode = $this->getAccount()->getChildObject()->getOtherListingsMappingTitleAttribute();
}
if (is_null($attributeCode)) {
return NULL;
}
$storeId = $otherListing->getChildObject()->getRelatedStoreId();
$attributeValue = trim($otherListing->getChildObject()->getTitle());
$productObj = Mage::getModel('catalog/product')->setStoreId($storeId);
$productObj = $productObj->loadByAttribute($attributeCode, $attributeValue);
if ($productObj && $productObj->getId()) {
return $productObj->getId();
}
$findCount = preg_match('/^.+(\\[(.+)\\])$/', $attributeValue, $tempMatches);
if ($findCount > 0 && isset($tempMatches[1])) {
$attributeValue = trim(str_replace($tempMatches[1], '', $attributeValue));
$productObj = Mage::getModel('catalog/product')->setStoreId($storeId);
$productObj = $productObj->loadByAttribute($attributeCode, $attributeValue);
if ($productObj && $productObj->getId()) {
return $productObj->getId();
}
}
return NULL;
}
示例3: isMeetReviseGeneralRequirements
/**
* @param Ess_M2ePro_Model_Listing_Other $listingOther
* @return bool
* @throws Ess_M2ePro_Model_Exception_Logic
*/
protected function isMeetReviseGeneralRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
{
if (!$listingOther->isListed() || !$listingOther->isRevisable()) {
return false;
}
if (is_null($listingOther->getProductId())) {
return false;
}
/** @var Ess_M2ePro_Model_Ebay_Listing_Other $ebayListingOther */
$ebayListingOther = $listingOther->getChildObject();
$ebaySynchronizationTemplate = $ebayListingOther->getSynchronizationModel();
if (!$ebaySynchronizationTemplate->isMode()) {
return false;
}
return true;
}
示例4: getTitleMappedMagentoProductId
protected function getTitleMappedMagentoProductId(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$temp = $otherListing->getChildObject()->getTitle();
if (empty($temp)) {
return NULL;
}
$attributeCode = NULL;
if ($this->getAccount()->getChildObject()->isOtherListingsMappingTitleModeDefault()) {
$attributeCode = 'name';
}
if ($this->getAccount()->getChildObject()->isOtherListingsMappingTitleModeCustomAttribute()) {
$attributeCode = $this->getAccount()->getChildObject()->getOtherListingsMappingTitleAttribute();
}
if (is_null($attributeCode)) {
return NULL;
}
$storeId = $otherListing->getChildObject()->getRelatedStoreId();
$attributeValue = trim($otherListing->getChildObject()->getTitle());
$productObj = Mage::getModel('catalog/product')->setStoreId($storeId);
$productObj = $productObj->loadByAttribute($attributeCode, $attributeValue);
if ($productObj && $productObj->getId()) {
return $productObj->getId();
}
return NULL;
}
示例5: 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;
}
示例6: 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;
}
示例7: getDefaultListing
/**
* @param Ess_M2ePro_Model_Listing_Other $otherListing
* @return Ess_M2ePro_Model_Listing
*/
public function getDefaultListing(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$accountId = $this->getAccount()->getId();
if (isset($this->tempObjectsCache['listing_' . $accountId])) {
return $this->tempObjectsCache['listing_' . $accountId];
}
$tempCollection = Mage::helper('M2ePro/Component_Buy')->getCollection('Listing');
$tempCollection->addFieldToFilter('main_table.title', 'Default (' . $this->getAccount()->getTitle() . ')');
$tempItem = $tempCollection->getFirstItem();
if (!is_null($tempItem->getId())) {
$this->tempObjectsCache['listing_' . $accountId] = $tempItem;
return $tempItem;
}
$tempModel = Mage::helper('M2ePro/Component_Buy')->getModel('Listing');
$dataForAdd = array('title' => 'Default (' . $this->getAccount()->getTitle() . ')', 'store_id' => $otherListing->getChildObject()->getRelatedStoreId(), 'marketplace_id' => Ess_M2ePro_Helper_Component_Buy::MARKETPLACE_ID, 'account_id' => $accountId, 'template_selling_format_id' => $this->getDefaultSellingFormatTemplate($otherListing)->getId(), 'template_synchronization_id' => $this->getDefaultSynchronizationTemplate($otherListing)->getId(), 'source_products' => Ess_M2ePro_Model_Listing::SOURCE_PRODUCTS_CUSTOM, 'sku_mode' => Ess_M2ePro_Model_Buy_Listing::SKU_MODE_DEFAULT, 'general_id_mode' => Ess_M2ePro_Model_Buy_Listing::GENERAL_ID_MODE_NOT_SET, 'search_by_magento_title_mode' => Ess_M2ePro_Model_Buy_Listing::SEARCH_BY_MAGENTO_TITLE_MODE_NONE, 'condition_mode' => Ess_M2ePro_Model_Buy_Listing::CONDITION_MODE_DEFAULT, 'condition_value' => Ess_M2ePro_Model_Buy_Listing::CONDITION_NEW, 'condition_note_mode' => Ess_M2ePro_Model_Buy_Listing::CONDITION_NOTE_MODE_NONE, 'shipping_standard_mode' => Ess_M2ePro_Model_Buy_Listing::SHIPPING_MODE_DEFAULT, 'shipping_expedited_mode' => Ess_M2ePro_Model_Buy_Listing::SHIPPING_MODE_DEFAULT, 'shipping_one_day_mode' => Ess_M2ePro_Model_Buy_Listing::SHIPPING_MODE_DEFAULT, 'shipping_two_day_mode' => Ess_M2ePro_Model_Buy_Listing::SHIPPING_MODE_DEFAULT);
$tempModel->addData($dataForAdd)->save();
$this->tempObjectsCache['listing_' . $accountId] = $tempModel;
return $tempModel;
}
示例8: updateProductAfterAction
protected function updateProductAfterAction(Ess_M2ePro_Model_Listing_Other $listingOther, array $nativeRequestData = array(), array $params = array(), $ebayItemId = NULL, $saveEbayQtySold = false)
{
$dataForUpdate = array('status' => Ess_M2ePro_Model_Listing_Product::STATUS_LISTED);
!is_null($ebayItemId) && ($dataForUpdate['item_id'] = $ebayItemId);
isset($params['status_changer']) && ($dataForUpdate['status_changer'] = (int) $params['status_changer']);
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 (isset($nativeRequestData['title'])) {
$dataForUpdate['title'] = $nativeRequestData['title'];
}
if ($saveEbayQtySold) {
$dataForUpdate['online_qty_sold'] = is_null($listingOther->getChildObject()->getOnlineQtySold()) ? 0 : $listingOther->getChildObject()->getOnlineQtySold();
if (isset($nativeRequestData['qty'])) {
$dataForUpdate['online_qty'] = (int) $nativeRequestData['qty'] + (int) $dataForUpdate['online_qty_sold'];
}
} else {
$dataForUpdate['online_qty_sold'] = 0;
if (isset($nativeRequestData['qty'])) {
$dataForUpdate['online_qty'] = (int) $nativeRequestData['qty'];
}
}
if (isset($nativeRequestData['price_fixed'])) {
$dataForUpdate['online_price'] = (double) $nativeRequestData['price_fixed'];
}
$listingOther->addData($dataForUpdate)->save();
}
示例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, true);
if ($checkingMode) {
return $result;
}
if (!$result instanceof Ess_M2ePro_Model_Listing_Product) {
return false;
}
$listingProduct = $result;
/** @var $collection Mage_Core_Model_Mysql4_Collection_Abstract */
$collection = Mage::getModel('M2ePro/Ebay_Item')->getCollection()->addFieldToFilter('account_id', $listingOtherProduct->getAccount()->getId())->addFieldToFilter('item_id', $listingOtherProduct->getChildObject()->getItemId());
$ebayItem = $collection->getFirstItem();
$ebayItem->setData('store_id', $this->getParentObject()->getStoreId())->save();
$dataForUpdate = array('ebay_item_id' => $ebayItem->getId(), 'online_sku' => $listingOtherProduct->getChildObject()->getSku(), 'online_title' => $listingOtherProduct->getChildObject()->getTitle(), 'online_buyitnow_price' => $listingOtherProduct->getChildObject()->getOnlinePrice(), 'online_qty' => $listingOtherProduct->getChildObject()->getOnlineQty(), 'online_qty_sold' => $listingOtherProduct->getChildObject()->getOnlineQtySold(), 'online_bids' => $listingOtherProduct->getChildObject()->getOnlineBids(), 'start_date' => $listingOtherProduct->getChildObject()->getStartDate(), 'end_date' => $listingOtherProduct->getChildObject()->getEndDate(), 'status' => $listingOtherProduct->getStatus(), 'status_changer' => $listingOtherProduct->getStatusChanger());
$listingProduct->addData($dataForUpdate)->save();
return $listingProduct;
}
示例10: getDefaultListing
/**
* @param Ess_M2ePro_Model_Listing_Other $otherListing
* @return Ess_M2ePro_Model_Listing
*/
public function getDefaultListing(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$accountId = $this->getAccount()->getId();
if (isset($this->tempObjectsCache['listing_' . $accountId])) {
return $this->tempObjectsCache['listing_' . $accountId];
}
$tempCollection = Mage::helper('M2ePro/Component_Play')->getCollection('Listing');
$tempCollection->addFieldToFilter('main_table.title', 'Default (' . $this->getAccount()->getTitle() . ')');
$tempItem = $tempCollection->getFirstItem();
if (!is_null($tempItem->getId())) {
$this->tempObjectsCache['listing_' . $accountId] = $tempItem;
return $tempItem;
}
$tempModel = Mage::helper('M2ePro/Component_Play')->getModel('Listing');
$dataForAdd = array('title' => 'Default (' . $this->getAccount()->getTitle() . ')', 'store_id' => $otherListing->getChildObject()->getRelatedStoreId(), 'marketplace_id' => Ess_M2ePro_Helper_Component_Play::MARKETPLACE_ID, 'account_id' => $accountId, 'template_selling_format_id' => $this->getDefaultSellingFormatTemplate($otherListing)->getId(), 'template_synchronization_id' => $this->getDefaultSynchronizationTemplate($otherListing)->getId(), 'source_products' => Ess_M2ePro_Model_Listing::SOURCE_PRODUCTS_CUSTOM, 'categories_add_action' => Ess_M2ePro_Model_Listing::CATEGORIES_ADD_ACTION_NONE, 'categories_delete_action' => Ess_M2ePro_Model_Listing::CATEGORIES_DELETE_ACTION_NONE, 'sku_mode' => Ess_M2ePro_Model_Play_Listing::SKU_MODE_NOT_SET, 'general_id_mode' => Ess_M2ePro_Model_Play_Listing::GENERAL_ID_MODE_NOT_SET, 'search_by_magento_title_mode' => Ess_M2ePro_Model_Play_Listing::SEARCH_BY_MAGENTO_TITLE_MODE_YES, 'dispatch_to_mode' => Ess_M2ePro_Model_Play_Listing::DISPATCH_TO_MODE_NOT_SET, 'dispatch_from_mode' => Ess_M2ePro_Model_Play_Listing::DISPATCH_FROM_MODE_NOT_SET, 'condition_mode' => Ess_M2ePro_Model_Play_Listing::CONDITION_MODE_NOT_SET, 'condition_note_mode' => Ess_M2ePro_Model_Play_Listing::CONDITION_NOTE_MODE_NOT_SET, 'shipping_price_gbr_mode' => Ess_M2ePro_Model_Play_Listing::SHIPPING_PRICE_GBR_MODE_NONE, 'shipping_price_euro_mode' => Ess_M2ePro_Model_Play_Listing::SHIPPING_PRICE_EURO_MODE_NONE);
$tempModel->addData($dataForAdd)->save();
$this->tempObjectsCache['listing_' . $accountId] = $tempModel;
$attributesSets = Mage::helper('M2ePro/Magento_AttributeSet')->getAll();
foreach ($attributesSets as $attributeSet) {
$dataForAdd = array('object_type' => Ess_M2ePro_Model_AttributeSet::OBJECT_TYPE_LISTING, 'object_id' => (int) $tempModel->getId(), 'attribute_set_id' => (int) $attributeSet['attribute_set_id']);
Mage::getModel('M2ePro/AttributeSet')->setData($dataForAdd)->save();
}
return $tempModel;
}
示例11: getDefaultListing
/**
* @param Ess_M2ePro_Model_Listing_Other $otherListing
* @return Ess_M2ePro_Model_Listing
*/
public function getDefaultListing(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$accountId = $this->getAccount()->getId();
$marketplaceId = $this->getMarketplace()->getId();
if (isset($this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId])) {
return $this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId];
}
$tempCollection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing');
$tempCollection->addFieldToFilter('main_table.title', 'Default (' . $this->getAccount()->getTitle() . ' - ' . $this->getMarketplace()->getTitle() . ')');
$tempItem = $tempCollection->getFirstItem();
if (!is_null($tempItem->getId())) {
$this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId] = $tempItem;
return $tempItem;
}
$tempModel = Mage::helper('M2ePro/Component_Amazon')->getModel('Listing');
$dataForAdd = array('title' => 'Default (' . $this->getAccount()->getTitle() . ' - ' . $this->getMarketplace()->getTitle() . ')', 'store_id' => $otherListing->getChildObject()->getRelatedStoreId(), 'marketplace_id' => $marketplaceId, 'account_id' => $accountId, 'template_selling_format_id' => $this->getDefaultSellingFormatTemplate($otherListing)->getId(), 'template_synchronization_id' => $this->getDefaultSynchronizationTemplate($otherListing)->getId(), 'source_products' => Ess_M2ePro_Model_Listing::SOURCE_PRODUCTS_CUSTOM, 'categories_add_action' => Ess_M2ePro_Model_Listing::CATEGORIES_ADD_ACTION_NONE, 'categories_delete_action' => Ess_M2ePro_Model_Listing::CATEGORIES_DELETE_ACTION_NONE, 'sku_mode' => Ess_M2ePro_Model_Amazon_Listing::SKU_MODE_NOT_SET, 'generate_sku_mode' => Ess_M2ePro_Model_Amazon_Listing::GENERATE_SKU_MODE_NO, 'general_id_mode' => Ess_M2ePro_Model_Amazon_Listing::GENERAL_ID_MODE_NOT_SET, 'worldwide_id_mode' => Ess_M2ePro_Model_Amazon_Listing::WORLDWIDE_ID_MODE_NOT_SET, 'search_by_magento_title_mode' => Ess_M2ePro_Model_Amazon_Listing::SEARCH_BY_MAGENTO_TITLE_MODE_YES, 'handling_time_mode' => Ess_M2ePro_Model_Amazon_Listing::HANDLING_TIME_MODE_NONE, 'handling_time_value' => 1, 'restock_date_mode' => Ess_M2ePro_Model_Amazon_Listing::RESTOCK_DATE_MODE_NONE, 'condition_mode' => Ess_M2ePro_Model_Amazon_Listing::CONDITION_MODE_NOT_SET);
$tempModel->addData($dataForAdd)->save();
$this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId] = $tempModel;
$attributesSets = Mage::helper('M2ePro/Magento_AttributeSet')->getAll();
foreach ($attributesSets as $attributeSet) {
$dataForAdd = array('object_type' => Ess_M2ePro_Model_AttributeSet::OBJECT_TYPE_LISTING, 'object_id' => (int) $tempModel->getId(), 'attribute_set_id' => (int) $attributeSet['attribute_set_id']);
Mage::getModel('M2ePro/AttributeSet')->setData($dataForAdd)->save();
}
return $tempModel;
}
示例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: getDefaultListing
/**
* @param Ess_M2ePro_Model_Listing_Other $otherListing
* @return Ess_M2ePro_Model_Listing
*/
public function getDefaultListing(Ess_M2ePro_Model_Listing_Other $otherListing)
{
$accountId = $this->getAccount()->getId();
$marketplaceId = $this->getMarketplace()->getId();
if (isset($this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId])) {
return $this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId];
}
$tempCollection = Mage::helper('M2ePro/Component_Buy')->getCollection('Listing');
$tempCollection->addFieldToFilter('main_table.title', 'Default (' . $this->getAccount()->getTitle() . ')');
$tempItem = $tempCollection->getFirstItem();
if (!is_null($tempItem->getId())) {
$this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId] = $tempItem;
return $tempItem;
}
$tempModel = Mage::helper('M2ePro/Component_Buy')->getModel('Listing');
$dataForAdd = array('title' => 'Default (' . $this->getAccount()->getTitle() . ')', 'store_id' => $otherListing->getChildObject()->getRelatedStoreId(), 'template_general_id' => $this->createDefaultGeneralTemplate($otherListing)->getId(), 'template_selling_format_id' => $this->getDefaultSellingFormatTemplate($otherListing)->getId(), 'template_description_id' => $this->getDefaultDescriptionTemplate($otherListing)->getId(), 'template_synchronization_id' => $this->getDefaultSynchronizationTemplate($otherListing)->getId(), 'synchronization_start_type' => Ess_M2ePro_Model_Listing::SYNCHRONIZATION_START_TYPE_IMMEDIATELY, 'synchronization_start_through_metric' => Ess_M2ePro_Model_Listing::SYNCHRONIZATION_START_THROUGH_METRIC_DAYS, 'synchronization_start_through_value' => 1, 'synchronization_start_date' => Mage::helper('M2ePro')->getCurrentGmtDate(), 'synchronization_stop_type' => Ess_M2ePro_Model_Listing::SYNCHRONIZATION_STOP_TYPE_NEVER, 'synchronization_stop_through_metric' => Ess_M2ePro_Model_Listing::SYNCHRONIZATION_STOP_THROUGH_METRIC_DAYS, 'synchronization_stop_through_value' => 1, 'synchronization_stop_date' => Mage::helper('M2ePro')->getCurrentGmtDate(), 'source_products' => Ess_M2ePro_Model_Listing::SOURCE_PRODUCTS_CUSTOM, 'categories_add_action' => Ess_M2ePro_Model_Listing::CATEGORIES_ADD_ACTION_NONE, 'categories_delete_action' => Ess_M2ePro_Model_Listing::CATEGORIES_DELETE_ACTION_NONE, 'hide_products_others_listings' => Ess_M2ePro_Model_Listing::HIDE_PRODUCTS_OTHERS_LISTINGS_NO);
$tempModel->addData($dataForAdd)->save();
$this->tempObjectsCache['listing_' . $accountId . '_' . $marketplaceId] = $tempModel;
$attributesSets = Mage::helper('M2ePro/Magento')->getAttributeSets();
foreach ($attributesSets as $attributeSet) {
$dataForAdd = array('object_type' => Ess_M2ePro_Model_AttributeSet::OBJECT_TYPE_LISTING, 'object_id' => (int) $tempModel->getId(), 'attribute_set_id' => (int) $attributeSet['attribute_set_id']);
Mage::getModel('M2ePro/AttributeSet')->setData($dataForAdd)->save();
}
return $tempModel;
}