From adcdd015b9321d0124d332f8cad09941f01688c3 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Mon, 22 Jun 2015 01:17:34 +0300 Subject: [PATCH] cleanup, icml improvements, state-status mapping settings --- README.md | 4 +- .../System/Config/Form/Fieldset/Base.php | 3 +- .../System/Config/Form/Fieldset/Status.php | 87 ++++-- .../Retailcrm/Retailcrm/Model/Exchange.php | 256 +----------------- .../Retailcrm/Retailcrm/Model/Icml.php | 155 +++++++---- .../Retailcrm/Retailcrm/Model/Observer.php | 83 +++--- .../Retailcrm/Retailcrm/etc/config.xml | 45 ++- .../Retailcrm/Retailcrm/etc/system.xml | 46 ++-- app/etc/modules/Retailcrm_Retailcrm.xml | 36 ++- retailcrm-1.0.0.xml | 24 -- 10 files changed, 279 insertions(+), 460 deletions(-) delete mode 100644 retailcrm-1.0.0.xml diff --git a/README.md b/README.md index 1c2589a..ab46981 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# module-magento -Модуль Magento для интеграции с retailCRM через REST API +# Magento RetailCRM module +Модуль Magento интеграции с RetailCRM diff --git a/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Base.php b/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Base.php index f436d9b..8ef4e1e 100644 --- a/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Base.php +++ b/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Base.php @@ -10,6 +10,7 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Base exten public function __construct() { parent::__construct(); + $this->_apiUrl = Mage::getStoreConfig('retailcrm/general/api_url'); $this->_apiKey = Mage::getStoreConfig('retailcrm/general/api_key'); @@ -32,4 +33,4 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Base exten } } } -} \ No newline at end of file +} diff --git a/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Status.php b/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Status.php index 5d26f0a..f14e104 100644 --- a/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Status.php +++ b/app/code/community/Retailcrm/Retailcrm/Block/Adminhtml/System/Config/Form/Fieldset/Status.php @@ -4,26 +4,43 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Status ext public function render(Varien_Data_Form_Element_Abstract $element) { $html = $this->_getHeaderHtml($element); + $warn = ' +
+ Please check your API Url & API Key +
+ '; + if(!empty($this->_apiUrl) && !empty($this->_apiKey) && $this->_isCredentialCorrect) { + $orderEntity = Mage::getModel('sales/order'); + $reflection = new ReflectionClass($orderEntity); + $constants = $reflection->getConstants(); + $values = array(); - $client = Mage::getModel( - 'retailcrm/ApiClient', - array('url' => $this->_apiUrl, 'key' => $this->_apiKey, 'site' => null) - ); + foreach ($constants as $key => $value) + { + if (preg_match("/state_/i", $key)) { + $label = implode( + ' ', + $arr = array_map( + function($word) { + return ucfirst($word); + }, + explode('_', $value) + ) + ); - try { - $statuses = $client->statusesList(); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log($e->getMessage()); + $values[] = array('code' => $value, 'name' => $label); + } } - if ($statuses->isSuccessful() && !empty($statuses)) { - foreach ($statuses['statuses'] as $group) { + if (!empty($values)) { + foreach ($values as $group) { $html.= $this->_getFieldHtml($element, $group); } } + } else { - $html .= '
Please check your API Url & API Key
'; + $html .= $warn; } $html .= $this->_getFooterHtml($element); @@ -34,7 +51,9 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Status ext protected function _getFieldRenderer() { if (empty($this->_fieldRenderer)) { - $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field'); + $this->_fieldRenderer = Mage::getBlockSingleton( + 'adminhtml/system_config_form_field' + ); } return $this->_fieldRenderer; } @@ -44,12 +63,35 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Status ext */ protected function _getValues() { - $values = Mage::getModel('sales/order_status')->getResourceCollection()->getData(); + $client = Mage::getModel( + 'retailcrm/ApiClient', + array( + 'url' => $this->_apiUrl, + 'key' => $this->_apiKey, + 'site' => null + ) + ); + + try { + $statuses = $client->statusesList(); + } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { + Mage::log($e->getMessage()); + } if (empty($this->_values)) { - $this->_values[] = array('label'=>Mage::helper('adminhtml')->__('===Select status==='), 'value'=>''); - foreach ($values as $value) { - $this->_values[] = array('label'=>Mage::helper('adminhtml')->__($value['label']), 'value'=>$value['status']); + $this->_values[] = array( + 'label' => Mage::helper('adminhtml') + ->__('===Select status==='), + 'value' => '' + ); + if ($statuses->isSuccessful() && !empty($statuses)) { + foreach ($statuses['statuses'] as $status) { + $this->_values[] = array( + 'label' => Mage::helper('adminhtml') + ->__($status['name']), + 'value' => $status['code'] + ); + } } } @@ -66,17 +108,18 @@ class Retailcrm_Retailcrm_Block_Adminhtml_System_Config_Form_Fieldset_Status ext $data = $configData[$path]; $inherit = false; } else { - $data = (int)(string)$this->getForm()->getConfigRoot()->descend($path); + $data = (int) (string) $this->getForm() + ->getConfigRoot()->descend($path); $inherit = true; } $field = $fieldset->addField($group['code'], 'select', array( - 'name' => 'groups[status][fields]['.$group['code'].'][value]', - 'label' => $group['name'], - 'value' => $data, - 'values' => $this->_getValues(), - 'inherit' => $inherit, + 'name' => 'groups[status][fields]['.$group['code'].'][value]', + 'label' => $group['name'], + 'value' => $data, + 'values' => $this->_getValues(), + 'inherit' => $inherit, 'can_use_default_value' => 1, 'can_use_website_value' => 1 ))->setRenderer($this->_getFieldRenderer()); diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php b/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php index 394ed5c..6aba1a7 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Exchange.php @@ -87,7 +87,15 @@ class Retailcrm_Retailcrm_Model_Exchange 'country' => $address['country_id'], 'street' => $address['street'], 'region' => $address['region'], - + 'text' => implode( + ',' + array( + $address['postcode'], + $address['country_id'], + $address['city'], + $address['street'] + ) + ) ), ) ); @@ -210,250 +218,4 @@ class Retailcrm_Retailcrm_Model_Exchange ? array('success' => true, 'result' => $result) : array('success' => false, 'result' => $searchResult[0]['id']); } - - - /** - * @param $data - * @return bool - * @internal param mixed $order - * - */ - /*public function orderEdit($order) - { - $this->_config = Mage::getStoreConfig('retailcrm', $order->getStoreId()); - - $statuses = array_flip(array_filter($this->_config['status'])); - $paymentsStatuses = array_flip(array_filter($this->_config['paymentstatuses'])); - $payments = array_filter($this->_config['payment']); - $shippings = array_filter($this->_config['shipping']); - - $address = $order->getShippingAddress()->getData(); - - $orderItems = $order->getItemsCollection(); - $items = array(); - - foreach ($orderItems as $item){ - $items[] = array( - 'productId' => $item->product_id, - 'initialPrice' => $item->getPrice(), - 'taxPrice' => $item->getPriceInclTax(), - 'productName' => $item->getName(), - 'quantity' => (int) $item->getData('qty_ordered') - ); - } - - $preparedOrder = array( - 'site' => $order->getStore()->getCode(), - 'externalId' => $order->getId(), - 'number' => $order->getRealOrderId(), - 'createdAt' => $order->getCreatedAt(), - 'customerId' => ($order->getCustomerIsGuest() == 0) ? $order->getCustomerId() : 'g' . $order->getRealOrderId(), - 'lastName' => $order->getCustomerLastname(), - 'firstName' => $order->getCustomerFirstname(), - 'patronymic' => $order->getCustomerMiddlename(), - 'email' => $order->getCustomerEmail(), - 'phone' => $address['telephone'], - 'paymentType' => $payments[$order->getPayment()->getMethodInstance()->getCode()], - 'paymentStatus' => $paymentsStatuses[$order->getStatus()], - 'status' => $statuses[$order->getStatus()], - 'discount' => abs($order->getDiscountAmount()), - 'items' => $items, - 'delivery' => array( - 'code' => $shippings[$order->getShippingMethod()], - 'cost' => $order->getShippingAmount(), - 'address' => array( - 'index' => $address['postcode'], - 'city' => $address['city'], - 'country' => $address['country_id'], - 'street' => $address['street'], - 'region' => $address['region'], - - ), - ) - ); - - try { - $this->_api->ordersEdit($preparedOrder); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log($e->getMessage()); - } - }*/ - - /*public function processOrders($orders, $nocheck = false) - { - - if (!$nocheck) { - foreach ($orders as $idx => $order) { - $customer = array(); - $customer['phones'][]['number'] = $order['phone']; - $customer['externalId'] = $order['customerId']; - $customer['firstName'] = $order['firstName']; - $customer['lastName'] = $order['lastName']; - $customer['patronymic'] = $order['patronymic']; - $customer['address'] = $order['delivery']['address']; - - if (isset($order['email'])) { - $customer['email'] = $order['email']; - } - - $checkResult = $this->checkCustomers($customer); - - if ($checkResult === false) { - unset($orders[$idx]["customerId"]); - } else { - $orders[$idx]["customerId"] = $checkResult; - } - } - } - - $splitOrders = array_chunk($orders, 50); - - foreach($splitOrders as $orders) { - try { - $response = $this->_api->ordersUpload($orders); - time_nanosleep(0, 250000000); - if (!$response->isSuccessful()) { - Mage::log('RestApi::ordersUpload::API: ' . $response->getErrorMsg()); - if (isset($response['errors'])) { - foreach ($response['errors'] as $error) { - Mage::log('RestApi::ordersUpload::API: ' . $error); - } - } - } - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::ordersUpload::Curl: ' . $e->getMessage()); - return false; - } - } - }*/ - - /*public function orderHistory() - { - try { - $orders = $this->_api->ordersHistory(new DateTime($this->getDate($this->historyLog))); - Mage::log($orders->getGeneratedAt(), null, 'history.log'); - return $orders['orders']; - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::orderHistory::Curl: ' . $e->getMessage()); - return false; - } - }*/ - - /** - * @param $data - * @return bool - */ - /*public function orderFixExternalIds($data) - { - try { - $this->_api->ordersFixExternalIds($data); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::orderFixExternalIds::Curl: ' . $e->getMessage()); - return false; - } - - return true; - }*/ - - /** - * @param $data - * @return bool - */ - /*public function customerFixExternalIds($data) - { - try { - $this->_api->customersFixExternalIds($data); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::customerFixExternalIds::Curl: ' . $e->getMessage()); - return false; - } - - return true; - }*/ - - /** - * Export References to CRM - * - * @param array $deliveries deliveries data - * @param array $payments payments data - * @param array $statuses statuses data - * - */ - /*public function processReference($deliveries = null, $payments = null, $statuses = null) - { - if ($deliveries != null) { - $this->processDeliveries($deliveries); - } - - if ($payments != null) { - $this->processPayments($payments); - } - - if ($statuses != null) { - $this->processStatuses($statuses); - } - }*/ - - /** - * Export deliveries - * - * @param array $deliveries - * - * @return bool - */ - /*protected function processDeliveries($deliveries) - { - foreach ($deliveries as $delivery) { - try { - $this->_api->deliveryTypesEdit($delivery); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::deliveryEdit::Curl: ' . $e->getMessage()); - return false; - } - } - - return true; - }*/ - - /** - * Export payments - * - * @param array $payments - * - * @return bool - */ - /*protected function processPayments($payments) - { - foreach ($payments as $payment) { - try { - $this->_api->paymentTypesEdit($payment); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::paymentEdit::Curl: ' . $e->getMessage()); - return false; - } - } - - return true; - }*/ - - /** - * Export statuses - * - * @param array $statuses - * - * @return bool - */ - /*protected function processStatuses($statuses) - { - foreach ($statuses as $status) { - try { - $this->_api->statusesEdit($status); - } catch (Retailcrm_Retailcrm_Model_Exception_CurlException $e) { - Mage::log('RestApi::statusEdit::Curl: ' . $e->getMessage()); - return false; - } - } - - return true; - }*/ } diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Icml.php b/app/code/community/Retailcrm/Retailcrm/Model/Icml.php index 2a2cf92..d3cbdf8 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Icml.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Icml.php @@ -21,22 +21,28 @@ class Retailcrm_Retailcrm_Model_Icml '; - $xml = new SimpleXMLElement($string, LIBXML_NOENT |LIBXML_NOCDATA | LIBXML_COMPACT | LIBXML_PARSEHUGE); + $xml = new SimpleXMLElement( + $string, + LIBXML_NOENT |LIBXML_NOCDATA | LIBXML_COMPACT | LIBXML_PARSEHUGE + ); $this->_dd = new DOMDocument(); $this->_dd->preserveWhiteSpace = false; $this->_dd->formatOutput = true; $this->_dd->loadXML($xml->asXML()); - $this->_eCategories = $this->_dd->getElementsByTagName('categories')->item(0); - $this->_eOffers = $this->_dd->getElementsByTagName('offers')->item(0); + $this->_eCategories = $this->_dd-> + getElementsByTagName('categories')->item(0); + $this->_eOffers = $this->_dd + ->getElementsByTagName('offers')->item(0); $this->addCategories(); $this->addOffers(); $this->_dd->saveXML(); $baseDir = Mage::getBaseDir(); - $this->_dd->save($baseDir . DS . 'retailcrm_' . Mage::app()->getStore($shop)->getCode() . '.xml'); + $shopCode = Mage::app()->getStore($shop)->getCode(); + $this->_dd->save($baseDir . DS . 'retailcrm_' . $shopCode . '.xml'); } private function addCategories() @@ -52,23 +58,27 @@ class Retailcrm_Retailcrm_Model_Icml { foreach ($ids as $id) { - $category = Mage::getModel('catalog/category'); - $category->load($id); - $categoryData = array( - 'id' => $category->getId(), - 'name'=> $category->getName(), - 'parentId' => $category->getParentId() - ); - array_push($categories, $categoryData); + if ($id > 1) { + $category = Mage::getModel('catalog/category'); + $category->load($id); + $categoryData = array( + 'id' => $category->getId(), + 'name'=> $category->getName(), + 'parentId' => $category->getParentId() + ); + array_push($categories, $categoryData); + } } } foreach($categories as $category) { - $e = $this->_eCategories->appendChild($this->_dd->createElement('category')); + $e = $this->_eCategories->appendChild( + $this->_dd->createElement('category') + ); $e->appendChild($this->_dd->createTextNode($category['name'])); $e->setAttribute('id', $category['id']); - if ($category['parentId'] > 0) { + if ($category['parentId'] > 1) { $e->setAttribute('parentId', $category['parentId']); } } @@ -78,6 +88,7 @@ class Retailcrm_Retailcrm_Model_Icml { $offers = array(); $helper = Mage::helper('retailcrm'); + $picUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); $collection = Mage::getModel('catalog/product') ->getCollection() @@ -89,17 +100,26 @@ class Retailcrm_Retailcrm_Model_Icml $offer = array(); $offer['id'] = $product->getId(); $offer['productId'] = $product->getId(); + $offer['productActivity'] = $product->isAvailable() ? 'Y' : 'N'; $offer['name'] = $product->getName(); $offer['productName'] = $product->getName(); $offer['initialPrice'] = (float) $product->getPrice(); - $offer['url'] = $helper->rewrittenProductUrl($product->getId(), $product->getCategoryId(), $this->_shop); - $offer['picture'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product'.$product->getImage(); - $offer['quantity'] = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty(); + + $offer['url'] = $helper->rewrittenProductUrl( + $product->getId(), $product->getCategoryId(), $this->_shop + ); + + $offer['picture'] = $picUrl.'catalog/product'.$product->getImage(); + + $offer['quantity'] = Mage::getModel('cataloginventory/stock_item') + ->loadByProduct($product)->getQty(); foreach ($product->getCategoryIds() as $category_id) { $offer['categoryId'][] = $category_id; } + $offer['vendor'] = $product->getAttributeText('manufacturer'); + $offer['article'] = $product->getSku(); $offer['weight'] = $product->getWeight(); @@ -109,71 +129,100 @@ class Retailcrm_Retailcrm_Model_Icml foreach ($offers as $offer) { - $e = $this->_eOffers->appendChild($this->_dd->createElement('offer')); + $e = $this->_eOffers->appendChild( + $this->_dd->createElement('offer') + ); + $e->setAttribute('id', $offer['id']); $e->setAttribute('productId', $offer['productId']); - if (isset($offer['quantity'] ) && $offer['quantity'] != '') { - $e->setAttribute('quantity', (int)$offer['quantity']); + if (!empty($offer['quantity'])) { + $e->setAttribute('quantity', (int) $offer['quantity']); + } else { + $e->setAttribute('quantity', 0); } if (!empty($offer['categoryId'])) { foreach ($offer['categoryId'] as $categoryId) { - $e->appendChild($this->_dd->createElement('categoryId', $categoryId)); + $e->appendChild( + $this->_dd->createElement('categoryId') + )->appendChild( + $this->_dd->createTextNode($categoryId) + ); } } else { $e->appendChild($this->_dd->createElement('categoryId', 1)); } - $e->appendChild($this->_dd->createElement('name'))->appendChild($this->_dd->createTextNode($offer['name'])); - $e->appendChild($this->_dd->createElement('productName'))->appendChild($this->_dd->createTextNode($offer['name'])); - $e->appendChild($this->_dd->createElement('price', $offer['initialPrice'])); + $e->appendChild($this->_dd->createElement('productActivity')) + ->appendChild( + $this->_dd->createTextNode($offer['productActivity']) + ); - if (isset($offer['purchasePrice'] ) && $offer['purchasePrice'] != '') { - $e->appendChild($this->_dd->createElement('purchasePrice'))->appendChild($this->_dd->createTextNode($offer['purchasePrice'])); + $e->appendChild($this->_dd->createElement('name')) + ->appendChild( + $this->_dd->createTextNode($offer['name']) + ); + + $e->appendChild($this->_dd->createElement('productName')) + ->appendChild( + $this->_dd->createTextNode($offer['productName']) + ); + + $e->appendChild($this->_dd->createElement('price')) + ->appendChild( + $this->_dd->createTextNode($offer['initialPrice']) + ); + + if (!empty($offer['purchasePrice'])) { + $e->appendChild($this->_dd->createElement('purchasePrice')) + ->appendChild( + $this->_dd->createTextNode($offer['purchasePrice'] + ) + ); } - if (isset($offer['vendor'] ) && $offer['vendor'] != '') { - $e->appendChild($this->_dd->createElement('vendor'))->appendChild($this->_dd->createTextNode($offer['vendor'])); + if (!empty($offer['picture'])) { + $e->appendChild($this->_dd->createElement('picture')) + ->appendChild( + $this->_dd->createTextNode($offer['picture']) + ); } - if (isset($offer['picture'] ) && $offer['picture'] != '') { - $e->appendChild($this->_dd->createElement('picture', $offer['picture'])); + if (!empty($offer['url'])) { + $e->appendChild($this->_dd->createElement('url')) + ->appendChild( + $this->_dd->createTextNode($offer['url'] + ) + ); } - if (isset($offer['url'] ) && $offer['url'] != '') { - $e->appendChild($this->_dd->createElement('url'))->appendChild($this->_dd->createTextNode($offer['url'])); + if (!empty($offer['vendor'])) { + $e->appendChild($this->_dd->createElement('vendor')) + ->appendChild( + $this->_dd->createTextNode($offer['vendor'] + ) + ); } - if (isset($offer['xmlId'] ) && $offer['xmlId'] != '') { - $e->appendChild($this->_dd->createElement('xmlId'))->appendChild($this->_dd->createTextNode($offer['xmlId'])); - } - if (isset($offer['article'] ) && $offer['article'] != '') { + if (!empty($offer['article'] )) { $sku = $this->_dd->createElement('param'); $sku->setAttribute('name', 'article'); - $sku->appendChild($this->_dd->createTextNode($offer['article'])); + $sku->setAttribute('code', 'Article'); + $sku->appendChild( + $this->_dd->createTextNode($offer['article']) + ); $e->appendChild($sku); } - if (isset($offer['size'] ) && $offer['size'] != '') { - $size = $this->_dd->createElement('param'); - $size->setAttribute('name', 'size'); - $size->appendChild($this->_dd->createTextNode($offer['size'])); - $e->appendChild($size); - } - - if (isset($offer['color'] ) && $offer['color'] != '') { - $color = $this->_dd->createElement('param'); - $color->setAttribute('name', 'color'); - $color->appendChild($this->_dd->createTextNode($offer['color'])); - $e->appendChild($color); - } - - if (isset($offer['weight'] ) && $offer['weight'] != '') { + if (!empty($offer['weight'] )) { $weight = $this->_dd->createElement('param'); $weight->setAttribute('name', 'weight'); - $weight->appendChild($this->_dd->createTextNode($offer['weight'])); + $weight->setAttribute('code', 'Weight'); + $weight->appendChild( + $this->_dd->createTextNode($offer['weight']) + ); $e->appendChild($weight); } } diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Observer.php b/app/code/community/Retailcrm/Retailcrm/Model/Observer.php index 6d88913..55d5473 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Observer.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Observer.php @@ -1,52 +1,31 @@ -getEvent()->getOrder(); - Mage::getModel('retailcrm/exchange')->orderCreate($order); - - return true; - } - - /** - * Event after order updated - * - * @param Varien_Event_Observer $observer - * @return bool - */ - public function orderUpdate(Varien_Event_Observer $observer) - { - $order = $observer->getEvent()->getOrder(); - - if($order->getExportProcessed()){ //check if flag is already set for prevent triggering twice. - return; - } - - Mage::getModel('retailcrm/exchange')->orderEdit($order); - - $order->setExportProcessed(true); - - return true; - } - - public function exportCatalog() - { - foreach (Mage::app()->getWebsites() as $website) { - foreach ($website->getGroups() as $group) { - Mage::getModel('retailcrm/icml')->generate((int)$group->getId()); - } - } - } -} +getEvent()->getOrder(); + Mage::getModel('retailcrm/exchange')->orderCreate($order); + + return true; + } + + public function exportCatalog() + { + foreach (Mage::app()->getWebsites() as $website) { + foreach ($website->getGroups() as $group) { + Mage::getModel('retailcrm/icml')->generate((int)$group->getId()); + } + } + } +} diff --git a/app/code/community/Retailcrm/Retailcrm/etc/config.xml b/app/code/community/Retailcrm/Retailcrm/etc/config.xml index 4702e25..162c003 100644 --- a/app/code/community/Retailcrm/Retailcrm/etc/config.xml +++ b/app/code/community/Retailcrm/Retailcrm/etc/config.xml @@ -1,20 +1,26 @@ @@ -48,15 +54,6 @@ - - - - - - - - - diff --git a/app/code/community/Retailcrm/Retailcrm/etc/system.xml b/app/code/community/Retailcrm/Retailcrm/etc/system.xml index 8997948..f61c24c 100644 --- a/app/code/community/Retailcrm/Retailcrm/etc/system.xml +++ b/app/code/community/Retailcrm/Retailcrm/etc/system.xml @@ -1,20 +1,26 @@ @@ -37,7 +43,7 @@ 1 - General settings that are required to connect retailcrm and Magento. + General settings that are required to connect RetailCRM and Magento. text 10 1 @@ -65,7 +71,7 @@ - 1 + 0 Comparison of shipping methods text @@ -76,7 +82,7 @@ retailcrm/adminhtml_system_config_form_fieldset_shipping - 1 + 0 Comparison of payment methods text @@ -87,7 +93,7 @@ retailcrm/adminhtml_system_config_form_fieldset_payment - 1 + 0 Comparison of payment statuses text @@ -98,7 +104,7 @@ retailcrm/adminhtml_system_config_form_fieldset_paymentstatus - 1 + 0 Comparison of order statuses text diff --git a/app/etc/modules/Retailcrm_Retailcrm.xml b/app/etc/modules/Retailcrm_Retailcrm.xml index 065eaa7..5d7a042 100644 --- a/app/etc/modules/Retailcrm_Retailcrm.xml +++ b/app/etc/modules/Retailcrm_Retailcrm.xml @@ -1,20 +1,26 @@ diff --git a/retailcrm-1.0.0.xml b/retailcrm-1.0.0.xml deleted file mode 100644 index acfacdc..0000000 --- a/retailcrm-1.0.0.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - retailcrm - 1.1.0 - stable - Apache License, Version 2.0 - community - - RetailCRM. - Description - Notes - Alex Lushpaigwinnlushpai@gmail.com - 2015-01-28 - - - - - - - - - - 5.3.07.0.0 -