本文整理汇总了PHP中Ess_M2ePro_Model_Account类的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Account类的具体用法?PHP Ess_M2ePro_Model_Account怎么用?PHP Ess_M2ePro_Model_Account使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ess_M2ePro_Model_Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Ess_M2ePro_Model_Account $account)
{
if (!$account->isComponentModeAmazon()) {
throw new Ess_M2ePro_Model_Exception_Logic('Required Amazon Account.');
}
$this->account = $account;
}
示例2: isLockedAccount
private function isLockedAccount(Ess_M2ePro_Model_Account $account)
{
/** @var $lockItem Ess_M2ePro_Model_LockItem */
$lockItem = Mage::getModel('M2ePro/LockItem');
$lockItem->setNick(self::LOCK_ITEM_PREFIX . '_' . $account->getId());
$lockItem->setMaxInactiveTime(Ess_M2ePro_Model_Processing_Request::MAX_LIFE_TIME_INTERVAL);
return $lockItem->isExist();
}
示例3: getRelatedChanges
private function getRelatedChanges(Ess_M2ePro_Model_Account $account)
{
/** @var Ess_M2ePro_Model_Mysql4_Order_Change_Collection $changesCollection */
$changesCollection = Mage::getModel('M2ePro/Order_Change')->getCollection();
$changesCollection->addAccountFilter($account->getId());
$changesCollection->addProcessingAttemptDateFilter();
$changesCollection->setPageSize(self::MAX_UPDATES_PER_TIME);
$changesCollection->getSelect()->group(array('order_id'));
return $changesCollection->getItems();
}
示例4: 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() . '"');
//---------------------------
}
示例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: processAccount
private function processAccount(Ess_M2ePro_Model_Account $account)
{
$fromDate = $this->prepareFromDate($account->getData('orders_last_synchronization'));
$params = array('from_date' => $fromDate);
if (is_null($account->getData('orders_last_synchronization'))) {
$account->setData('orders_last_synchronization', $fromDate)->save();
}
$dispatcherObject = Mage::getModel('M2ePro/Connector_Amazon_Dispatcher');
$connectorObj = $dispatcherObject->getConnector('orders', 'receive', 'requester', $params, $account, 'Ess_M2ePro_Model_Amazon_Synchronization');
$dispatcherObject->process($connectorObj);
}
示例7: processAccount
private function processAccount(Ess_M2ePro_Model_Account $account)
{
$fromDate = $this->prepareFromDate($account->getData('orders_last_synchronization'));
$params = array('from_date' => $fromDate);
if (is_null($account->getData('orders_last_synchronization'))) {
$account->setData('orders_last_synchronization', $fromDate)->save();
}
$entity = 'orders';
$type = 'receive';
$name = 'requester';
$prefix = 'Ess_M2ePro_Model_Amazon_Synchronization';
$dispatcherObject = Mage::getModel('M2ePro/Connector_Amazon_Dispatcher');
$dispatcherObject->processConnector($entity, $type, $name, $params, $account, $prefix);
}
示例8: processPlayOrders
private function processPlayOrders($response, Ess_M2ePro_Model_Account $account)
{
$ordersLastSynchronization = $account->getData('orders_last_synchronization');
$orders = array();
foreach ($response as $orderData) {
$currentOrderDate = $orderData['purchase_create_date'];
if (strtotime($currentOrderDate) > strtotime($ordersLastSynchronization)) {
$ordersLastSynchronization = $currentOrderDate;
}
/** @var $orderBuilder Ess_M2ePro_Model_Play_Order_Builder */
$orderBuilder = Mage::getModel('M2ePro/Play_Order_Builder');
$orderBuilder->initialize($account, $orderData);
$order = $orderBuilder->process();
$orders[] = $order;
}
$account->setData('orders_last_synchronization', $ordersLastSynchronization)->save();
return $orders;
}
示例9: 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;
}
示例10: 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');
$aloTable = Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getMainTable();
$lolTable = Mage::getResourceModel('M2ePro/Listing_Other_Log')->getMainTable();
/** @var $mappingModel Ess_M2ePro_Model_Amazon_Listing_Other_Mapping */
$mappingModel = Mage::getModel('M2ePro/Amazon_Listing_Other_Mapping');
/** @var $movingModel Ess_M2ePro_Model_Amazon_Listing_Other_Moving */
$movingModel = Mage::getModel('M2ePro/Amazon_Listing_Other_Moving');
$receivedItems = array();
foreach ($responseData['items'] as $generalId => $item) {
if ($item == false) {
continue;
}
$item = array_shift($item);
$title = $item['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_Amazon')->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($aloTable, array('title' => (string) $title), array('general_id = ?' => (string) $generalId));
$connWrite->update($lolTable, array('title' => (string) $title), array('identifier = ?' => (string) $generalId, 'component_mode = ?' => Ess_M2ePro_Helper_Component_Amazon::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);
}
}
}
}
}
示例11: receiveFromEbay
public static function receiveFromEbay(Ess_M2ePro_Model_Account $account, array $paramsConnector = array())
{
// Create connector
//-----------------------
$messages = Mage::getModel('M2ePro/Connector_Server_Ebay_Dispatcher')->processVirtualAbstract('message', 'get', 'memberList', $paramsConnector, 'messages', NULL, $account->getId(), NULL);
is_null($messages) && ($messages = array());
//-----------------------
// Get new messages
//-----------------------
$countNewMessages = 0;
foreach ($messages as $message) {
$dbMessage = array('account_id' => $account->getId(), 'ebay_item_id' => $message['item_id'], 'ebay_item_title' => $message['item_title'], 'sender_name' => $message['sender_name'], 'message_id' => $message['id'], 'message_subject' => $message['subject'], 'message_text' => $message['body'], 'message_date' => $message['creation_date'], 'message_type' => $message['type']);
if (isset($message['responses'])) {
$dbMessage['message_responses'] = json_encode($message['responses'], JSON_FORCE_OBJECT);
}
$existMessage = Mage::getModel('M2ePro/Ebay_Message')->getCollection()->addFieldToFilter('account_id', $account->getId())->addFieldToFilter('message_id', $message['id'])->getFirstItem();
if (is_null($existMessage->getId())) {
$countNewMessages++;
}
$existMessage->addData($dbMessage)->save();
}
//-----------------------
return array('new' => $countNewMessages, 'total' => count($messages));
}
示例12: process
public function process()
{
if (!is_null($this->account)) {
$this->requestExtraData['account'] = $this->account->getChildObject()->getServerHash();
}
parent::process();
}
示例13: process
public function process()
{
if (!is_null($this->account)) {
$this->requestExtraData['account'] = $this->account->getChildObject()->getTranslationHash();
}
return parent::process();
}
示例14: 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();
}
示例15: 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();
}