Version Notes
-- version 1.6.0
Faster bulk customer, item, and order upload to SimpleRelevance. Added Magento 1.8 and 1.9 support. Dropped Magento 1.4 support
-- version 1.5.1
Updated for wider Magento support
-- version 1.5.0
Updated for our new API with SSL
-- version 1.0.4
Security Update
-- version 1.0.3
what 1.0.2 should be
-- version 1.0.2
better url support
-- version 1.0.1
Making all request async by default
-- version 1.0.0
Rename of dict parameter on inventory items
-- version 0.0.9
Category IDS names instead of integers when sending inventory items
-- version 0.0.8
Allowing to send ALL products and customers on each save
-- version 0.0.7
Bug fix on auto submit products and users on Magento 1.6.2.0
-- version 0.0.6
Correcting but on orders export (timestamp)
-- version 0.0.5
Automatic Customer and Product submission
-- version 0.0.4
Bug fixes, new data on product import, debug facility
-- version 0.0.1
First release
Release Info
| Developer | SimpleRelevance |
| Extension | SimpleRelevance_Integration |
| Version | 1.6.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5.1 to 1.6.0
- app/code/community/SimpleRelevance/Integration/Helper/Data.php +7 -9
- app/code/community/SimpleRelevance/Integration/Model/Api.php +112 -74
- app/code/community/SimpleRelevance/Integration/Model/Observer.php +23 -19
- app/code/community/SimpleRelevance/Integration/Model/Purchase.php +3 -5
- app/code/community/SimpleRelevance/Integration/controllers/Adminhtml/ExportController.php +46 -70
- app/code/community/SimpleRelevance/Integration/etc/adminhtml.xml +0 -0
- app/code/community/SimpleRelevance/Integration/etc/config.xml +8 -0
- app/code/community/SimpleRelevance/Integration/etc/system.xml +2 -2
- app/design/adminhtml/default/default/layout/simple_relevance.xml +0 -0
- app/design/adminhtml/default/default/simple_relevance/css.css +0 -0
- app/design/adminhtml/default/default/simple_relevance/js.js +0 -0
- app/etc/modules/SimpleRelevance_Integration.xml +1 -1
- app/locale/en_US/SimpleRelevance_Integration.csv +0 -0
- package.xml +1 -57
|
@@ -47,7 +47,7 @@ class SimpleRelevance_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 47 |
}
|
| 48 |
|
| 49 |
/**
|
| 50 |
-
* Return
|
| 51 |
*
|
| 52 |
* @param Mage_Catalog_Model_Product
|
| 53 |
* @return array
|
|
@@ -55,16 +55,15 @@ class SimpleRelevance_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 55 |
public function getProductDict(Mage_Catalog_Model_Product $product)
|
| 56 |
{
|
| 57 |
$smallImageUrl = '';
|
| 58 |
-
if($product->
|
| 59 |
try {
|
| 60 |
$smallImageUrl = Mage::helper('catalog/image')->init($product, 'small_image')->resize(75);
|
| 61 |
} catch(Exception $e) {
|
| 62 |
Mage::logException($e);
|
| 63 |
}
|
| 64 |
}
|
| 65 |
-
|
| 66 |
$baseImageUrl = '';
|
| 67 |
-
if ($product->
|
| 68 |
try {
|
| 69 |
$baseImageUrl = Mage::helper('catalog/image')->init($product, 'image');
|
| 70 |
} catch(Exception $e) {
|
|
@@ -77,22 +76,21 @@ class SimpleRelevance_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 77 |
$categories = array();
|
| 78 |
if (is_array($categoryIds) && !empty($categoryIds)) {
|
| 79 |
foreach($categoryIds as $_catId) {
|
| 80 |
-
|
| 81 |
$cat = Mage::getModel('catalog/category')->load($_catId);
|
| 82 |
if($cat->getId()){
|
| 83 |
-
$categories []= $cat->
|
| 84 |
}
|
| 85 |
}
|
| 86 |
}
|
| 87 |
|
| 88 |
$dict = array(
|
| 89 |
'item_url' => $product->getUrlPath(),
|
| 90 |
-
'price' => $product->
|
| 91 |
-
'sku' => $product->
|
| 92 |
'categories' => $categories,
|
| 93 |
'image_url_small' => (string)$smallImageUrl,
|
| 94 |
'image_url' => (string)$baseImageUrl,
|
| 95 |
-
'description' => $product->
|
| 96 |
);
|
| 97 |
return $dict;
|
| 98 |
}
|
| 47 |
}
|
| 48 |
|
| 49 |
/**
|
| 50 |
+
* Return product dict params to send to the API
|
| 51 |
*
|
| 52 |
* @param Mage_Catalog_Model_Product
|
| 53 |
* @return array
|
| 55 |
public function getProductDict(Mage_Catalog_Model_Product $product)
|
| 56 |
{
|
| 57 |
$smallImageUrl = '';
|
| 58 |
+
if($product->getData('small_image') != 'no_selection' && $product->getSmallImageUrl()) {
|
| 59 |
try {
|
| 60 |
$smallImageUrl = Mage::helper('catalog/image')->init($product, 'small_image')->resize(75);
|
| 61 |
} catch(Exception $e) {
|
| 62 |
Mage::logException($e);
|
| 63 |
}
|
| 64 |
}
|
|
|
|
| 65 |
$baseImageUrl = '';
|
| 66 |
+
if ($product->getData('image') != 'no_selection' && $product->getImageUrl()) {
|
| 67 |
try {
|
| 68 |
$baseImageUrl = Mage::helper('catalog/image')->init($product, 'image');
|
| 69 |
} catch(Exception $e) {
|
| 76 |
$categories = array();
|
| 77 |
if (is_array($categoryIds) && !empty($categoryIds)) {
|
| 78 |
foreach($categoryIds as $_catId) {
|
|
|
|
| 79 |
$cat = Mage::getModel('catalog/category')->load($_catId);
|
| 80 |
if($cat->getId()){
|
| 81 |
+
$categories []= $cat->getData('name');
|
| 82 |
}
|
| 83 |
}
|
| 84 |
}
|
| 85 |
|
| 86 |
$dict = array(
|
| 87 |
'item_url' => $product->getUrlPath(),
|
| 88 |
+
'price' => $product->getData('price'),
|
| 89 |
+
'sku' => $product->getData('sku'),
|
| 90 |
'categories' => $categories,
|
| 91 |
'image_url_small' => (string)$smallImageUrl,
|
| 92 |
'image_url' => (string)$baseImageUrl,
|
| 93 |
+
'description' => $product->getData('description'),
|
| 94 |
);
|
| 95 |
return $dict;
|
| 96 |
}
|
|
@@ -74,41 +74,62 @@ class SimpleRelevance_Integration_Model_Api
|
|
| 74 |
* API key setter
|
| 75 |
*
|
| 76 |
* @param string $key API Key
|
|
|
|
| 77 |
* @return SimpleRelevance_Integration_Model_Api
|
| 78 |
*/
|
| 79 |
public function setUpAPI($key, $name)
|
| 80 |
{
|
| 81 |
$this->api_key = $key;
|
| 82 |
$this->site_name = $name;
|
| 83 |
-
$this->apiUrl = "https://
|
| 84 |
return $this;
|
| 85 |
}
|
| 86 |
|
| 87 |
/**
|
| 88 |
* Action: POST
|
| 89 |
* Post purchases.
|
|
|
|
|
|
|
|
|
|
| 90 |
*/
|
| 91 |
-
public function postPurchases($data = array())
|
| 92 |
{
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return $this->_callServer('actions', 'post', $data_json);
|
| 95 |
}
|
| 96 |
|
| 97 |
/**
|
| 98 |
* Action: POST
|
| 99 |
* Post items.
|
|
|
|
|
|
|
|
|
|
| 100 |
*/
|
| 101 |
-
public function postItems($itemData = array())
|
| 102 |
{
|
| 103 |
$data = array();
|
| 104 |
$data['async'] = $this->async;
|
| 105 |
$data['api_key'] = $this->api_key;
|
| 106 |
$data['site_name'] = $this->site_name;
|
| 107 |
-
$data['item_name'] = $itemData['item_name'];
|
| 108 |
-
$data['item_id'] = $itemData['item_id'];
|
| 109 |
-
$data['data_dict'] = $itemData['data_dict'];
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
return $this->_callServer('items', 'post', $data_json);
|
| 114 |
}
|
|
@@ -116,104 +137,121 @@ class SimpleRelevance_Integration_Model_Api
|
|
| 116 |
/**
|
| 117 |
* Action: POST
|
| 118 |
* Post users.
|
|
|
|
|
|
|
|
|
|
| 119 |
*/
|
| 120 |
-
public function postUsers($userData = array())
|
| 121 |
{
|
| 122 |
$data = array();
|
| 123 |
$data['async'] = $this->async;
|
| 124 |
$data['api_key'] = $this->api_key;
|
| 125 |
$data['site_name'] = $this->site_name;
|
| 126 |
-
$data['email'] = $userData['email'];
|
| 127 |
-
$data['user_id'] = $userData['user_id'];
|
| 128 |
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
return $this->_callServer('users', 'post', $data_json);
|
| 132 |
}
|
| 133 |
|
| 134 |
/**
|
| 135 |
-
*
|
| 136 |
*
|
| 137 |
-
* @param string $method
|
| 138 |
-
* @param
|
| 139 |
-
* @
|
|
|
|
| 140 |
*/
|
| 141 |
protected function _callServer($method, $call, $payload = array())
|
| 142 |
{
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
curl_close($curlSession);
|
| 189 |
-
|
| 190 |
-
if ($httpCode != 200 && $httpCode != 201) {
|
| 191 |
-
Mage::log($result, null, 'SimpleRelevance_Errors.log');
|
| 192 |
-
Mage::log($httpCode, null, 'SimpleRelevance_Errors.log');
|
| 193 |
-
|
| 194 |
-
$this->errorMessage = $result;
|
| 195 |
-
$this->errorCode = "-99";
|
| 196 |
-
return false;
|
| 197 |
}
|
| 198 |
-
|
| 199 |
-
return $result;
|
| 200 |
}
|
| 201 |
|
| 202 |
/**
|
| 203 |
-
* Log
|
| 204 |
*
|
| 205 |
-
* @param mixed $
|
| 206 |
* @return void
|
| 207 |
*/
|
| 208 |
public function _log($text)
|
| 209 |
{
|
| 210 |
if (!Mage::getStoreConfigFlag('simple_relevance/general/debug')) {
|
| 211 |
-
return;
|
| 212 |
}
|
| 213 |
|
| 214 |
Mage::log($text, null, 'SimpleRelevance_Integration.log');
|
| 215 |
}
|
| 216 |
|
| 217 |
}
|
| 218 |
-
|
| 219 |
?>
|
| 74 |
* API key setter
|
| 75 |
*
|
| 76 |
* @param string $key API Key
|
| 77 |
+
* @param string $name Site name
|
| 78 |
* @return SimpleRelevance_Integration_Model_Api
|
| 79 |
*/
|
| 80 |
public function setUpAPI($key, $name)
|
| 81 |
{
|
| 82 |
$this->api_key = $key;
|
| 83 |
$this->site_name = $name;
|
| 84 |
+
$this->apiUrl = "https://api.simplerelevance.com/api/v{$this->version}/";
|
| 85 |
return $this;
|
| 86 |
}
|
| 87 |
|
| 88 |
/**
|
| 89 |
* Action: POST
|
| 90 |
* Post purchases.
|
| 91 |
+
* @param array $data Data to POST.
|
| 92 |
+
* @param bool $batch Whether to run in batch mode.
|
| 93 |
+
* @return bool|mixed API call result or false on error.
|
| 94 |
*/
|
| 95 |
+
public function postPurchases($data = array(), $batch = false)
|
| 96 |
{
|
| 97 |
+
if ($batch) {
|
| 98 |
+
$post_data = array('batch' => $data, 'async' => $this->async);
|
| 99 |
+
$data_json = json_encode($post_data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 100 |
+
}
|
| 101 |
+
else {
|
| 102 |
+
$data_json = json_encode($data, JSON_FORCE_OBJECT | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 103 |
+
}
|
| 104 |
return $this->_callServer('actions', 'post', $data_json);
|
| 105 |
}
|
| 106 |
|
| 107 |
/**
|
| 108 |
* Action: POST
|
| 109 |
* Post items.
|
| 110 |
+
* @param array $itemData Data to POST.
|
| 111 |
+
* @param bool $batch Whether to run in batch mode.
|
| 112 |
+
* @return bool|mixed API call result or false on error.
|
| 113 |
*/
|
| 114 |
+
public function postItems($itemData = array(), $batch = false)
|
| 115 |
{
|
| 116 |
$data = array();
|
| 117 |
$data['async'] = $this->async;
|
| 118 |
$data['api_key'] = $this->api_key;
|
| 119 |
$data['site_name'] = $this->site_name;
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
if ($batch) {
|
| 122 |
+
$data['batch'] = array();
|
| 123 |
+
foreach ($itemData as $item) {
|
| 124 |
+
$data['batch'][] = $item;
|
| 125 |
+
}
|
| 126 |
+
$data_json = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 127 |
+
} else {
|
| 128 |
+
$data['item_name'] = $itemData['item_name'];
|
| 129 |
+
$data['item_id'] = $itemData['item_id'];
|
| 130 |
+
$data['data_dict'] = $itemData['data_dict'];
|
| 131 |
+
$data_json = json_encode($data, JSON_FORCE_OBJECT | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 132 |
+
}
|
| 133 |
|
| 134 |
return $this->_callServer('items', 'post', $data_json);
|
| 135 |
}
|
| 137 |
/**
|
| 138 |
* Action: POST
|
| 139 |
* Post users.
|
| 140 |
+
* @param array $userData Data to POST.
|
| 141 |
+
* @param bool $batch Whether to run in batch mode.
|
| 142 |
+
* @return bool|mixed API call result or false on error.
|
| 143 |
*/
|
| 144 |
+
public function postUsers($userData = array(), $batch = false)
|
| 145 |
{
|
| 146 |
$data = array();
|
| 147 |
$data['async'] = $this->async;
|
| 148 |
$data['api_key'] = $this->api_key;
|
| 149 |
$data['site_name'] = $this->site_name;
|
|
|
|
|
|
|
| 150 |
|
| 151 |
+
if ($batch) {
|
| 152 |
+
$data['batch'] = array();
|
| 153 |
+
foreach ($userData as $user) {
|
| 154 |
+
$data['batch'][] = $user;
|
| 155 |
+
}
|
| 156 |
+
$data_json = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 157 |
+
} else {
|
| 158 |
+
$data['email'] = $userData['email'];
|
| 159 |
+
$data['user_id'] = $userData['user_id'];
|
| 160 |
+
$data_json = json_encode($data, JSON_FORCE_OBJECT | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
| 161 |
+
}
|
| 162 |
|
| 163 |
return $this->_callServer('users', 'post', $data_json);
|
| 164 |
}
|
| 165 |
|
| 166 |
/**
|
| 167 |
+
* Main API call function.
|
| 168 |
*
|
| 169 |
+
* @param string $method API method to call, i.e. 'actions'
|
| 170 |
+
* @param string $call API HTTP method, i.e. 'post'
|
| 171 |
+
* @param array $payload Optional payload to send to the API
|
| 172 |
+
* @return bool|mixed Returns boolean false or on success, the API result
|
| 173 |
*/
|
| 174 |
protected function _callServer($method, $call, $payload = array())
|
| 175 |
{
|
| 176 |
+
try {
|
| 177 |
+
$this->errorMessage = null;
|
| 178 |
+
$this->errorCode = null;
|
| 179 |
+
$url = $this->apiUrl . $method . '/';
|
| 180 |
+
|
| 181 |
+
$curlSession = curl_init();
|
| 182 |
+
|
| 183 |
+
$auth_token = base64_encode($this->site_name . ':' . $this->api_key);
|
| 184 |
+
$headers = array('Authorization: Basic ' . $auth_token, 'Content-Type: application/json');
|
| 185 |
+
|
| 186 |
+
if ($call == 'post') {
|
| 187 |
+
curl_setopt($curlSession, CURLOPT_POST, true);
|
| 188 |
+
curl_setopt($curlSession, CURLOPT_POSTFIELDS, $payload);
|
| 189 |
+
curl_setopt($curlSession, CURLOPT_FRESH_CONNECT, true);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $headers);
|
| 193 |
+
curl_setopt($curlSession, CURLOPT_FOLLOWLOCATION, true); // follow redirects
|
| 194 |
+
curl_setopt($curlSession, CURLOPT_CONNECTTIMEOUT, 5); // number of seconds to wait while trying to connect
|
| 195 |
+
curl_setopt($curlSession, CURLOPT_TIMEOUT, 5); // max number of seconds to allow cURL functions to execute before timing out and giving up
|
| 196 |
+
curl_setopt($curlSession, CURLOPT_MAXREDIRS, 5); // follow up to 5 redirects
|
| 197 |
+
curl_setopt($curlSession, CURLOPT_USERAGENT, Mage::helper('simple_relevance')->getUserAgent());
|
| 198 |
+
curl_setopt($curlSession, CURLOPT_URL, $url);
|
| 199 |
+
curl_setopt($curlSession, CURLOPT_HEADER, false); // don't include the header in the output
|
| 200 |
+
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
|
| 201 |
+
|
| 202 |
+
$result = curl_exec($curlSession);
|
| 203 |
+
$this->_log($result);
|
| 204 |
+
|
| 205 |
+
if (!$result) {
|
| 206 |
+
$errstr = curl_error($curlSession);
|
| 207 |
+
$errno = curl_errno($curlSession);
|
| 208 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
| 209 |
+
$this->errorCode = "-99";
|
| 210 |
+
return false;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// Check that a connection was made
|
| 214 |
+
if (curl_error($curlSession)) {
|
| 215 |
+
$this->errorMessage = curl_error($curlSession);
|
| 216 |
+
$this->errorCode = "-99";
|
| 217 |
+
return false;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
$httpCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
| 221 |
+
|
| 222 |
+
curl_close($curlSession);
|
| 223 |
+
|
| 224 |
+
if ($httpCode != 200 && $httpCode != 201) {
|
| 225 |
+
Mage::log($result, null, 'SimpleRelevance_Errors.log');
|
| 226 |
+
Mage::log($httpCode, null, 'SimpleRelevance_Errors.log');
|
| 227 |
+
|
| 228 |
+
$this->errorMessage = $result;
|
| 229 |
+
$this->errorCode = "-99";
|
| 230 |
+
return false;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
return $result;
|
| 234 |
}
|
| 235 |
|
| 236 |
+
catch (Exception $e) {
|
| 237 |
+
return false; // catch-all
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
}
|
|
|
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
/**
|
| 242 |
+
* Log text to debug log file
|
| 243 |
*
|
| 244 |
+
* @param mixed $text Text to log
|
| 245 |
* @return void
|
| 246 |
*/
|
| 247 |
public function _log($text)
|
| 248 |
{
|
| 249 |
if (!Mage::getStoreConfigFlag('simple_relevance/general/debug')) {
|
| 250 |
+
return; // if the debug flag is false in the config, do nothing
|
| 251 |
}
|
| 252 |
|
| 253 |
Mage::log($text, null, 'SimpleRelevance_Integration.log');
|
| 254 |
}
|
| 255 |
|
| 256 |
}
|
|
|
|
| 257 |
?>
|
|
@@ -16,13 +16,13 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 16 |
*/
|
| 17 |
public function massaction($observer)
|
| 18 |
{
|
| 19 |
-
$block = $observer->getEvent()->getBlock();
|
| 20 |
-
$action = $block->getRequest()->getControllerName();
|
| 21 |
-
|
| 22 |
if (!Mage::helper('simple_relevance')->enabled()) {
|
| 23 |
return $this;
|
| 24 |
}
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
if (get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction') {
|
| 27 |
$this->_block = $block;
|
| 28 |
|
|
@@ -60,7 +60,7 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 60 |
* Send new order to SimpleRelevance API
|
| 61 |
*
|
| 62 |
* @param Varien_Event_Observer $observer
|
| 63 |
-
* @return
|
| 64 |
*/
|
| 65 |
public function pushPurchase(Varien_Event_Observer $observer)
|
| 66 |
{
|
|
@@ -69,21 +69,27 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 69 |
}
|
| 70 |
|
| 71 |
try {
|
|
|
|
|
|
|
| 72 |
|
| 73 |
$orderId = (int)(Mage::getSingleton('checkout/type_onepage')->getCheckout()->getLastOrderId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
if ($orderId) {
|
| 76 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 77 |
-
|
| 78 |
if ($order->getId()) {
|
| 79 |
$purchase = Mage::getModel('simple_relevance/purchase', $order);
|
| 80 |
$postData = $purchase->getPostData();
|
| 81 |
|
| 82 |
-
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 83 |
-
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 84 |
-
|
| 85 |
foreach ($postData['items'] as $p) {
|
| 86 |
-
$api->postPurchases($p);
|
| 87 |
}
|
| 88 |
}
|
| 89 |
}
|
|
@@ -101,7 +107,7 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 101 |
* Automatically send customer when creating one.
|
| 102 |
*
|
| 103 |
* @param Varien_Event_Observer $observer
|
| 104 |
-
* @return void
|
| 105 |
*/
|
| 106 |
public function pushCustomer(Varien_Event_Observer $observer)
|
| 107 |
{
|
|
@@ -110,17 +116,16 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 110 |
}
|
| 111 |
|
| 112 |
try {
|
| 113 |
-
$customer = $observer->getEvent()->getCustomer();
|
| 114 |
-
|
| 115 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 116 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 117 |
|
|
|
|
| 118 |
$customerData = array(
|
| 119 |
'email' => $customer->getEmail(),
|
| 120 |
'user_id' => $customer->getId(),
|
| 121 |
);
|
| 122 |
|
| 123 |
-
$api->postUsers($customerData);
|
| 124 |
}
|
| 125 |
|
| 126 |
catch (Exception $e) {
|
|
@@ -133,19 +138,18 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 133 |
* Automatically send Catalog-Product when creating or modifying it.
|
| 134 |
*
|
| 135 |
* @param Varien_Event_Observer $observer
|
| 136 |
-
* @return void
|
| 137 |
*/
|
| 138 |
public function pushItem(Varien_Event_Observer $observer)
|
| 139 |
{
|
| 140 |
if (!Mage::helper('simple_relevance')->enabled()) {
|
| 141 |
-
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
try {
|
| 145 |
-
$product = $observer->getEvent()->getProduct();
|
| 146 |
|
|
|
|
| 147 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 148 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
|
|
|
| 149 |
$dict = Mage::helper('simple_relevance')->getProductDict($product);
|
| 150 |
|
| 151 |
// categories should be a string of ';'-separated values
|
|
@@ -163,7 +167,7 @@ class SimpleRelevance_Integration_Model_Observer
|
|
| 163 |
'data_dict' => $dict,
|
| 164 |
);
|
| 165 |
|
| 166 |
-
$api->postItems($data);
|
| 167 |
}
|
| 168 |
|
| 169 |
catch (Exception $e) {
|
| 16 |
*/
|
| 17 |
public function massaction($observer)
|
| 18 |
{
|
|
|
|
|
|
|
|
|
|
| 19 |
if (!Mage::helper('simple_relevance')->enabled()) {
|
| 20 |
return $this;
|
| 21 |
}
|
| 22 |
|
| 23 |
+
$block = $observer->getEvent()->getBlock();
|
| 24 |
+
$action = $block->getRequest()->getControllerName();
|
| 25 |
+
|
| 26 |
if (get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction') {
|
| 27 |
$this->_block = $block;
|
| 28 |
|
| 60 |
* Send new order to SimpleRelevance API
|
| 61 |
*
|
| 62 |
* @param Varien_Event_Observer $observer
|
| 63 |
+
* @return SimpleRelevance_Integration_Model_Observer
|
| 64 |
*/
|
| 65 |
public function pushPurchase(Varien_Event_Observer $observer)
|
| 66 |
{
|
| 69 |
}
|
| 70 |
|
| 71 |
try {
|
| 72 |
+
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 73 |
+
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 74 |
|
| 75 |
$orderId = (int)(Mage::getSingleton('checkout/type_onepage')->getCheckout()->getLastOrderId());
|
| 76 |
+
if (!$orderId) {
|
| 77 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
| 78 |
+
->setOrder('increment_id','DESC')
|
| 79 |
+
->setPageSize(1)
|
| 80 |
+
->setCurPage(1);
|
| 81 |
+
$orderId = $orders->getFirstItem()->getEntityId();
|
| 82 |
+
}
|
| 83 |
|
| 84 |
if ($orderId) {
|
| 85 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 86 |
+
|
| 87 |
if ($order->getId()) {
|
| 88 |
$purchase = Mage::getModel('simple_relevance/purchase', $order);
|
| 89 |
$postData = $purchase->getPostData();
|
| 90 |
|
|
|
|
|
|
|
|
|
|
| 91 |
foreach ($postData['items'] as $p) {
|
| 92 |
+
$api->postPurchases($p, false);
|
| 93 |
}
|
| 94 |
}
|
| 95 |
}
|
| 107 |
* Automatically send customer when creating one.
|
| 108 |
*
|
| 109 |
* @param Varien_Event_Observer $observer
|
| 110 |
+
* @return SimpleRelevance_Integration_Model_Observer or void
|
| 111 |
*/
|
| 112 |
public function pushCustomer(Varien_Event_Observer $observer)
|
| 113 |
{
|
| 116 |
}
|
| 117 |
|
| 118 |
try {
|
|
|
|
|
|
|
| 119 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 120 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 121 |
|
| 122 |
+
$customer = $observer->getEvent()->getCustomer();
|
| 123 |
$customerData = array(
|
| 124 |
'email' => $customer->getEmail(),
|
| 125 |
'user_id' => $customer->getId(),
|
| 126 |
);
|
| 127 |
|
| 128 |
+
$api->postUsers($customerData, false);
|
| 129 |
}
|
| 130 |
|
| 131 |
catch (Exception $e) {
|
| 138 |
* Automatically send Catalog-Product when creating or modifying it.
|
| 139 |
*
|
| 140 |
* @param Varien_Event_Observer $observer
|
| 141 |
+
* @return SimpleRelevance_Integration_Model_Observer or void
|
| 142 |
*/
|
| 143 |
public function pushItem(Varien_Event_Observer $observer)
|
| 144 |
{
|
| 145 |
if (!Mage::helper('simple_relevance')->enabled()) {
|
| 146 |
+
return $this;
|
| 147 |
}
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
+
try {
|
| 150 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 151 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 152 |
+
$product = $observer->getEvent()->getProduct();
|
| 153 |
$dict = Mage::helper('simple_relevance')->getProductDict($product);
|
| 154 |
|
| 155 |
// categories should be a string of ';'-separated values
|
| 167 |
'data_dict' => $dict,
|
| 168 |
);
|
| 169 |
|
| 170 |
+
$api->postItems($data, false);
|
| 171 |
}
|
| 172 |
|
| 173 |
catch (Exception $e) {
|
|
@@ -22,13 +22,11 @@ class SimpleRelevance_Integration_Model_Purchase
|
|
| 22 |
*/
|
| 23 |
public function getPostData()
|
| 24 |
{
|
| 25 |
-
|
| 26 |
-
$data['items'] = $this->getItems();
|
| 27 |
-
return $data;
|
| 28 |
}
|
| 29 |
|
| 30 |
/**
|
| 31 |
-
* Get items purchased
|
| 32 |
*
|
| 33 |
* @return array
|
| 34 |
*/
|
|
@@ -43,7 +41,7 @@ class SimpleRelevance_Integration_Model_Purchase
|
|
| 43 |
'item_id' => $item->getProductId(),
|
| 44 |
'email' => $this->_order->getCustomerEmail(),
|
| 45 |
'timestamp' => $date,
|
| 46 |
-
'action_type' => 1
|
| 47 |
);
|
| 48 |
}
|
| 49 |
|
| 22 |
*/
|
| 23 |
public function getPostData()
|
| 24 |
{
|
| 25 |
+
return array('items' => $this->getItems());
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
/**
|
| 29 |
+
* Get items purchased in this order
|
| 30 |
*
|
| 31 |
* @return array
|
| 32 |
*/
|
| 41 |
'item_id' => $item->getProductId(),
|
| 42 |
'email' => $this->_order->getCustomerEmail(),
|
| 43 |
'timestamp' => $date,
|
| 44 |
+
'action_type' => 1 // action_type 1 is a purchase in SimpleRelevance's API
|
| 45 |
);
|
| 46 |
}
|
| 47 |
|
|
@@ -16,46 +16,38 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
|
|
| 16 |
public function massCustomerAction()
|
| 17 |
{
|
| 18 |
try {
|
| 19 |
-
$customers = $this->getRequest()->getPost('customer', array());
|
| 20 |
-
$sent = 0;
|
| 21 |
-
$notSent = 0;
|
| 22 |
-
|
| 23 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 24 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
|
|
|
|
|
|
| 25 |
|
| 26 |
foreach ($customers as $customerId) {
|
| 27 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 28 |
|
| 29 |
$customerData = array(
|
| 30 |
-
'email' => $customer->
|
| 31 |
'user_id' => $customer->getId(),
|
| 32 |
);
|
| 33 |
|
| 34 |
-
$
|
| 35 |
-
|
| 36 |
-
if (!$api->errorCode) {
|
| 37 |
-
$sent++;
|
| 38 |
-
} else {
|
| 39 |
-
$this->_getSession()->addError($this->__('Error on customer #%s, - %s -', $customer->getId(), $api->errorMessage));
|
| 40 |
-
$notSent++;
|
| 41 |
-
}
|
| 42 |
}
|
| 43 |
|
| 44 |
-
|
| 45 |
-
if ($sent) {
|
| 46 |
-
$this->_getSession()->addError($this->__('%s customer(s) were not sent.', $notSent));
|
| 47 |
-
} else {
|
| 48 |
-
$this->_getSession()->addError($this->__('No customer(s) were sent successfully.'));
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
|
| 52 |
-
if ($
|
| 53 |
-
$this->_getSession()->
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
| 57 |
catch (Exception $e) {
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
$this->_redirect('adminhtml/customer/index');
|
| 60 |
}
|
| 61 |
|
|
@@ -69,16 +61,13 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
|
|
| 69 |
public function massInventoryAction()
|
| 70 |
{
|
| 71 |
try {
|
| 72 |
-
$products = $this->getRequest()->getPost('product', array());
|
| 73 |
-
$sent = 0;
|
| 74 |
-
$notSent = 0;
|
| 75 |
-
|
| 76 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 77 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
|
|
|
|
|
|
| 78 |
|
| 79 |
foreach ($products as $productId) {
|
| 80 |
$product = Mage::getModel('catalog/product')->load($productId);
|
| 81 |
-
|
| 82 |
$dict = Mage::helper('simple_relevance')->getProductDict($product);
|
| 83 |
|
| 84 |
// categories should be a string of ';'-separated values
|
|
@@ -91,35 +80,31 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
|
|
| 91 |
$dict['categories'] = $category_str;
|
| 92 |
|
| 93 |
$data = array(
|
| 94 |
-
'item_name' => $product->
|
| 95 |
'item_id' => $product->getId(),
|
| 96 |
'data_dict' => $dict,
|
| 97 |
);
|
| 98 |
|
| 99 |
-
$
|
| 100 |
-
|
| 101 |
-
if (!$api->errorCode) {
|
| 102 |
-
$sent++;
|
| 103 |
-
} else {
|
| 104 |
-
$this->_getSession()->addError($this->__('Error on items #%s, - %s -', $product->getId(), $api->errorMessage));
|
| 105 |
-
$notSent++;
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
if ($notSent) {
|
| 109 |
-
if ($sent) {
|
| 110 |
-
$this->_getSession()->addError($this->__('%s item(s) were not sent.', $notSent));
|
| 111 |
-
} else {
|
| 112 |
-
$this->_getSession()->addError($this->__('No item(s) were sent successfully.'));
|
| 113 |
-
}
|
| 114 |
}
|
| 115 |
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
|
| 121 |
catch (Exception $e) {
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
$this->_redirect('adminhtml/catalog_product/index');
|
| 124 |
}
|
| 125 |
|
|
@@ -133,12 +118,10 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
|
|
| 133 |
public function massOrderAction()
|
| 134 |
{
|
| 135 |
try {
|
| 136 |
-
$orders = $this->getRequest()->getPost('order_ids', array());
|
| 137 |
-
$sent = 0;
|
| 138 |
-
$notSent = 0;
|
| 139 |
-
|
| 140 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 141 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
|
|
|
|
|
|
| 142 |
|
| 143 |
foreach ($orders as $orderId) {
|
| 144 |
$order = Mage::getModel('sales/order')->load($orderId);
|
|
@@ -151,32 +134,25 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
|
|
| 151 |
$postData = $purchase->getPostData();
|
| 152 |
|
| 153 |
foreach($postData['items'] as $p) {
|
| 154 |
-
$
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
if (!$api->errorCode) {
|
| 158 |
-
$sent++;
|
| 159 |
-
} else {
|
| 160 |
-
$this->_getSession()->addError($this->__('Error on order #%s, - %s -', $order->getId(), $api->errorMessage));
|
| 161 |
-
$notSent++;
|
| 162 |
}
|
| 163 |
}
|
|
|
|
| 164 |
|
| 165 |
-
if ($
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
$this->_getSession()->addError($this->__('No order(s) were sent successfully.'));
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
if ($sent) {
|
| 174 |
-
$this->_getSession()->addSuccess($this->__('%s order(s) have been sent successfully.', $sent));
|
| 175 |
}
|
| 176 |
}
|
| 177 |
|
| 178 |
catch (Exception $e) {
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
$this->_redirect('adminhtml/sales_order/index');
|
| 181 |
}
|
| 182 |
|
| 16 |
public function massCustomerAction()
|
| 17 |
{
|
| 18 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 20 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 21 |
+
$customers = $this->getRequest()->getPost('customer', array());
|
| 22 |
+
$customerArray = array();
|
| 23 |
|
| 24 |
foreach ($customers as $customerId) {
|
| 25 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 26 |
|
| 27 |
$customerData = array(
|
| 28 |
+
'email' => $customer->getData('email'),
|
| 29 |
'user_id' => $customer->getId(),
|
| 30 |
);
|
| 31 |
|
| 32 |
+
$customerArray[] = $customerData; // append
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
+
$result = $api->postUsers($customerArray, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
if ($api->errorCode) {
|
| 38 |
+
$this->_getSession()->addError($this->__('Error uploading customer(s) to SimpleRelevance. Email support@simplerelevance.com to let us know.'));
|
| 39 |
+
} else {
|
| 40 |
+
$this->_getSession()->addSuccess($this->__('Customer(s) have been uploaded to SimpleRelevance.'));
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
| 44 |
catch (Exception $e) {
|
| 45 |
+
try {
|
| 46 |
+
$api->_log($e->getMessage());
|
| 47 |
+
}
|
| 48 |
+
catch (Exception $e) {
|
| 49 |
+
// do nothing
|
| 50 |
+
}
|
| 51 |
$this->_redirect('adminhtml/customer/index');
|
| 52 |
}
|
| 53 |
|
| 61 |
public function massInventoryAction()
|
| 62 |
{
|
| 63 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 65 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 66 |
+
$products = $this->getRequest()->getPost('product', array());
|
| 67 |
+
$productArray = array();
|
| 68 |
|
| 69 |
foreach ($products as $productId) {
|
| 70 |
$product = Mage::getModel('catalog/product')->load($productId);
|
|
|
|
| 71 |
$dict = Mage::helper('simple_relevance')->getProductDict($product);
|
| 72 |
|
| 73 |
// categories should be a string of ';'-separated values
|
| 80 |
$dict['categories'] = $category_str;
|
| 81 |
|
| 82 |
$data = array(
|
| 83 |
+
'item_name' => $product->getData('name'),
|
| 84 |
'item_id' => $product->getId(),
|
| 85 |
'data_dict' => $dict,
|
| 86 |
);
|
| 87 |
|
| 88 |
+
$productArray[] = $data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
+
$result = $api->postItems($productArray, true);
|
| 92 |
+
|
| 93 |
+
if ($api->errorCode) {
|
| 94 |
+
$this->_getSession()->addError($this->__('Error uploading item(s) to SimpleRelevance. Email support@simplerelevance.com to let us know.'));
|
| 95 |
+
} else {
|
| 96 |
+
$this->_getSession()->addSuccess($this->__('Item(s) have been uploaded to SimpleRelevance.'));
|
| 97 |
}
|
| 98 |
}
|
| 99 |
|
| 100 |
catch (Exception $e) {
|
| 101 |
+
try {
|
| 102 |
+
$api->_log($e->getMessage());
|
| 103 |
+
$this->_getSession()->addError($this->__('No item(s) were uploaded to SimpleRelevance.'));
|
| 104 |
+
}
|
| 105 |
+
catch (Exception $e) {
|
| 106 |
+
// do nothing
|
| 107 |
+
}
|
| 108 |
$this->_redirect('adminhtml/catalog_product/index');
|
| 109 |
}
|
| 110 |
|
| 118 |
public function massOrderAction()
|
| 119 |
{
|
| 120 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
$api_arr = array(Mage::helper('simple_relevance')->config('apikey'), Mage::helper('simple_relevance')->config('sitename'));
|
| 122 |
$api = Mage::getModel('simple_relevance/api', $api_arr);
|
| 123 |
+
$orders = $this->getRequest()->getPost('order_ids', array());
|
| 124 |
+
$orderArray = array();
|
| 125 |
|
| 126 |
foreach ($orders as $orderId) {
|
| 127 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 134 |
$postData = $purchase->getPostData();
|
| 135 |
|
| 136 |
foreach($postData['items'] as $p) {
|
| 137 |
+
$orderArray[] = $p;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
}
|
| 139 |
}
|
| 140 |
+
$result = $api->postPurchases($orderArray, true);
|
| 141 |
|
| 142 |
+
if ($api->errorCode) {
|
| 143 |
+
$this->_getSession()->addError($this->__('Error uploading purchases(s) to SimpleRelevance. Email support@simplerelevance.com to let us know.'));
|
| 144 |
+
} else {
|
| 145 |
+
$this->_getSession()->addSuccess($this->__('Purchases(s) have been uploaded to SimpleRelevance.'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
}
|
| 147 |
}
|
| 148 |
|
| 149 |
catch (Exception $e) {
|
| 150 |
+
try {
|
| 151 |
+
$api->_log($e->getMessage());
|
| 152 |
+
}
|
| 153 |
+
catch (Exception $e) {
|
| 154 |
+
// do nothing
|
| 155 |
+
}
|
| 156 |
$this->_redirect('adminhtml/sales_order/index');
|
| 157 |
}
|
| 158 |
|
|
File without changes
|
|
@@ -38,6 +38,14 @@
|
|
| 38 |
</simplerelevance_push_item>
|
| 39 |
</observers>
|
| 40 |
</catalog_product_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</events>
|
| 42 |
</global>
|
| 43 |
<frontend>
|
| 38 |
</simplerelevance_push_item>
|
| 39 |
</observers>
|
| 40 |
</catalog_product_save_after>
|
| 41 |
+
<sales_order_save_after>
|
| 42 |
+
<observers>
|
| 43 |
+
<simplerelevance_push_purchase>
|
| 44 |
+
<class>simple_relevance/observer</class>
|
| 45 |
+
<method>pushPurchase</method>
|
| 46 |
+
</simplerelevance_push_purchase>
|
| 47 |
+
</observers>
|
| 48 |
+
</sales_order_save_after>
|
| 49 |
</events>
|
| 50 |
</global>
|
| 51 |
<frontend>
|
|
@@ -34,7 +34,7 @@
|
|
| 34 |
<show_in_default>1</show_in_default>
|
| 35 |
<show_in_website>0</show_in_website>
|
| 36 |
<show_in_store>1</show_in_store>
|
| 37 |
-
<comment><![CDATA[Your SimpleRelevance site name.<br />You can find it on your SimpleRelevance dashboard under <i>Account -> Site
|
| 38 |
</sitename>
|
| 39 |
<apikey translate="label comment">
|
| 40 |
<label>API Key</label>
|
|
@@ -43,7 +43,7 @@
|
|
| 43 |
<show_in_default>1</show_in_default>
|
| 44 |
<show_in_website>0</show_in_website>
|
| 45 |
<show_in_store>1</show_in_store>
|
| 46 |
-
<comment><![CDATA[Your SimpleRelevance API Key.<br />You can find it on your SimpleRelevance dashboard under <i>Account -> API Key</i>]]></comment>
|
| 47 |
</apikey>
|
| 48 |
<debug translate="label comment">
|
| 49 |
<label>Debug Mode</label>
|
| 34 |
<show_in_default>1</show_in_default>
|
| 35 |
<show_in_website>0</show_in_website>
|
| 36 |
<show_in_store>1</show_in_store>
|
| 37 |
+
<comment><![CDATA[Your SimpleRelevance site name.<br />You can find it on your SimpleRelevance dashboard under <i>My Account -> Site Name</i>]]></comment>
|
| 38 |
</sitename>
|
| 39 |
<apikey translate="label comment">
|
| 40 |
<label>API Key</label>
|
| 43 |
<show_in_default>1</show_in_default>
|
| 44 |
<show_in_website>0</show_in_website>
|
| 45 |
<show_in_store>1</show_in_store>
|
| 46 |
+
<comment><![CDATA[Your SimpleRelevance API Key.<br />You can find it on your SimpleRelevance dashboard under <i>My Account -> API Key</i>]]></comment>
|
| 47 |
</apikey>
|
| 48 |
<debug translate="label comment">
|
| 49 |
<label>Debug Mode</label>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<modules>
|
| 4 |
<SimpleRelevance_Integration>
|
| 5 |
<active>true</active>
|
| 6 |
-
<codePool>
|
| 7 |
<depends>
|
| 8 |
<Mage_Sales />
|
| 9 |
<Mage_Customer />
|
| 3 |
<modules>
|
| 4 |
<SimpleRelevance_Integration>
|
| 5 |
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
<depends>
|
| 8 |
<Mage_Sales />
|
| 9 |
<Mage_Customer />
|
|
File without changes
|
|
@@ -1,58 +1,2 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
-
<package>
|
| 3 |
-
<name>SimpleRelevance_Integration</name>
|
| 4 |
-
<version>1.5.1</version>
|
| 5 |
-
<stability>stable</stability>
|
| 6 |
-
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
-
<channel>community</channel>
|
| 8 |
-
<extends/>
|
| 9 |
-
<summary>SimpleRelevance integration module</summary>
|
| 10 |
-
<description>Featuring customers, products and orders.</description>
|
| 11 |
-
<notes>-- version 1.5.1
|
| 12 |
-
Updated for wider Magento support
|
| 13 |
-

|
| 14 |
-
-- version 1.5.0
|
| 15 |
-
Updated for our new API with SSL
|
| 16 |
-

|
| 17 |
-
-- version 1.0.4
|
| 18 |
-
Security Update
|
| 19 |
-

|
| 20 |
-
-- version 1.0.3
|
| 21 |
-
what 1.0.2 should be
|
| 22 |
-

|
| 23 |
-
-- version 1.0.2
|
| 24 |
-
better url support
|
| 25 |
-

|
| 26 |
-
-- version 1.0.1
|
| 27 |
-
Making all request async by default
|
| 28 |
-

|
| 29 |
-
-- version 1.0.0
|
| 30 |
-
Rename of dict parameter on inventory items
|
| 31 |
-

|
| 32 |
-
-- version 0.0.9
|
| 33 |
-
Category IDS names instead of integers when sending inventory items
|
| 34 |
-

|
| 35 |
-
-- version 0.0.8
|
| 36 |
-
Allowing to send ALL products and customers on each save
|
| 37 |
-

|
| 38 |
-
-- version 0.0.7
|
| 39 |
-
Bug fix on auto submit products and users on Magento 1.6.2.0
|
| 40 |
-

|
| 41 |
-
-- version 0.0.6
|
| 42 |
-
Correcting but on orders export (timestamp)
|
| 43 |
-

|
| 44 |
-
-- version 0.0.5
|
| 45 |
-
Automatic Customer and Product submission
|
| 46 |
-

|
| 47 |
-
-- version 0.0.4
|
| 48 |
-
Bug fixes, new data on product import, debug facility
|
| 49 |
-

|
| 50 |
-
-- version 0.0.1
|
| 51 |
-
First release</notes>
|
| 52 |
-
<authors><author><name>SimpleRelevance DEV team</name><user>simplerelevance</user><email>info@simplerelevance.com</email></author></authors>
|
| 53 |
-
<date>2013-09-09</date>
|
| 54 |
-
<time>20:33:32</time>
|
| 55 |
-
<contents><target name="magecommunity"><dir name="SimpleRelevance"><dir name="Integration"><dir name="Helper"><file name="Data.php" hash="d7c238082d54ce8aabc291b0ffab862c"/></dir><dir name="Model"><file name="Api.php" hash="7f666e0591fcdd3b78758cfbe33b6cea"/><file name="Observer.php" hash="8d35a597184cf902c2a6c859d3286c00"/><file name="Purchase.php" hash="3b657564042c912e89488ff0d29c3091"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="ef9863bba66c9b2ba088553fa4725a65"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="18e9829f6252920f6bf01a5340377b3a"/><file name="config.xml" hash="3ba8219cb93dba44fb1a1e7bcfadcd49"/><file name="system.xml" hash="d94f64025adb391d15393943482834ed"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="simple_relevance.xml" hash="f0d73f30b7aeff70f63b295327ac906c"/></dir><dir name="simple_relevance"><file name="css.css" hash="c354dd9c0e48bdb99089b1756058efc1"/><dir name="images"><file name="box-tab.png" hash="208977131fcbe078f10af53295ac686c"/><file name="simplerelevance-header.png" hash="c25099645618a32b8fdb8d4d7786cf2c"/></dir><file name="js.js" hash="5831e6e503ebd86f93e07230b56a6d2f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SimpleRelevance_Integration.xml" hash="0edc0425053fc8bb7dd3dde28b651a53"/></dir></target><target name="magelocale"><dir name="en_US"><file name="SimpleRelevance_Integration.csv" hash="62ea0be4e1c074ee5d975c0dc4a8dc77"/></dir></target></contents>
|
| 56 |
-
<compatible/>
|
| 57 |
-
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 58 |
-
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
+
<package><name>SimpleRelevance_Integration</name><version>1.6.0</version><stability>stable</stability><license>OSL v3.0</license><channel>community</channel><extends></extends><summary>SimpleRelevance integration module</summary><description>Featuring customers, products and orders</description><notes>-- version 1.6.0&#xD; Faster bulk customer, item, and order upload to SimpleRelevance. Added Magento 1.8 and 1.9 support. Dropped Magento 1.4 support&#xD; &#xD; -- version 1.5.1&#xD; Updated for wider Magento support&#xD; &#xD; -- version 1.5.0&#xD; Updated for our new API with SSL&#xD; &#xD; -- version 1.0.4&#xD; Security Update&#xD; &#xD; -- version 1.0.3&#xD; what 1.0.2 should be&#xD; &#xD; -- version 1.0.2&#xD; better url support&#xD; &#xD; -- version 1.0.1&#xD; Making all request async by default&#xD; &#xD; -- version 1.0.0&#xD; Rename of dict parameter on inventory items&#xD; &#xD; -- version 0.0.9&#xD; Category IDS names instead of integers when sending inventory items&#xD; &#xD; -- version 0.0.8&#xD; Allowing to send ALL products and customers on each save&#xD; &#xD; -- version 0.0.7&#xD; Bug fix on auto submit products and users on Magento 1.6.2.0&#xD; &#xD; -- version 0.0.6&#xD; Correcting but on orders export (timestamp)&#xD; &#xD; -- version 0.0.5&#xD; Automatic Customer and Product submission&#xD; &#xD; -- version 0.0.4&#xD; Bug fixes, new data on product import, debug facility&#xD; &#xD; -- version 0.0.1&#xD; First release</notes><authors><author><name>SimpleRelevance</name><user>simplerelevance</user><email>info@simplerelevance.com</email></author></authors><date>2014-07-14</date><time>9:59:10</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="SimpleRelevance"><dir name="Integration"><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="fe8892d62f1d5d413220b5613c253fe1"/></dir></dir><dir name="Model"><file name="Api.php" hash="34ba4827f897aa0e078da747d1879611"/><file name="Observer.php" hash="e3186cb66183ab1e669eec931838d55b"/><file name="Purchase.php" hash="51334af6fe746b5ee9a66e4417d78be9"/></dir><dir name="Helper"><file name="Data.php" hash="98270697c69d3342eafae6c3ebcbc3aa"/></dir><dir name="etc"><file name="adminhtml.xml" hash="18e9829f6252920f6bf01a5340377b3a"/><file name="config.xml" hash="414458a754e4ba94be0ebb0fb38f3f36"/><file name="system.xml" hash="a37bf734610860a36ffb9d7501cf091e"/></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="SimpleRelevance_Integration.csv" hash="62ea0be4e1c074ee5d975c0dc4a8dc77"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="simple_relevance"><file name="css.css" hash="c354dd9c0e48bdb99089b1756058efc1"/><file name="js.js" hash="5831e6e503ebd86f93e07230b56a6d2f"/><dir name="images"><file name="box-tab.png" hash="208977131fcbe078f10af53295ac686c"/><file name="simplerelevance-header.png" hash="c25099645618a32b8fdb8d4d7786cf2c"/></dir></dir><dir name="layout"><file name="simple_relevance.xml" hash="f0d73f30b7aeff70f63b295327ac906c"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="SimpleRelevance_Integration.xml" hash="6ad0b704a9e62de159f09babfe2482d5"/></dir></dir></dir></target></contents></package>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
