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

minor fixes & readme

This commit is contained in:
Alex Lushpai 2015-10-23 13:39:37 +03:00
parent f370e6d085
commit 3ce9c12d88
2 changed files with 26 additions and 10 deletions

View File

@ -1,2 +1,11 @@
# Magento RetailCRM module Magento module
Модуль Magento интеграции с RetailCRM ==============
Magento module for interaction with [RetailCRM](http://www.retailcrm.ru) through [REST API](http://retailcrm.ru/docs/Разработчики).
Module allows:
* Exchange the orders with retailCRM
* Configure relations between dictionaries of RetailCRM and Magento (statuses, payments, delivery types and etc)
* Generate [ICML](http://docs.retailcrm.ru/index.php?n=Разработчики.ФорматICML) (Intaro Markup Language) for catalog loading by RetailCRM

View File

@ -27,12 +27,17 @@ class Retailcrm_Retailcrm_Model_Exchange
*/ */
public function ordersCreate($order) public function ordersCreate($order)
{ {
$this->_config = Mage::getStoreConfig('retailcrm', $order->getStoreId()); $this->_config = Mage::getStoreConfig('retailcrm', $order->getStoreId());
$statuses = array_flip(array_filter($this->_config['status'])); $statuses = array_flip(array_filter($this->_config['status']));
$payments = array_filter($this->_config['payment']); $payments = array_filter($this->_config['payment']);
$shippings = array_filter($this->_config['shipping']); $shippings = array_filter($this->_config['shipping']);
$shipment = $order->getShippingMethod();
$shipment = explode('_', $shipment);
$shipment = $shipment[0];
$address = $order->getShippingAddress()->getData(); $address = $order->getShippingAddress()->getData();
$orderItems = $order->getAllItems(); $orderItems = $order->getAllItems();
@ -95,6 +100,7 @@ class Retailcrm_Retailcrm_Model_Exchange
$customerId = $this->setCustomerId($customer); $customerId = $this->setCustomerId($customer);
unset($customer); unset($customer);
$comment = $order->getStatusHistoryCollection()->getFirstItem();
$preparedOrder = array( $preparedOrder = array(
'site' => $order->getStore()->getCode(), 'site' => $order->getStore()->getCode(),
'externalId' => $order->getId(), 'externalId' => $order->getId(),
@ -110,8 +116,9 @@ class Retailcrm_Retailcrm_Model_Exchange
'status' => $statuses[$order->getStatus()], 'status' => $statuses[$order->getStatus()],
'discount' => abs($order->getDiscountAmount()), 'discount' => abs($order->getDiscountAmount()),
'items' => $items, 'items' => $items,
'customerComment' => $comment->getComment(),
'delivery' => array( 'delivery' => array(
'code' => $shippings[$order->getShippingMethod()], 'code' => $shippings[$shipment],
'cost' => $order->getShippingAmount(), 'cost' => $order->getShippingAmount(),
'address' => array( 'address' => array(
'index' => $address['postcode'], 'index' => $address['postcode'],