本文整理汇总了PHP中Ess_M2ePro_Model_Account::getChildObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Account::getChildObject方法的具体用法?PHP Ess_M2ePro_Model_Account::getChildObject怎么用?PHP Ess_M2ePro_Model_Account::getChildObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Account
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Account::getChildObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
if (!is_null($this->account)) {
$this->requestExtraData['account'] = $this->account->getChildObject()->getServerHash();
}
parent::process();
}
示例2: process
public function process()
{
if (!is_null($this->account)) {
$this->requestExtraData['account'] = $this->account->getChildObject()->getTranslationHash();
}
return parent::process();
}
示例3: process
public function process()
{
if (!is_null($this->account) && !is_null($this->marketplace)) {
/** @var $amazonAccount Ess_M2ePro_Model_Amazon_Account */
$amazonAccount = $this->account->getChildObject();
$marketplaceDataTemp = $amazonAccount->getMarketplaceItem($this->marketplace->getId());
if (!is_null($marketplaceDataTemp)) {
$this->requestExtraData['account'] = $marketplaceDataTemp['server_hash'];
}
}
parent::process();
}
示例4: process
public function process()
{
if (!is_null($this->marketplace)) {
$this->requestExtraData['marketplace'] = $this->marketplace->getNativeId();
}
if (!is_null($this->account)) {
$this->requestExtraData['account'] = $this->account->getChildObject()->getServerHash();
}
if (!is_null($this->mode)) {
$this->requestExtraData['mode'] = $this->mode;
}
parent::process();
}
示例5: getOrdersForRelease
private function getOrdersForRelease(Ess_M2ePro_Model_Account $account)
{
/** @var Ess_M2ePro_Model_Mysql4_Order_Collection $collection */
$collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Order')->addFieldToFilter('account_id', $account->getId())->addFieldToFilter('reservation_state', Ess_M2ePro_Model_Order_Reserve::STATE_PLACED);
$reservationDays = (int) $account->getChildObject()->getQtyReservationDays();
$minReservationStartDate = new DateTime(Mage::helper('M2ePro')->getCurrentGmtDate(), new DateTimeZone('UTC'));
$minReservationStartDate->modify('- ' . $reservationDays . ' days');
$minReservationStartDate = $minReservationStartDate->format('Y-m-d H:i');
$collection->addFieldToFilter('reservation_start_date', array('lteq' => $minReservationStartDate));
return $collection->getItems();
}
示例6: updateLinksByPages
private function updateLinksByPages(Ess_M2ePro_Model_Account $account)
{
$inputData = array('necessary_status' => 2, 'necessary_page' => 1);
$settings = $account->getChildObject()->getDecodedListingsUpdateLinksSettings();
if (!is_null($settings)) {
$inputData['necessary_status'] = (int) $settings['next_status'];
$inputData['necessary_page'] = (int) $settings['next_page'];
}
$responseData = Mage::getModel('M2ePro/Connector_Play_Dispatcher')->processVirtual('inventory', 'get', 'pagesProductsLinks', $inputData, NULL, $account->getId());
$this->updateReceivedLinks($responseData);
$pagesSettings = $this->calculateNextPagesSettings($responseData, $inputData);
$account->getChildObject()->setData('listings_update_links_settings', $pagesSettings)->save();
}
示例7: processAmazonOrders
private function processAmazonOrders($response, Ess_M2ePro_Model_Account $account)
{
/** @var Ess_M2ePro_Model_Amazon_Account $amazonAccount */
$amazonAccount = $account->getChildObject();
$ordersLastSynchronization = $amazonAccount->getData('orders_last_synchronization');
$orders = array();
foreach ($response as $orderData) {
$currentOrderUpdateDate = $orderData['purchase_update_date'];
if (strtotime($currentOrderUpdateDate) > strtotime($ordersLastSynchronization)) {
$ordersLastSynchronization = $currentOrderUpdateDate;
}
/** @var $orderBuilder Ess_M2ePro_Model_Amazon_Order_Builder */
$orderBuilder = Mage::getModel('M2ePro/Amazon_Order_Builder');
$orderBuilder->initialize($account, $orderData);
$order = $orderBuilder->process();
if (!$order) {
continue;
}
$orders[] = $order;
}
$amazonAccount->setData('orders_last_synchronization', $ordersLastSynchronization)->save();
return $orders;
}
示例8: updateReceivedTitles
private function updateReceivedTitles(array $responseData, Ess_M2ePro_Model_Account $account)
{
if (!isset($responseData['items']) || !is_array($responseData['items'])) {
return;
}
/** @var $connWrite Varien_Db_Adapter_Pdo_Mysql */
$connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
$bloTable = Mage::getResourceModel('M2ePro/Buy_Listing_Other')->getMainTable();
$lolTable = Mage::getResourceModel('M2ePro/Listing_Other_Log')->getMainTable();
/** @var $mappingModel Ess_M2ePro_Model_Buy_Listing_Other_Mapping */
$mappingModel = Mage::getModel('M2ePro/Buy_Listing_Other_Mapping');
/** @var $movingModel Ess_M2ePro_Model_Buy_Listing_Other_Moving */
$movingModel = Mage::getModel('M2ePro/Buy_Listing_Other_Moving');
$receivedItems = array();
foreach ($responseData['items'] as $generalId => $title) {
if (isset($receivedItems[$generalId]) || empty($title)) {
continue;
}
$receivedItems[$generalId] = $title;
$listingsOthersWithEmptyTitles = array();
if ($account->getChildObject()->isOtherListingsMappingEnabled()) {
/** @var $listingOtherCollection Mage_Core_Model_Mysql4_Collection_Abstract */
$listingOtherCollection = Mage::helper('M2ePro/Component_Buy')->getCollection('Listing_Other')->addFieldToFilter('main_table.account_id', (int) $account->getId())->addFieldToFilter('second_table.general_id', (int) $generalId)->addFieldToFilter('second_table.title', array('null' => true));
$listingsOthersWithEmptyTitles = $listingOtherCollection->getItems();
}
$connWrite->update($bloTable, array('title' => (string) $title), array('general_id = ?' => (int) $generalId));
$connWrite->update($lolTable, array('title' => (string) $title), array('identifier = ?' => (int) $generalId, 'component_mode = ?' => Ess_M2ePro_Helper_Component_Buy::NICK));
if (count($listingsOthersWithEmptyTitles) > 0) {
foreach ($listingsOthersWithEmptyTitles as $listingOtherModel) {
$listingOtherModel->setData('title', (string) $title);
$listingOtherModel->getChildObject()->setData('title', (string) $title);
$mappingModel->initialize($account);
$mappingResult = $mappingModel->autoMapOtherListingProduct($listingOtherModel);
if ($mappingResult) {
if (!$account->getChildObject()->isOtherListingsMoveToListingsEnabled()) {
continue;
}
$movingModel->initialize($account);
$movingModel->autoMoveOtherListingProduct($listingOtherModel);
}
}
}
}
}
示例9: updateSkusForReceivedItems
private function updateSkusForReceivedItems($listingOtherCollection, Ess_M2ePro_Model_Account $account, array $items)
{
/** @var $mappingModel Ess_M2ePro_Model_Ebay_Listing_Other_Mapping */
$mappingModel = Mage::getModel('M2ePro/Ebay_Listing_Other_Mapping');
foreach ($items as $item) {
foreach ($listingOtherCollection->getItems() as $listingOther) {
/** @var $listingOther Ess_M2ePro_Model_Listing_Other */
if ((double) $listingOther->getData('item_id') != $item['id']) {
continue;
}
$listingOther->getChildObject()->setData('sku', (string) $item['sku'])->save();
if ($account->getChildObject()->isOtherListingsMappingEnabled()) {
$mappingModel->initialize($account);
$mappingModel->autoMapOtherListingProduct($listingOther);
}
break;
}
}
}
示例10: getResponseBody
private function getResponseBody(Ess_M2ePro_Model_Account $account)
{
if ($account->getChildObject()->isFeedbacksAutoResponseCycled()) {
$lastUsedId = 0;
if ($account->getChildObject()->getFeedbacksLastUsedId() != null) {
$lastUsedId = (int) $account->getChildObject()->getFeedbacksLastUsedId();
}
$feedbackTemplatesIds = Mage::getModel('M2ePro/Ebay_Feedback_Template')->getCollection()->addFieldToFilter('account_id', $account->getId())->setOrder('id', 'ASC')->getAllIds();
if (!count($feedbackTemplatesIds)) {
return '';
}
$feedbackTemplate = Mage::getModel('M2ePro/Ebay_Feedback_Template');
if (max($feedbackTemplatesIds) > $lastUsedId) {
foreach ($feedbackTemplatesIds as $templateId) {
if ($templateId <= $lastUsedId) {
continue;
}
$feedbackTemplate->load($templateId);
break;
}
} else {
$feedbackTemplate->load(min($feedbackTemplatesIds));
}
if (!$feedbackTemplate->getId()) {
return '';
}
$account->setData('feedbacks_last_used_id', $feedbackTemplate->getId())->save();
return $feedbackTemplate->getBody();
}
if ($account->getChildObject()->isFeedbacksAutoResponseRandom()) {
$feedbackTemplatesIds = Mage::getModel('M2ePro/Ebay_Feedback_Template')->getCollection()->addFieldToFilter('account_id', $account->getId())->getAllIds();
if (!count($feedbackTemplatesIds)) {
return '';
}
$index = rand(0, count($feedbackTemplatesIds) - 1);
$feedbackTemplate = Mage::getModel('M2ePro/Ebay_Feedback_Template')->load($feedbackTemplatesIds[$index]);
if (!$feedbackTemplate->getId()) {
return '';
}
return $feedbackTemplate->getBody();
}
return '';
}
示例11: getUnpaidOrdersUpdates
private function getUnpaidOrdersUpdates(Ess_M2ePro_Model_Account $account)
{
$reservationDays = $account->getChildObject()->getMagentoOrdersReservationDays();
list($startDate, $endDate) = $this->getDateRangeForUnpaidOrders($reservationDays);
$ordersIds = Mage::getResourceModel('M2ePro/Ebay_Order')->getCancellationCandidatesChannelIds($account->getId(), $startDate, $endDate);
if (count($ordersIds) == 0) {
return array();
}
$request = array('orders_ids' => $ordersIds);
$response = Mage::getModel('M2ePro/Connector_Server_Ebay_Dispatcher')->processVirtualAbstract('sales', 'get', 'orders', $request, NULL, NULL, $account, NULL);
return isset($response['orders']) ? $response['orders'] : array();
}
示例12: processAccountInventorySku
private function processAccountInventorySku(Ess_M2ePro_Model_Account $account)
{
$this->_profiler->addTitle('Starting account "' . $account->getData('title') . '"');
/** @var $listingOtherCollection Mage_Core_Model_Mysql4_Collection_Abstract */
$listingOtherCollection = Mage::helper('M2ePro/Component_Ebay')->getCollection('Listing_Other');
$listingOtherCollection->addFieldToFilter('`main_table`.account_id', (int) $account->getId());
$listingOtherCollection->getSelect()->where('`second_table`.`sku` IS NULL');
$listingOtherCollection->getSelect()->order('second_table.start_date ASC');
$listingOtherCollection->getSelect()->limit(200);
if (!$listingOtherCollection->getSize()) {
$this->_profiler->addEol();
return;
}
/** @var $tempListingOther Ess_M2ePro_Model_Listing_Other */
$tempListingOther = $listingOtherCollection->getFirstItem();
$sinceTime = new DateTime($tempListingOther->getData('start_date'), new DateTimeZone('UTC'));
$sinceTime->modify('-5 minutes');
$sinceTime = $sinceTime->format('Y-m-d H:i:s');
$inputData = array('since_time' => $sinceTime, 'getting_inventory_part' => true, 'only_one_page' => true);
$responseData = Mage::getModel('M2ePro/Connector_Server_Ebay_Dispatcher')->processVirtualAbstract('item', 'get', 'all', $inputData, NULL, NULL, $account->getId(), NULL);
if (!isset($responseData['items']) || !is_array($responseData['items'])) {
$this->_profiler->addEol();
return;
}
if (count($responseData['items']) <= 0) {
foreach ($listingOtherCollection->getItems() as $listingOther) {
$listingOther->getChildObject()->setData('sku', new Zend_Db_Expr("''"))->save();
}
$this->_profiler->addEol();
return;
}
/** @var $mappingModel Ess_M2ePro_Model_Ebay_Listing_Other_Mapping */
$mappingModel = Mage::getModel('M2ePro/Ebay_Listing_Other_Mapping');
foreach ($responseData['items'] as $receivedItem) {
foreach ($listingOtherCollection->getItems() as $listingOther) {
/** @var $listingOther Ess_M2ePro_Model_Listing_Other */
if ((double) $listingOther->getData('item_id') != $receivedItem['id']) {
continue;
}
if ($receivedItem['sku'] == '') {
$listingOther->getChildObject()->setData('sku', new Zend_Db_Expr("''"))->save();
} else {
$listingOther->getChildObject()->setData('sku', (string) $receivedItem['sku'])->save();
}
if ($account->getChildObject()->isOtherListingsMappingEnabled()) {
$mappingModel->initialize($account);
$mappingModel->autoMapOtherListingProduct($listingOther);
}
break;
}
}
$this->_profiler->addEol();
}
示例13: updateInventoryLinksByPages
private function updateInventoryLinksByPages(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
{
// get server data
$inputData = array('necessary_status' => 2, 'necessary_page' => 1);
$updateByPagesSettings = $accountObj->getChildObject()->getDecodedListingsUpdateLinksSettings();
if (!is_null($updateByPagesSettings)) {
$inputData['necessary_status'] = (int) $updateByPagesSettings['next_status'];
$inputData['necessary_page'] = (int) $updateByPagesSettings['next_page'];
}
$responseData = Mage::getModel('M2ePro/Connector_Server_Play_Dispatcher')->processVirtualAbstract('inventory', 'get', 'pagesProductsLinks', $inputData, NULL, NULL, $accountObj->getId(), NULL);
if (!isset($responseData['items']) || !is_array($responseData['items'])) {
return;
}
// process and update received data
$this->updateReceivedLinks($responseData['items']);
// calculate and save next data
$nextStatus = (int) $inputData['necessary_status'];
$nextPage = (int) $inputData['necessary_page'] + (int) $responseData['processed_pages'];
if ((bool) $responseData['is_last_page']) {
if ($nextStatus >= 3) {
$nextPage = 10000;
} else {
$nextStatus++;
$nextPage = 1;
}
}
$updateByPagesSettings = array('next_status' => $nextStatus, 'next_page' => $nextPage);
$updateByPagesSettings = json_encode($updateByPagesSettings);
$accountObj->getChildObject()->setData('listings_update_links_settings', $updateByPagesSettings)->save();
}
示例14: processAccount
private function processAccount(Ess_M2ePro_Model_Account $account, $percentsForAccount)
{
//---------------------------
$this->_profiler->addEol();
$this->_profiler->addTitle('Starting account "' . $account->getTitle() . '"');
// ->__('Task "%s" for eBay account: "%s" is started. Please wait...')
$status = 'Task "%s" for eBay account: "%s" is started. Please wait...';
$status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle());
$this->_lockItem->setStatus($status);
$currentPercent = $this->_lockItem->getPercents();
//---------------------------
$collection = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order')->addFieldToFilter('account_id', $account->getId())->addFieldToFilter('reservation_state', Ess_M2ePro_Model_Order_Reserve::STATE_PLACED);
$reservationDays = (int) $account->getChildObject()->getQtyReservationDays();
if ($reservationDays > 0) {
$minReservationStartDate = new DateTime(Mage::helper('M2ePro')->getCurrentGmtDate(), new DateTimeZone('UTC'));
$minReservationStartDate->modify('- ' . $reservationDays . ' days');
$minReservationStartDate = $minReservationStartDate->format('Y-m-d H:i');
$collection->addFieldToFilter('reservation_start_date', array('lteq' => $minReservationStartDate));
}
/** @var $reservedOrders Ess_M2ePro_Model_Order[] */
$reservedOrders = $collection->getItems();
//---------------------------
$this->_profiler->addEol();
$this->_profiler->addTitle('Total orders with expired reservation: ' . count($reservedOrders));
$currentPercent = $currentPercent + $percentsForAccount * 0.1;
$this->_lockItem->setPercents($currentPercent);
$this->_lockItem->activate();
//---------------------------
if (count($reservedOrders) == 0) {
return;
}
//---------------------------
$this->_profiler->addTimePoint(__METHOD__ . 'process' . $account->getId(), 'Release qty for expired reservation');
$status = 'Task "%s" for eBay account: "%s" is in data processing state. Please wait...';
$status = Mage::helper('M2ePro')->__($status, $account->getTitle());
$this->_lockItem->setStatus($status);
//---------------------------
$percentPerOrder = ($percentsForAccount - $currentPercent) / count($reservedOrders);
$tempPercent = 0;
foreach ($reservedOrders as $order) {
$order->getReserve()->release();
$tempPercent += $percentPerOrder;
if (floor($tempPercent) > 0) {
$currentPercent += floor($tempPercent);
$tempPercent -= floor($tempPercent);
$this->_lockItem->setPercents($currentPercent);
$this->_lockItem->activate();
}
}
//---------------------------
$this->_profiler->saveTimePoint(__METHOD__ . 'process' . $account->getId());
$this->_profiler->addEol();
$this->_profiler->addTitle('End account "' . $account->getTitle() . '"');
//---------------------------
}
示例15: saveLastUpdateTime
private function saveLastUpdateTime(Ess_M2ePro_Model_Account $account, $lastUpdateTime)
{
/** @var Ess_M2ePro_Model_Ebay_Account $ebayAccount */
$ebayAccount = $account->getChildObject();
$ebayAccount->setData('orders_last_synchronization', $lastUpdateTime)->save();
}