1
0
mirror of synced 2024-11-22 13:06:07 +03:00

Merge pull request #15 from iyzoer/v1.9

v1.1.1
This commit is contained in:
Alex Lushpai 2018-09-04 09:58:28 +03:00 committed by GitHub
commit 8def052f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 133 deletions

View File

@ -60,7 +60,7 @@ class Retailcrm_Retailcrm_Model_Exchange
} }
$orderH = isset($response['history']) ? $response['history'] : array(); $orderH = isset($response['history']) ? $response['history'] : array();
if(count($orderH) == 0) { if (count($orderH) == 0) {
return true; return true;
} }
@ -154,11 +154,12 @@ class Retailcrm_Retailcrm_Model_Exchange
$customer->setWebsiteId($siteid); $customer->setWebsiteId($siteid);
$customer->loadByEmail($order['email']); $customer->loadByEmail($order['email']);
if (!is_numeric($customer->getId())) { if (!is_numeric($customer->getId())) {
$customer $customer
->setGroupId(1) ->setGroupId(1)
->setWebsiteId($siteid) ->setWebsiteId($siteid)
->setStore($storeId) ->setStoreId($storeId)
->setEmail($order['email']) ->setEmail($order['email'])
->setFirstname($order['firstName']) ->setFirstname($order['firstName'])
->setLastname($order['lastName']) ->setLastname($order['lastName'])
@ -390,7 +391,7 @@ class Retailcrm_Retailcrm_Model_Exchange
$customer $customer
->setGropuId(1) ->setGropuId(1)
->setWebsiteId($siteid) ->setWebsiteId($siteid)
->setStore($storeId) ->setStoreId($storeId)
->setEmail($order['email']) ->setEmail($order['email'])
->setFirstname($order['firstName']) ->setFirstname($order['firstName'])
->setLastname($order['lastName']) ->setLastname($order['lastName'])

View File

@ -103,25 +103,23 @@ class Retailcrm_Retailcrm_Model_Order extends Retailcrm_Retailcrm_Model_Exchange
} }
$product = array( $product = array(
'productId' => $item->getProductId(),
'productName' => !isset($parent) ? $item->getName() : $parent->getName(), 'productName' => !isset($parent) ? $item->getName() : $parent->getName(),
'quantity' => !isset($parent) ? intval($item->getQtyOrdered()) : intval($parent->getQtyOrdered()), 'quantity' => !isset($parent) ? intval($item->getQtyOrdered()) : intval($parent->getQtyOrdered()),
'initialPrice' => !isset($parent) ? $item->getPrice() : $parent->getPrice(), 'initialPrice' => !isset($parent) ? $item->getPrice() : $parent->getPrice(),
'offer'=>array( 'offer' => array(
'externalId'=>$item->getProductId() 'externalId' => $item->getProductId()
) )
); );
unset($parent); unset($parent);
$items[] = $product; $items[] = $product;
} elseif($item->getProductType() == "grouped") { } elseif ($item->getProductType() == "grouped") {
$product = array( $product = array(
'productId' => $item->getProductId(),
'productName' => $item->getName(), 'productName' => $item->getName(),
'quantity' => $item->getQtyOrdered(), 'quantity' => $item->getQtyOrdered(),
'initialPrice' => $item->getPrice(), 'initialPrice' => $item->getPrice(),
'offer'=>array( 'offer' => array(
'externalId'=>$item->getProductId() 'externalId '=> $item->getProductId()
) )
); );
@ -343,10 +341,12 @@ class Retailcrm_Retailcrm_Model_Order extends Retailcrm_Retailcrm_Model_Exchange
} }
$product = array( $product = array(
'productId' => $item->getProductId(),
'productName' => !isset($parent) ? $item->getName() : $parent->getName(), 'productName' => !isset($parent) ? $item->getName() : $parent->getName(),
'quantity' => !isset($parent) ? intval($item->getQtyOrdered()) : intval($parent->getQtyOrdered()), 'quantity' => !isset($parent) ? intval($item->getQtyOrdered()) : intval($parent->getQtyOrdered()),
'initialPrice' => !isset($parent) ? $item->getPrice() : $parent->getPrice() 'initialPrice' => !isset($parent) ? $item->getPrice() : $parent->getPrice(),
'offer' => array(
'externalId' => $item->getProductId()
)
); );
unset($parent); unset($parent);
$items[] = $product; $items[] = $product;