Mv_Megaventory - Version 2.2.0

Version Notes

This update adds -the much requested- support for multiple Magento stores! More specifically, multiple Magento stores can pull inventory information from a single Megaventory account while Sales Orders from all Magento stores will be pushed to the same Megaventory account.

This extension is also fully operational with single Mageno installations.

Finally, a few bugs have been fixed and various code optimizations have been applied.

Download this release

Release Info

Developer Megaventory Megaventory
Extension Mv_Megaventory
Version 2.2.0
Comparing to
See all releases


Code changes from version 2.1.0 to 2.2.0

app/code/local/Mv/Megaventory/Block/Adminhtml/Megaventorysettings.php CHANGED
@@ -8,6 +8,7 @@ class Mv_Megaventory_Block_Adminhtml_Megaventorysettings extends Mage_Core_Block
8
  private $_defaultMagentoCurrency;
9
  private $_defaultMegaventoryCurrency;
10
  private $_mvConnectivity = false;
 
11
 
12
  public function __construct()
13
  {
@@ -20,6 +21,12 @@ class Mv_Megaventory_Block_Adminhtml_Megaventorysettings extends Mage_Core_Block
20
 
21
  $this->_defaultMagentoCurrency = Mage::getStoreConfig('currency/options/default');
22
 
 
 
 
 
 
 
23
  parent::__construct();
24
  }
25
 
@@ -61,6 +68,11 @@ class Mv_Megaventory_Block_Adminhtml_Megaventorysettings extends Mage_Core_Block
61
  return $this->_mvConnectivity;
62
  }
63
 
 
 
 
 
 
64
  public function checkBaseCurrencies()
65
  {
66
  if ($this->_defaultMagentoCurrency != $this->_defaultMegaventoryCurrency)
8
  private $_defaultMagentoCurrency;
9
  private $_defaultMegaventoryCurrency;
10
  private $_mvConnectivity = false;
11
+ private $_magentoInstallations = false;
12
 
13
  public function __construct()
14
  {
21
 
22
  $this->_defaultMagentoCurrency = Mage::getStoreConfig('currency/options/default');
23
 
24
+ if ($this->_mvConnectivity !== false){
25
+ $megaventoryHelper = Mage::helper('megaventory');
26
+ $setting = $megaventoryHelper->getMegaventoryAccountSettings('MagentoInstallations');
27
+ $this->_magentoInstallations = $setting['0']['SettingValue'];
28
+ }
29
+
30
  parent::__construct();
31
  }
32
 
68
  return $this->_mvConnectivity;
69
  }
70
 
71
+ public function getMagentoInstallations()
72
+ {
73
+ return $this->_magentoInstallations;
74
+ }
75
+
76
  public function checkBaseCurrencies()
77
  {
78
  if ($this->_defaultMagentoCurrency != $this->_defaultMegaventoryCurrency)
app/code/local/Mv/Megaventory/Block/Adminhtml/Updates/Grid.php CHANGED
@@ -109,9 +109,14 @@ class Mv_Megaventory_Block_Adminhtml_Updates_Grid extends Mage_Adminhtml_Block_W
109
 
110
  $key = Mage::getStoreConfig('megaventory/general/apikey');
111
 
 
 
 
 
112
  $data = array
113
  (
114
- 'APIKEY' => $key
 
115
  );
116
 
117
  $helper = Mage::helper('megaventory');
109
 
110
  $key = Mage::getStoreConfig('megaventory/general/apikey');
111
 
112
+ $magentoId = Mage::getStoreConfig('megaventory/general/magentoid');
113
+ if (!isset($magentoId))
114
+ $magentoId = "magento";
115
+
116
  $data = array
117
  (
118
+ 'APIKEY' => $key,
119
+ 'query' => 'mv.Application = "'.$magentoId.'"'
120
  );
121
 
122
  $helper = Mage::helper('megaventory');
app/code/local/Mv/Megaventory/Helper/Category.php CHANGED
@@ -50,12 +50,12 @@ class Mv_Megaventory_Helper_Category extends Mage_Core_Helper_Abstract
50
  $collection->addAttributeToSelect('entity_id');
51
  $collection->addAttributeToSelect('name');
52
  $collection->getSelect()->order('level');
53
- $collection->setPageSize(100);
54
  $collection->setCurPage($page);
55
  $totalCollectionSize = $collection->getSize();
56
 
57
  $isLastPage = false;
58
- if ((int)($totalCollectionSize/100) == $page-1)
59
  $isLastPage = true;
60
 
61
 
@@ -163,10 +163,20 @@ class Mv_Megaventory_Helper_Category extends Mage_Core_Helper_Abstract
163
  }
164
  else
165
  {
166
- $entityId = $json_result['entityID'];//if category exists just sync them
167
- if (!empty($entityId) && $entityId > 0){
168
- $this->updateCategory($category->getId(), $entityId);
169
- return 1;
 
 
 
 
 
 
 
 
 
 
170
  }
171
  }
172
 
50
  $collection->addAttributeToSelect('entity_id');
51
  $collection->addAttributeToSelect('name');
52
  $collection->getSelect()->order('level');
53
+ $collection->setPageSize(30);
54
  $collection->setCurPage($page);
55
  $totalCollectionSize = $collection->getSize();
56
 
57
  $isLastPage = false;
58
+ if ((int)($totalCollectionSize/30) == $page-1)
59
  $isLastPage = true;
60
 
61
 
163
  }
164
  else
165
  {
166
+ $entityId = $json_result['entityID'];//if category exists just sync them
167
+ if (!empty($entityId) && $entityId > 0){
168
+ if (strpos( $json_result['ResponseStatus']['Message'], 'in the past and was deleted') !== false) {
169
+ $result = array(
170
+ 'mvCategoryId' => $json_result['entityID'],
171
+ 'errorcode' => 'isdeleted'
172
+ );
173
+ return $result;
174
+ }
175
+ else
176
+ {
177
+ $this->updateCategory($category->getId(), $entityId);
178
+ return 1;
179
+ }
180
  }
181
  }
182
 
app/code/local/Mv/Megaventory/Helper/Common.php CHANGED
@@ -34,7 +34,8 @@ class Mv_Megaventory_Helper_Common
34
  return 'There is a problem with your megaventory credentials!';
35
  else
36
  {
37
- $message = '';
 
38
  foreach ($accountSettings as $index => $accountSetting) {
39
  $settingName = $accountSetting['SettingName'];
40
  $settingValue = $accountSetting['SettingValue'];
@@ -58,9 +59,20 @@ class Mv_Megaventory_Helper_Common
58
  }
59
  } */
60
  if ($settingName == 'isOrdersModuleEnabled' && $settingValue == false)
61
- $message .= 'Ordering module in Megaventory is not enabled.';
 
 
 
62
 
63
- }
 
 
 
 
 
 
 
 
64
  if (strlen($message) > 0){
65
  return $message;
66
  }
34
  return 'There is a problem with your megaventory credentials!';
35
  else
36
  {
37
+ $message = '';
38
+ $magentoInstallationsIsSet = false;
39
  foreach ($accountSettings as $index => $accountSetting) {
40
  $settingName = $accountSetting['SettingName'];
41
  $settingValue = $accountSetting['SettingValue'];
59
  }
60
  } */
61
  if ($settingName == 'isOrdersModuleEnabled' && $settingValue == false)
62
+ $message .= 'Ordering module in Megaventory is not enabled.';
63
+
64
+ if ($settingName == 'MagentoInstallations')
65
+ $magentoInstallationsIsSet = true;
66
 
67
+ if ($settingName == 'MagentoInstallations' && $settingValue == 0)
68
+ $magentoInstallationsIsSet = false;
69
+
70
+
71
+ }
72
+ if (!$magentoInstallationsIsSet){
73
+ $message .= "You haven't set in Megaventory the number of your active Magento installations.";
74
+ }
75
+
76
  if (strlen($message) > 0){
77
  return $message;
78
  }
app/code/local/Mv/Megaventory/Helper/Customer.php CHANGED
@@ -332,17 +332,28 @@ class Mv_Megaventory_Helper_Customer extends Mage_Core_Helper_Abstract
332
  if (strcmp('Insert', $mvRecordAction) == 0){
333
  $this->updateCustomer($customer->getId(), $json_result ['mvSupplierClient'] ['SupplierClientID']);
334
  return $json_result ['mvSupplierClient'] ['SupplierClientID'];
335
- }
 
336
  }
337
  else
338
  {
339
  $entityId = $json_result['entityID'];
340
- if (!empty($entityId) && $entityId > 0){
341
- $this->updateCustomer($customer->getId(), $entityId);
342
- $data['mvSupplierClient']['SupplierClientID'] = $entityId;
343
- $data['mvRecordAction'] = 'Update';
344
- $json_result = $helper->makeJsonRequest($data ,'SupplierClientUpdate',$customer->getId());
345
- return $entityId;
 
 
 
 
 
 
 
 
 
 
346
  }
347
  }
348
  }
332
  if (strcmp('Insert', $mvRecordAction) == 0){
333
  $this->updateCustomer($customer->getId(), $json_result ['mvSupplierClient'] ['SupplierClientID']);
334
  return $json_result ['mvSupplierClient'] ['SupplierClientID'];
335
+ }
336
+ return $json_result['entityID'];
337
  }
338
  else
339
  {
340
  $entityId = $json_result['entityID'];
341
+ if (!empty($entityId) && $entityId > 0){
342
+ if (strpos( $json_result['ResponseStatus']['Message'], 'and was since deleted') !== false) {
343
+ $result = array(
344
+ 'mvCustomerId' => $json_result['entityID'],
345
+ 'errorcode' => 'isdeleted'
346
+ );
347
+ return $result;
348
+ }
349
+ else
350
+ {
351
+ $this->updateCustomer($customer->getId(), $entityId);
352
+ $data['mvSupplierClient']['SupplierClientID'] = $entityId;
353
+ $data['mvRecordAction'] = 'Update';
354
+ $json_result = $helper->makeJsonRequest($data ,'SupplierClientUpdate',$customer->getId());
355
+ return $entityId;
356
+ }
357
  }
358
  }
359
  }
app/code/local/Mv/Megaventory/Helper/Data.php CHANGED
@@ -89,8 +89,9 @@ class Mv_Megaventory_Helper_Data extends Mage_Core_Helper_Abstract
89
  //do not log gets
90
  if (strpos($action,'Get') === false)
91
  {
92
-
93
- $return_entity = implode("|",array_shift(array_values($json_result)));
 
94
  $event = array(
95
  'code' => $action,
96
  'result' => 'success',
89
  //do not log gets
90
  if (strpos($action,'Get') === false)
91
  {
92
+ $tmp = array_values($json_result);
93
+ $tmp2 = array_shift($tmp);
94
+ $return_entity = implode("|",$tmp2);
95
  $event = array(
96
  'code' => $action,
97
  'result' => 'success',
app/code/local/Mv/Megaventory/Helper/Order.php CHANGED
@@ -196,6 +196,11 @@ class Mv_Megaventory_Helper_Order extends Mage_Core_Helper_Abstract
196
 
197
  $productHelper = Mage::helper('megaventory/product');
198
  $megaventoryProductId = $productHelper->addProduct($product);
 
 
 
 
 
199
  }
200
  else
201
  $megaventoryProductId = $id;
@@ -374,7 +379,9 @@ class Mv_Megaventory_Helper_Order extends Mage_Core_Helper_Abstract
374
 
375
  $tags = trim($tags); */
376
 
377
-
 
 
378
 
379
  $data = array (
380
  'APIKEY' => Mage::getStoreConfig('megaventory/general/apikey'),
@@ -382,7 +389,7 @@ class Mv_Megaventory_Helper_Order extends Mage_Core_Helper_Abstract
382
  array (
383
  'SalesOrderNo' => $increment_id,
384
  'SalesOrderReferenceNo' => $increment_id,
385
- 'SalesOrderReferenceApplication' => 'MagentoCommunity',
386
  //always insert orders in base currency
387
  'SalesOrderCurrencyCode' => $baseCurrencyCode,
388
  //'SalesOrderCurrencyCode' => $orderCurrencyCode,
196
 
197
  $productHelper = Mage::helper('megaventory/product');
198
  $megaventoryProductId = $productHelper->addProduct($product);
199
+
200
+ if (is_array($megaventoryProductId)){
201
+ $megaventoryProductId = $megaventoryProductId['mvProductId'];
202
+ $productHelper->undeleteProduct($megaventoryProductId);
203
+ }
204
  }
205
  else
206
  $megaventoryProductId = $id;
379
 
380
  $tags = trim($tags); */
381
 
382
+ $magentoInstallationId = Mage::getStoreConfig('megaventory/general/magentoid');
383
+ if (!isset($magentoInstallationId))
384
+ $magentoInstallationId = "MagentoCommunity";
385
 
386
  $data = array (
387
  'APIKEY' => Mage::getStoreConfig('megaventory/general/apikey'),
389
  array (
390
  'SalesOrderNo' => $increment_id,
391
  'SalesOrderReferenceNo' => $increment_id,
392
+ 'SalesOrderReferenceApplication' => $magentoInstallationId,//magento, magento-2 ...
393
  //always insert orders in base currency
394
  'SalesOrderCurrencyCode' => $baseCurrencyCode,
395
  //'SalesOrderCurrencyCode' => $orderCurrencyCode,
app/code/local/Mv/Megaventory/Helper/Product.php CHANGED
@@ -29,6 +29,7 @@ class Mv_Megaventory_Helper_Product extends Mage_Core_Helper_Abstract
29
  {
30
 
31
  $productId = $product->getEntityId();
 
32
  $megaVentoryId = $product->getData('mv_product_id');
33
  $name = $product['name'];
34
  $sku = $product['sku'];
@@ -260,12 +261,22 @@ class Mv_Megaventory_Helper_Product extends Mage_Core_Helper_Abstract
260
  }
261
  else
262
  {
263
- $entityId = $json_result['entityID']; //if product exists just sync them
264
- if (!empty($entityId) && $entityId > 0){
265
- $this->updateProduct($productId,$entityId);
266
- $data['mvProduct']['ProductID'] = $entityId;
267
- $data['mvRecordAction'] = 'Update';
268
- $json_result = $helper->makeJsonRequest($data ,'ProductUpdate',$productId);
 
 
 
 
 
 
 
 
 
 
269
  }
270
  }
271
  }
@@ -523,11 +534,11 @@ class Mv_Megaventory_Helper_Product extends Mage_Core_Helper_Abstract
523
  ->addAttributeToSort('type_id','ASC');
524
 
525
 
526
- $simple_products->setPageSize(100);
527
  $simple_products->setCurPage($page);
528
  $totalCollectionSize = $simple_products->getSize();
529
  $isLastPage = false;
530
- if ((int)($totalCollectionSize/100) == $page-1)
531
  $isLastPage = true;
532
  /* if (isset($supplierAttributeId) && $supplierAttributeId != false)
533
  $simple_products->addAttributeToSelect($supplier); */
@@ -1357,5 +1368,14 @@ class Mv_Megaventory_Helper_Product extends Mage_Core_Helper_Abstract
1357
  $write->query($sql_insert);
1358
  }
1359
 
1360
-
 
 
 
 
 
 
 
 
 
1361
  }
29
  {
30
 
31
  $productId = $product->getEntityId();
32
+ $product = Mage::getModel('catalog/product')->load($productId);
33
  $megaVentoryId = $product->getData('mv_product_id');
34
  $name = $product['name'];
35
  $sku = $product['sku'];
261
  }
262
  else
263
  {
264
+ $entityId = $json_result['entityID'];
265
+ if (!empty($entityId) && $entityId > 0){
266
+ if (strpos( $json_result['ResponseStatus']['Message'], 'and was since deleted') !== false) {
267
+ $result = array(
268
+ 'mvProductId' => $json_result['entityID'],
269
+ 'errorcode' => 'isdeleted'
270
+ );
271
+ return $result;
272
+ }
273
+ else
274
+ {
275
+ $this->updateProduct($productId,$entityId);
276
+ $data['mvProduct']['ProductID'] = $entityId;
277
+ $data['mvRecordAction'] = 'Update';
278
+ $json_result = $helper->makeJsonRequest($data ,'ProductUpdate',$productId);
279
+ }
280
  }
281
  }
282
  }
534
  ->addAttributeToSort('type_id','ASC');
535
 
536
 
537
+ $simple_products->setPageSize(20);
538
  $simple_products->setCurPage($page);
539
  $totalCollectionSize = $simple_products->getSize();
540
  $isLastPage = false;
541
+ if ((int)($totalCollectionSize/20) == $page-1)
542
  $isLastPage = true;
543
  /* if (isset($supplierAttributeId) && $supplierAttributeId != false)
544
  $simple_products->addAttributeToSelect($supplier); */
1368
  $write->query($sql_insert);
1369
  }
1370
 
1371
+ public function undeleteProduct($mvProductId){
1372
+ $data = array(
1373
+ 'APIKEY' => Mage::getStoreConfig('megaventory/general/apikey'),
1374
+ 'ProductIDToUndelete' => $mvProductId
1375
+ );
1376
+
1377
+ $helper = Mage::helper('megaventory');
1378
+
1379
+ $helper->makeJsonRequest($data, 'ProductUndelete');
1380
+ }
1381
  }
app/code/local/Mv/Megaventory/Helper/Suppliers.php CHANGED
@@ -54,7 +54,8 @@ class Mv_Megaventory_Helper_Suppliers extends Mage_Core_Helper_Abstract
54
  'SupplierClientTaxID' => '',
55
  'SupplierClientComments' => '',
56
  ),
57
- 'mvRecordAction' => 'Insert' );
 
58
 
59
  $json_result = $helper->makeJsonRequest($data, 'SupplierClientUpdate',0);
60
 
54
  'SupplierClientTaxID' => '',
55
  'SupplierClientComments' => '',
56
  ),
57
+ 'mvRecordAction' => 'Insert',
58
+ 'mvGrantPermissionsToAllUsers' => true );
59
 
60
  $json_result = $helper->makeJsonRequest($data, 'SupplierClientUpdate',0);
61
 
app/code/local/Mv/Megaventory/Model/Category/Observer.php CHANGED
@@ -53,7 +53,17 @@ class Mv_Megaventory_Model_Category_Observer {
53
  {
54
  $entityId = $json_result['entityID'];//if category exists just sync them
55
  if (!empty($entityId) && $entityId > 0){
56
- $this->updateCategory($category->getId(), $entityId);
 
 
 
 
 
 
 
 
 
 
57
  }
58
  }
59
 
@@ -178,6 +188,20 @@ class Mv_Megaventory_Model_Category_Observer {
178
 
179
  $json_result = $helper->makeJsonRequest($data, 'ProductCategoryUpdate',$category->getEntityId());
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
182
 
183
  $children = $this->getChildrenCategories($category);
53
  {
54
  $entityId = $json_result['entityID'];//if category exists just sync them
55
  if (!empty($entityId) && $entityId > 0){
56
+ if (strpos( $json_result['ResponseStatus']['Message'], 'in the past and was deleted') !== false) {
57
+ $result = array(
58
+ 'mvCategoryId' => $json_result['entityID'],
59
+ 'errorcode' => 'isdeleted'
60
+ );
61
+ Mage::getSingleton('core/session')->addError('Category '.$name.' is flagged as deleted in Megaventory. Presse <a onclick="MegaventoryManager.undeleteEntity(\'' . Mage::helper("adminhtml")->getUrl('megaventory/index/undeleteEntity') .'\','.$result['mvCategoryId'].',\'category\')" href="javascript:void(0);">here</a> if you want to automatically undelete it');
62
+ }
63
+ else
64
+ {
65
+ $this->updateCategory($category->getId(), $entityId);
66
+ }
67
  }
68
  }
69
 
188
 
189
  $json_result = $helper->makeJsonRequest($data, 'ProductCategoryUpdate',$category->getEntityId());
190
 
191
+ $errorCode = $json_result['ResponseStatus']['ErrorCode'];
192
+ if ($errorCode != '0'){//no errors
193
+
194
+ $entityId = $json_result['entityID'];//if category exists just sync them
195
+ if (!empty($entityId) && $entityId > 0){
196
+ if (strpos( $json_result['ResponseStatus']['Message'], 'in the past and was deleted') !== false) {
197
+ $result = array(
198
+ 'mvCategoryId' => $json_result['entityID'],
199
+ 'errorcode' => 'isdeleted'
200
+ );
201
+ Mage::getSingleton('core/session')->addError('Category '.$name.' is flagged as deleted in Megaventory. Presse <a onclick="MegaventoryManager.undeleteEntity(\'' . Mage::helper("adminhtml")->getUrl('megaventory/index/undeleteEntity') .'\','.$result['mvCategoryId'].',\'category\')" href="javascript:void(0);">here</a> if you want to automatically undelete it');
202
+ }
203
+ }
204
+ }
205
  }
206
 
207
  $children = $this->getChildrenCategories($category);
app/code/local/Mv/Megaventory/Model/Customer/Observer.php CHANGED
@@ -7,8 +7,17 @@ class Mv_Megaventory_Model_Customer_Observer {
7
 
8
  $customerHelper = Mage::helper('megaventory/customer');
9
 
10
- $customerHelper->addCustomer($customer);
11
 
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
  public function onCustomerDelete($observer) {
7
 
8
  $customerHelper = Mage::helper('megaventory/customer');
9
 
10
+ $result = $customerHelper->addCustomer($customer);
11
 
12
+ if ($result == 0){
13
+ $logUrl = Mage::helper("adminhtml")->getUrl("megaventory/index/log");
14
+ Mage::getSingleton('core/session')->addError('Customer '.$customer->getId().' did not updated in Megaventory. Please review <a href="'.$logUrl.'" target="_blank">Megaventory Log</a> for details');
15
+ }
16
+
17
+ if (is_array($result)){
18
+ //$logUrl = Mage::helper("adminhtml")->getUrl("megaventory/index/log");
19
+ Mage::getSingleton('core/session')->addError('Customer '.$customer->getName().' is flagged as deleted in Megaventory. Presse <a onclick="MegaventoryManager.undeleteEntity(\'' . Mage::helper("adminhtml")->getUrl('megaventory/index/undeleteEntity') .'\','.$result['mvCustomerId'].',\'supplierclient\')" href="javascript:void(0);">here</a> if you want to automatically undelete it');
20
+ }
21
  }
22
 
23
  public function onCustomerDelete($observer) {
app/code/local/Mv/Megaventory/Model/Observer.php CHANGED
@@ -25,17 +25,22 @@ class Mv_Megaventory_Model_Observer
25
 
26
  }
27
 
28
- //updates magento data asyncrhrously
29
  //receives input by polling megaventory integration updates API
30
  public function update()
31
  {
32
  Mage::log('update run',null,'mv_cron.log');
33
 
34
  $key = Mage::getStoreConfig('megaventory/general/apikey');
 
 
 
 
35
 
36
  $data = array
37
  (
38
- 'APIKEY' => $key
 
39
  );
40
 
41
  $helper = Mage::helper('megaventory');
25
 
26
  }
27
 
28
+ //updates magento data asynchronously
29
  //receives input by polling megaventory integration updates API
30
  public function update()
31
  {
32
  Mage::log('update run',null,'mv_cron.log');
33
 
34
  $key = Mage::getStoreConfig('megaventory/general/apikey');
35
+
36
+ $magentoId = Mage::getStoreConfig('megaventory/general/magentoid');
37
+ if (!isset($magentoId))
38
+ $magentoId = "magento";
39
 
40
  $data = array
41
  (
42
+ 'APIKEY' => $key,
43
+ 'query' => 'mv.Application = "'.$magentoId.'"'
44
  );
45
 
46
  $helper = Mage::helper('megaventory');
app/code/local/Mv/Megaventory/Model/Product/Observer.php CHANGED
@@ -13,8 +13,39 @@ class Mv_Megaventory_Model_Product_Observer {
13
  if ($startsWith && empty($megaventoryId)) //it is an insert of a bom and we should ignore
14
  return;
15
 
16
- $productHelper->addProduct($product);
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  public function onProductImport($observer) {
@@ -98,13 +129,13 @@ class Mv_Megaventory_Model_Product_Observer {
98
  $domain = '.megaventory.com';
99
 
100
  $links = 'View all ';
101
- //$links .= '<a href="https://'.$subDomain.$domain.'/inventory/Maintainance/ProductEdit.aspx?id='.$mvProduct['ProductID'].'" target="_blank">Product Page</a><br/>';
102
- $links .= '<a href="https://'.$subDomain.$domain.'/inventory/Invoices/InvoiceList.aspx?sText='.$mvProduct['ProductSKU'].'" target="_blank">Transactions</a>, ';
103
- $links .= '<a href="https://'.$subDomain.$domain.'/inventory/Ordering/PurchaseOrdersList.aspx?sText='.$mvProduct['ProductSKU'].'" target="_blank">Purchase Orders</a>, ';
104
- $links .= '<a href="https://'.$subDomain.$domain.'/inventory/Ordering/SalesOrdersList.aspx?sText='.$mvProduct['ProductSKU'].'" target="_blank">Sales Orders</a>, ';
105
- $links .= '<a href="https://'.$subDomain.$domain.'/inventory/Ordering/SalesQuotesList.aspx?sText='.$mvProduct['ProductSKU'].'" target="_blank">Sales Quotes</a> ';
106
  $links .= 'with this SKU or ';
107
- $links .= '<a href="https://'.$subDomain.$domain.'/inventory/Stock/WarehouseStock.aspx?sText='.$mvProduct['ProductSKU'].'" target="_blank">Set Alert Levels for this SKU</a>';
108
 
109
  $noticeSKU = '';
110
  if ($mvProduct['ProductSKU'] != $product->getSku())
13
  if ($startsWith && empty($megaventoryId)) //it is an insert of a bom and we should ignore
14
  return;
15
 
16
+ $result = $productHelper->addProduct($product);
17
 
18
+ if ($result == 0){
19
+ $logUrl = Mage::helper("adminhtml")->getUrl("megaventory/index/log");
20
+ Mage::getSingleton('core/session')->addError('Product '.$product->getId().' did not updated in Megaventory. Please review <a href="'.$logUrl.'" target="_blank">Megaventory Log</a> for details');
21
+ }
22
+
23
+ if (is_array($result)){
24
+ //$logUrl = Mage::helper("adminhtml")->getUrl("megaventory/index/log");
25
+ Mage::getSingleton('core/session')->addError('Product with SKU '.$product->getSku().' is flagged as deleted in Megaventory. Presse <a onclick="MegaventoryManager.undeleteEntity(\'' . Mage::helper("adminhtml")->getUrl('megaventory/index/undeleteEntity') .'\','.$result['mvProductId'].',\'product\')" href="javascript:void(0);">here</a> if you want to automatically undelete it');
26
+ }
27
+ }
28
+
29
+ public function onMassProductUpdate($observer) {
30
+ $event = $observer->getEvent ();
31
+
32
+ $indexModelEvent = $event->getObject();
33
+
34
+ $entityType= $indexModelEvent->getData('entity');
35
+ $actionType = $indexModelEvent->getData('type');
36
+ if ($entityType == 'catalog_product' && $actionType == 'mass_action'){
37
+ $dataObject = $indexModelEvent->getData('data_object');
38
+ if ($dataObject){
39
+ $productIds = $dataObject->getData('product_ids');
40
+ if (isset($productIds) && count($productIds) >0 ){
41
+ $productHelper = Mage::helper('megaventory/product');
42
+ foreach ($productIds as $productId){
43
+ $product = Mage::getModel('catalog/product')->load($productId);
44
+ $productHelper->addProduct($product);
45
+ }
46
+ }
47
+ }
48
+ }
49
  }
50
 
51
  public function onProductImport($observer) {
129
  $domain = '.megaventory.com';
130
 
131
  $links = 'View all ';
132
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=sales_documents&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Sales Documents</a>, ';
133
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=purchase_documents&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Purchase Documents</a>, ';
134
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=purchase_orders&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Purchase Orders</a>, ';
135
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=sales_orders&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Sales Orders</a>, ';
136
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=sales_quotes&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Sales Quotes</a> ';
137
  $links .= 'with this SKU or ';
138
+ $links .= '<a href="https://'.$subDomain.$domain.'/inventory/?grid=local_inventory&id=0&productsku='.$mvProduct['ProductSKU'].'" target="_blank">Set Alert Levels for this SKU</a>';
139
 
140
  $noticeSKU = '';
141
  if ($mvProduct['ProductSKU'] != $product->getSku())
app/code/local/Mv/Megaventory/controllers/IndexController.php CHANGED
@@ -70,9 +70,12 @@ class Mv_Megaventory_IndexController extends Mage_Adminhtml_Controller_Action
70
  {
71
  $shippingSKU = $this->getRequest()->getPost('shippingSKU');
72
  $discountSKU = $this->getRequest()->getPost('discountSKU');
 
 
73
  $config = Mage::getConfig();
74
  $config->saveConfig('megaventory/general/shippingproductsku',$shippingSKU);
75
  $config->saveConfig('megaventory/general/discountproductsku',$discountSKU);
 
76
 
77
  //add supplier attribute in config data
78
  $magentoSupplierAttributeCode = $this->getRequest()->getPost('magento_supplier_code');
@@ -226,59 +229,21 @@ class Mv_Megaventory_IndexController extends Mage_Adminhtml_Controller_Action
226
  die();
227
  }
228
 
229
- /*
230
- $supplier = $this->getRequest()->getParam('supplierattribute');
231
-
232
- if (!empty($supplier))
233
  {
234
- $attributeId = Mage::getResourceModel('eav/entity_attribute')
235
- ->getIdByCode('catalog_product',$supplier);
 
 
 
 
 
 
 
 
236
 
237
- if ($attributeId == false){
238
- $megaventoryHelper->sendProgress(time(),'No Suppliers found with this attribute code. Proceeding to next step', '0', 'suppliers');
239
- }
240
- else {
241
- Mage::getConfig()->saveConfig('megaventory/general/defaultsupplierattribute',$supplier);
242
-
243
- $totalSteps += 1;
244
- $megaventoryHelper->sendProgress(time(), 'Step '.$step.'/'.$totalSteps.'<br/>Importing Suppliers to Megaventory', '0', 'suppliers');
245
- $supplierHelper = Mage::helper('megaventory/suppliers');
246
- $supplierHelper->importSuppliersToMegaventory($attributeId,$megaventoryHelper);
247
- $step++;
248
- }
249
- } */
250
-
251
- //add role
252
- /* $role = Mage::getModel('api/roles')->load(false);
253
- $role = $role
254
- ->setName('megaventory')
255
- ->setPid(false)
256
- ->setRoleType('G')
257
- ->save();
258
- $resource = array("all");
259
- Mage::getModel("api/rules")
260
- ->setRoleId($role->getId())
261
- ->setResources($resource)
262
- ->saveRel();
263
- $rid = $role->getId();
264
-
265
- //add user
266
- $user = Mage::getModel('api/user')->load(false);
267
- $user->setUsername('megaventory');
268
- $user->setFirstname('Mega');
269
- $user->setLastname('Ventory');
270
- $user->setEmail('info@megaventory.com');
271
- $user->setApi_key('megaventory24');
272
- $user->setApi_key_confirmation('megaventory24');
273
- $user->setIs_active('1');
274
- try{
275
- $user->save();
276
- $uRoles = array('0'=>$rid);
277
- $user->setRoleIds($uRoles)
278
- ->setRoleUserId($user->getUserId())
279
- ->saveRelations();
280
  }
281
- catch(Exception $e){} */
282
 
283
  public function syncDataAction()
284
  {
@@ -527,6 +492,7 @@ class Mv_Megaventory_IndexController extends Mage_Adminhtml_Controller_Action
527
  Mage::getConfig()->deleteConfig('megaventory/general/synctimestamp/');
528
  Mage::getConfig()->deleteConfig('megaventory/general/shippingproductsku');
529
  Mage::getConfig()->deleteConfig('megaventory/general/discountproductsku');
 
530
  Mage::getConfig()->deleteConfig('megaventory/general/supplierattributecode');
531
  Mage::getConfig()->deleteConfig('megaventory/general/defaultguestid');
532
  Mage::getConfig()->deleteConfig('megaventory/general/setupreport');
@@ -642,6 +608,38 @@ class Mv_Megaventory_IndexController extends Mage_Adminhtml_Controller_Action
642
  die();
643
  }
644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
  public function logAction()
646
  {
647
  //Mage::helper('megaventory/currencies')->addMagentoCurrencies(Mage::helper('megaventory'));
70
  {
71
  $shippingSKU = $this->getRequest()->getPost('shippingSKU');
72
  $discountSKU = $this->getRequest()->getPost('discountSKU');
73
+ $magentoId = $this->getRequest()->getPost('magentoId');
74
+
75
  $config = Mage::getConfig();
76
  $config->saveConfig('megaventory/general/shippingproductsku',$shippingSKU);
77
  $config->saveConfig('megaventory/general/discountproductsku',$discountSKU);
78
+ $config->saveConfig('megaventory/general/magentoid',$magentoId);
79
 
80
  //add supplier attribute in config data
81
  $magentoSupplierAttributeCode = $this->getRequest()->getPost('magento_supplier_code');
229
  die();
230
  }
231
 
232
+ public function updateMagentoIdAction()
 
 
 
233
  {
234
+ $magentoId = $this->getRequest()->getPost('magento_id');
235
+ $config = Mage::getConfig();
236
+ if (!empty($magentoId)){
237
+ $config->saveConfig('megaventory/general/magentoid',$magentoId);
238
+
239
+ $result = array(
240
+ 'message'=>'Magento Id updated successfully!'
241
+ );
242
+ echo json_encode($result) . PHP_EOL;
243
+ }
244
 
245
+ die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
 
247
 
248
  public function syncDataAction()
249
  {
492
  Mage::getConfig()->deleteConfig('megaventory/general/synctimestamp/');
493
  Mage::getConfig()->deleteConfig('megaventory/general/shippingproductsku');
494
  Mage::getConfig()->deleteConfig('megaventory/general/discountproductsku');
495
+ Mage::getConfig()->deleteConfig('megaventory/general/magentoid');
496
  Mage::getConfig()->deleteConfig('megaventory/general/supplierattributecode');
497
  Mage::getConfig()->deleteConfig('megaventory/general/defaultguestid');
498
  Mage::getConfig()->deleteConfig('megaventory/general/setupreport');
608
  die();
609
  }
610
 
611
+ public function undeleteEntityAction()
612
+ {
613
+ $mvId = $this->getRequest()->getPost('mvId');
614
+ $mvEntityType = $this->getRequest()->getPost('mvEntityType');
615
+
616
+ if ($mvEntityType == 'product'){
617
+ $idString = 'ProductIDToUndelete';
618
+ $operation = 'ProductUndelete';
619
+ }
620
+
621
+ if ($mvEntityType == 'category'){
622
+ $idString = 'ProductCategoryIDToUndelete';
623
+ $operation = 'ProductCategoryUndelete';
624
+ }
625
+
626
+ if ($mvEntityType == 'supplierclient'){
627
+ $idString = 'SupplierClientIDToUndelete';
628
+ $operation = 'SupplierClientUndelete';
629
+ }
630
+
631
+ $data = array(
632
+ 'APIKEY' => Mage::getStoreConfig('megaventory/general/apikey'),
633
+ $idString => $mvId
634
+ );
635
+
636
+ $helper = Mage::helper('megaventory');
637
+
638
+ $json_result = $helper->makeJsonRequest($data, $operation);
639
+
640
+ die();
641
+ }
642
+
643
  public function logAction()
644
  {
645
  //Mage::helper('megaventory/currencies')->addMagentoCurrencies(Mage::helper('megaventory'));
app/code/local/Mv/Megaventory/etc/adminhtml.xml CHANGED
@@ -12,10 +12,10 @@
12
  <title>Settings</title>
13
  <action>megaventory/index/index</action>
14
  </megaventorysettings>
15
- <megaventorypendingupdates>
16
  <title>Pending Updates</title>
17
  <action>megaventory/index/updates</action>
18
- </megaventorypendingupdates>
19
  <megaventorylog>
20
  <title>Log</title>
21
  <action>megaventory/index/log</action>
12
  <title>Settings</title>
13
  <action>megaventory/index/index</action>
14
  </megaventorysettings>
15
+ <megaventoryupdates>
16
  <title>Pending Updates</title>
17
  <action>megaventory/index/updates</action>
18
+ </megaventoryupdates>
19
  <megaventorylog>
20
  <title>Log</title>
21
  <action>megaventory/index/log</action>
app/code/local/Mv/Megaventory/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Mv_Megaventory>
5
- <version>2.1.0</version>
6
  </Mv_Megaventory>
7
  </modules>
8
  <crontab>
@@ -62,8 +62,9 @@
62
  <adminhtml>
63
  <args>
64
  <modules>
65
- <Mv_Megaventory before="Mage_Adminhtml">Mv_Megaventory
66
- </Mv_Megaventory>
 
67
  </modules>
68
  </args>
69
  </adminhtml>
@@ -317,6 +318,7 @@
317
  <feed>
318
  <check_frequency>86400</check_frequency>
319
  </feed>
 
320
  </megaventory>
321
  </default>
322
  </config>
2
  <config>
3
  <modules>
4
  <Mv_Megaventory>
5
+ <version>2.2.0</version>
6
  </Mv_Megaventory>
7
  </modules>
8
  <crontab>
62
  <adminhtml>
63
  <args>
64
  <modules>
65
+ <!-- <Mv_Megaventory before="Mage_Adminhtml">Mv_Megaventory
66
+ </Mv_Megaventory> -->
67
+ <megaventory after="Mage_Adminhtml">Mv_Megaventory_Adminhtml</megaventory>
68
  </modules>
69
  </args>
70
  </adminhtml>
318
  <feed>
319
  <check_frequency>86400</check_frequency>
320
  </feed>
321
+
322
  </megaventory>
323
  </default>
324
  </config>
app/design/adminhtml/default/default/layout/megaventory.xml CHANGED
@@ -74,4 +74,13 @@
74
  </reference>
75
  </adminhtml_sales_order_index>
76
 
 
 
 
 
 
 
 
 
 
77
  </layout>
74
  </reference>
75
  </adminhtml_sales_order_index>
76
 
77
+ <default>
78
+ <reference name="head">
79
+ <action method="addItem">
80
+ <type>skin_js</type>
81
+ <name>megaventory/scripts.js</name>
82
+ </action>
83
+ </reference>
84
+ </default>
85
+
86
  </layout>
app/design/adminhtml/default/default/template/megaventory/megaventory.phtml CHANGED
@@ -29,6 +29,9 @@ $syncTimestamp = $this->getSettingValue('synctimestamp');
29
 
30
  $connectivityOk = $this->connectivityOk();
31
 
 
 
 
32
  if ($connectivityOk !== true){
33
  $actionsDisabled = ' disabled ';
34
  $buttonOnClick = ' onclick="" ';
@@ -185,6 +188,25 @@ else{
185
  <legend>Setup Wizard</legend>
186
  <?php if(empty($syncTimestamp)){ ?>
187
  <table class="form-list" style="width:100%">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  <tr>
189
  <td width="50%" class="label"><label
190
  for="megaventory_shipping_sku-id"> Shipping Product SKU<span class="required">*</span>
@@ -357,6 +379,31 @@ else{
357
  </table>
358
  <?php } else {?>
359
  <table class="form-list" style="width:100%">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  <tr>
361
  <td class="label"><label
362
  for="megaventory_shipping_sku-id"> Shipping Product SKU<span class="required">*</span>
@@ -753,6 +800,7 @@ function syncData()
753
  parameters: {
754
  shippingSKU: $('megaventory_shipping_sku-id').value,
755
  discountSKU: $('megaventory_discount_sku-id').value,
 
756
  magento_supplier_code: $('megaventory_supplier-id').value
757
  },
758
  onSuccess: function(transport) {
@@ -986,4 +1034,21 @@ function updateSupplierSettings(){
986
  });
987
  }
988
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
  </script>
29
 
30
  $connectivityOk = $this->connectivityOk();
31
 
32
+ $magentoInstallations = $this->getMagentoInstallations();
33
+ $magentoId = $this->getSettingValue('magentoid');
34
+
35
  if ($connectivityOk !== true){
36
  $actionsDisabled = ' disabled ';
37
  $buttonOnClick = ' onclick="" ';
188
  <legend>Setup Wizard</legend>
189
  <?php if(empty($syncTimestamp)){ ?>
190
  <table class="form-list" style="width:100%">
191
+ <tr>
192
+ <td width="50%" class="label"><label
193
+ for="megaventory_magento_id-id">Magento Id<span class="required">*</span>
194
+ </label></td>
195
+ <td class="value">
196
+ <select id="megaventory_magento_id-id" name="" <?php if ($magentoInstallations <= 0) echo 'disabled'?>>
197
+ <?php
198
+ for ($i = 0; $i < $magentoInstallations; $i++)
199
+ {
200
+ $value = ($i>0) ? 'magento-'.$i : 'magento';
201
+ ?>
202
+ <option value="<?php echo $value ?>" <?php if ($magentoId == $value) echo 'selected' ?>>
203
+ <?php echo 'magento-'.$i ?>
204
+ </option>
205
+ <?php
206
+ }?>
207
+ </select>
208
+ </td>
209
+ </tr>
210
  <tr>
211
  <td width="50%" class="label"><label
212
  for="megaventory_shipping_sku-id"> Shipping Product SKU<span class="required">*</span>
379
  </table>
380
  <?php } else {?>
381
  <table class="form-list" style="width:100%">
382
+ <tr>
383
+ <td width="50%" class="label"><label
384
+ for="megaventory_magento_id-id">Magento Id<span class="required">*</span>
385
+ </label></td>
386
+ <td class="value">
387
+ <select id="megaventory_magento_id-id" name="" <?php if ($magentoInstallations <= 0) echo 'disabled'?>>
388
+ <?php
389
+ for ($i = 0; $i < $magentoInstallations; $i++)
390
+ {
391
+ $value = ($i>0) ? 'magento-'.$i : 'magento';
392
+ ?>
393
+ <option value="<?php echo $value ?>" <?php if ($magentoId == $value) echo 'selected' ?>>
394
+ <?php echo 'magento-'.$i ?>
395
+ </option>
396
+ <?php
397
+ }?>
398
+ </select>
399
+ <?php if(!empty($syncTimestamp) && $connectivityOk === true){ ?>
400
+ <button id="save-config-btn" type="button"
401
+ onclick="updateMagentoId()">
402
+ <span>Update</span>
403
+ </button>
404
+ <?php } ?>
405
+ </td>
406
+ </tr>
407
  <tr>
408
  <td class="label"><label
409
  for="megaventory_shipping_sku-id"> Shipping Product SKU<span class="required">*</span>
800
  parameters: {
801
  shippingSKU: $('megaventory_shipping_sku-id').value,
802
  discountSKU: $('megaventory_discount_sku-id').value,
803
+ magentoId: $('megaventory_magento_id-id').value,
804
  magento_supplier_code: $('megaventory_supplier-id').value
805
  },
806
  onSuccess: function(transport) {
1034
  });
1035
  }
1036
 
1037
+ function updateMagentoId(){
1038
+ url = "<?php echo Mage::helper("adminhtml")->getUrl("megaventory/index/updateMagentoId") ?>";
1039
+ new Ajax.Request(url, {
1040
+ parameters:
1041
+ {
1042
+ 'magento_id' : $('megaventory_magento_id-id').value
1043
+ },
1044
+ onSuccess: function(transport) {
1045
+ if (transport.responseText){
1046
+ var result = transport.responseText.evalJSON();
1047
+
1048
+ alert(result.message);
1049
+ }
1050
+ }
1051
+ });
1052
+ }
1053
+
1054
  </script>
package.xml CHANGED
@@ -1,23 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mv_Megaventory</name>
4
- <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrates your Magento store to Megaventory web-based ERP</summary>
10
  <description>With Megaventory, you will efficiently manage all your inventory, purchasing and order fullfilment needs. This module synchronizes Magento to your megaventory.com account and adds support for multiple inventory locations, purchase orders, work orders (using bill of materials) and custom inventory, sales and purchasing reports.</description>
11
- <notes>This update includes the following feature additions: &#xD;
12
- (A) If a custom product attribute has been added in Magento to &#x201C;link&#x201D; products &#xD;
13
- to supplier entities, this information (the supplier of the product) &#xD;
14
- will also be pushed to Megaventory either during the initial setup wizard or at any time a Magento product is saved/updated. &#xD;
15
- (B) The Notify for Quantity Below (Stock Alert level) figure is automatically synced between Magento and Megaventory&#xD;
16
- Moreover, a few bugs have been fixed and various code optimizations have been applied.</notes>
17
  <authors><author><name>Megaventory Megaventory</name><user>megaventory</user><email>info@megaventory.com</email></author></authors>
18
- <date>2014-11-25</date>
19
- <time>17:03:41</time>
20
- <contents><target name="magelocal"><dir name="Mv"><dir name="Megaventory"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="fff2aa89e995af3446a6007850a743e0"/></dir></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="View.php" hash="5f4b6af1de69091b1b10b4b12ce0f673"/></dir></dir></dir><dir name="Inventories"><file name="Grid.php" hash="3359fe278f99e28acf29547debbc611b"/></dir><file name="Inventories.php" hash="963069637a8d349f279e3e2a3d59e878"/><dir name="Megaventorylog"><file name="Grid.php" hash="d2417c3c3ed63ef65c71c6538ee62e4d"/></dir><file name="Megaventorylog.php" hash="06b457820aec2bda101728a4b97b9c6a"/><file name="Megaventorysettings.php" hash="3f3d343791f6e5e4d70141aeb67f3726"/><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Megaventory.php" hash="6959d43090370b73abf97d494de33910"/></dir></dir></dir><dir name="Renderer"><file name="Action.php" hash="5a88b067482480da031ac6a1972502a7"/><file name="Boolean.php" hash="a64533e5627a1981410b2f4465c3e5f5"/><file name="Countsinstock.php" hash="02fb7cc939969503ed5f2c0d46605beb"/><file name="Orderinventory.php" hash="81e8c7b5915388ac833dd26cf5c78f58"/><dir name="Product"><file name="Inventories.php" hash="ad0116b1ae321dc7644d3ed1b18cfd20"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="aa6d5947cfd04e1317e7e88c6802b5bc"/></dir></dir><dir name="System"><dir name="Convert"><dir name="Profile"><file name="Run.php" hash="08efbdc75a3890e8c7ec74be289e16d5"/></dir></dir></dir><dir name="Taxes"><file name="Grid.php" hash="910aa1bce7cdac35049139b845806fcc"/></dir><file name="Taxes.php" hash="c325693005618a94595c433b9c40212e"/><dir name="Updates"><file name="Grid.php" hash="b58d845ed388b7f65fa919b0c5e1ff4a"/></dir><file name="Updates.php" hash="0e651824253cec325fdcbd0c4a4fdc99"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="1b5c9f129772f148ba5822853cfbb544"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7350c351bed984caa4da9e65db78f7d3"/><file name="api.xml" hash="7cad22030a2e2c79e16de5ce0ba790e4"/><file name="config.xml" hash="78b9c301fa12399cc7b627fb4f05f0c6"/><file name="system.xml" hash="0c4691ab690fdbfbfcd930195a07f8d3"/><file name="wsdl.xml" hash="98ae8557b66efd05e279e2ce56f36dc4"/></dir><dir name="Helper"><file name="Category.php" hash="d639d3696ba9bf42a6684b2c0d075a02"/><file name="Common.php" hash="1214ddf8c525a635f6884cf29da31213"/><file name="Currencies.php" hash="afd489d48d2b42f22f434c2735fd8976"/><file name="Customer.php" hash="642b49d6029386c1b1940b094c079205"/><file name="Data.php" hash="fdd7b070aaaeceb045ee15617ba2a2c0"/><file name="Inventories.php" hash="afb3355dad6dbb0d13b2180eb57255cf"/><file name="Order.php" hash="0699be197186a604a2f27ac7b4b16b9f"/><file name="Product.php" hash="3a925a7d4119a23d86cdd02c78989138"/><file name="Suppliers.php" hash="114e7d9f5608aba273d5f4987e042564"/><file name="Taxes.php" hash="d379c953130c39e5195c0f2f65036d3a"/></dir><dir name="Model"><file name="Bom.php" hash="2e31318df6c21bcb697ce1f6a903031e"/><dir name="Category"><file name="Observer.php" hash="68005baf483f6216455a319d88f2d4cc"/></dir><file name="Currencies.php" hash="6b8a36da6d7c55df5138d45dbeb633a4"/><dir name="Customer"><file name="Exporter.php" hash="ac724296dced11ed057046f86bb4760e"/><file name="Observer.php" hash="52fe3653bc9fa4c4f30304e4a9f44027"/></dir><file name="Exporter.php" hash="a62ef834b3b0384f4737fd2364f059f0"/><dir name="Import"><dir name="Entity"><dir name="Customer"><file name="Address.php" hash="86a8b0f38ee6e5a4b29400cc451f09fa"/></dir></dir></dir><file name="Inventories.php" hash="fb481d874caf90249c80445053148767"/><file name="Megaventorylog.php" hash="29297786f36037e8c319264f2fa85f81"/><dir name="Mysql4"><dir name="Bom"><file name="Collection.php" hash="4e390a210021192a47484134e4d39a0e"/></dir><file name="Bom.php" hash="122e092508f8efba8403195aea99cc8f"/><dir name="Currencies"><file name="Collection.php" hash="c6a2447656a517980c12645dba12fd07"/></dir><file name="Currencies.php" hash="e138cf3ab27542eebaca9412e320bade"/><dir name="Inventories"><file name="Collection.php" hash="d6b534e8a607d6417e893fd3dcd5a30d"/></dir><file name="Inventories.php" hash="b87b6aac89db59e93f203713572b7594"/><dir name="Megaventorylog"><file name="Collection.php" hash="bf0a73388b11e7c26cc5629f4609dd33"/></dir><file name="Megaventorylog.php" hash="2d2acaa33c3a65338f3711232ac0727a"/><dir name="Productstocks"><file name="Collection.php" hash="4bbb1e8cb7365df22a5bb4becc1a2928"/></dir><file name="Productstocks.php" hash="875331f6f6eda5316276505396fb4626"/><dir name="Taxes"><file name="Collection.php" hash="2ba005f102cffc1e36fdf5a96042f22f"/></dir><file name="Taxes.php" hash="78f035f9d78f878ddccbc1b782ab63cb"/></dir><dir name="Notification"><file name="Feed.php" hash="3db99c6d0c19b60c20043d0cbacb9849"/></dir><file name="Observer.php" hash="10748c85bcef23b356663b83c74a6908"/><dir name="Product"><file name="Observer.php" hash="e3eeed6b5554faa5c83e2f8da7f23fdb"/></dir><file name="Productstocks.php" hash="cfb4905eb159b62b614cc463b8a4d09b"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="05c334b454b5f93f1cf3bbbf39485b97"/></dir></dir><dir name="Sales"><file name="Observer.php" hash="0bfb53a5e95defc780fbc38aa140a8e0"/></dir><dir name="Services"><dir name="Api"><file name="V2.php" hash="3fe9ab25a56006d4811e7d3da52b9c32"/></dir><file name="Api.php" hash="868008325f492742f102586847214ba1"/></dir><dir name="Stock"><file name="Exporter.php" hash="d3e449aca921c3ab4f8f2181db88dcaf"/></dir><dir name="Stockitem"><file name="Observer.php" hash="71df67605c432bfdc25ae8b60ae66b31"/></dir><file name="Taxes.php" hash="f223b7efcbfac4ceb4b553725281e9f2"/></dir><dir name="sql"><dir name="megaventory_setup"><file name="mysql4-install-0.1.0.php" hash="2e1ce681394e2278868a10865660a41f"/><file name="mysql4-upgrade-0.1.0-0.1.5.php" hash="b9e25c46b3738eec98dbad13201c8751"/><file name="mysql4-upgrade-0.1.5-0.2.0.php" hash="2588ce62eb04c6dc20638e2110a3d2e5"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="3e4bcf4eecd578913fada55bbd4e4218"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="5dac061b4b58ff212722858db76de11d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="megaventory"><file name="scripts.js" hash="f34681c44311c094255a52165da31d4f"/></dir><dir name="images"><dir name="megaventory"><file name="accept.png" hash="90134a31c616bab56f31472981244c0e"/><file name="exclamation.png" hash="e4dd51f46566ed3ceacdc900bf2fdf01"/><file name="infobutton.png" hash="b57cba82d84d3b333dd3654c39b97120"/><file name="message.png" hash="3cc350d4638c397345658a18c492d685"/><file name="pdf.png" hash="3e34bb1d7ae246eda83a8243e371b0cc"/><file name="smallloader.gif" hash="eec22c24eb141346e57115232ccbd53e"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="megaventory.xml" hash="d1ede978aba9e58e0bcf4f873d028b70"/></dir><dir name="template"><dir name="megaventory"><dir name="catalog"><dir name="product"><dir name="tab"><file name="inventory.phtml" hash="4cbee14572a0291a66f48dc485670de0"/></dir></dir></dir><dir name="customer"><dir name="tab"><file name="view.phtml" hash="c5a30829f873360ffd69b9b55456318e"/></dir></dir><file name="megaventory.phtml" hash="cb33f0673117122ca0c28393811eaac5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mv_Megaventory.xml" hash="a7b18008632193e463a04c92852d32c4"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mv_Megaventory</name>
4
+ <version>2.2.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Integrates your Magento store to Megaventory web-based ERP</summary>
10
  <description>With Megaventory, you will efficiently manage all your inventory, purchasing and order fullfilment needs. This module synchronizes Magento to your megaventory.com account and adds support for multiple inventory locations, purchase orders, work orders (using bill of materials) and custom inventory, sales and purchasing reports.</description>
11
+ <notes>This update adds -the much requested- support for multiple Magento stores! More specifically, multiple Magento stores can pull inventory information from a single Megaventory account while Sales Orders from all Magento stores will be pushed to the same Megaventory account.&#xD;
12
+ &#xD;
13
+ This extension is also fully operational with single Mageno installations.&#xD;
14
+ &#xD;
15
+ Finally, a few bugs have been fixed and various code optimizations have been applied.</notes>
 
16
  <authors><author><name>Megaventory Megaventory</name><user>megaventory</user><email>info@megaventory.com</email></author></authors>
17
+ <date>2016-05-30</date>
18
+ <time>12:41:50</time>
19
+ <contents><target name="magelocal"><dir><dir name="Mv"><dir name="Megaventory"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="fff2aa89e995af3446a6007850a743e0"/></dir></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="View.php" hash="5f4b6af1de69091b1b10b4b12ce0f673"/></dir></dir></dir><dir name="Inventories"><file name="Grid.php" hash="3359fe278f99e28acf29547debbc611b"/></dir><file name="Inventories.php" hash="963069637a8d349f279e3e2a3d59e878"/><dir name="Megaventorylog"><file name="Grid.php" hash="d2417c3c3ed63ef65c71c6538ee62e4d"/></dir><file name="Megaventorylog.php" hash="06b457820aec2bda101728a4b97b9c6a"/><file name="Megaventorysettings.php" hash="ba2a2636a4cb5b053a81a4e67f035441"/><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Megaventory.php" hash="6959d43090370b73abf97d494de33910"/></dir></dir></dir><dir name="Renderer"><file name="Action.php" hash="5a88b067482480da031ac6a1972502a7"/><file name="Boolean.php" hash="a64533e5627a1981410b2f4465c3e5f5"/><file name="Countsinstock.php" hash="02fb7cc939969503ed5f2c0d46605beb"/><file name="Orderinventory.php" hash="81e8c7b5915388ac833dd26cf5c78f58"/><dir name="Product"><file name="Inventories.php" hash="ad0116b1ae321dc7644d3ed1b18cfd20"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="aa6d5947cfd04e1317e7e88c6802b5bc"/></dir></dir><dir name="System"><dir name="Convert"><dir name="Profile"><file name="Run.php" hash="08efbdc75a3890e8c7ec74be289e16d5"/></dir></dir></dir><dir name="Taxes"><file name="Grid.php" hash="910aa1bce7cdac35049139b845806fcc"/></dir><file name="Taxes.php" hash="c325693005618a94595c433b9c40212e"/><dir name="Updates"><file name="Grid.php" hash="d9345220b9f98849603ac0e9d7c1c99a"/></dir><file name="Updates.php" hash="0e651824253cec325fdcbd0c4a4fdc99"/></dir></dir><dir name="Helper"><file name="Category.php" hash="f95727b69f87cc45eb6dcc3810473717"/><file name="Common.php" hash="1a2b696602132da0ef4822c9f9d68c7f"/><file name="Currencies.php" hash="afd489d48d2b42f22f434c2735fd8976"/><file name="Customer.php" hash="acdda41ebccb9b80ffbfc48889c93e14"/><file name="Data.php" hash="728d78ca0b0493f9912aec684bf5672f"/><file name="Inventories.php" hash="afb3355dad6dbb0d13b2180eb57255cf"/><file name="Order.php" hash="276f0e39440d2b18c3bb8a867120f74c"/><file name="Product.php" hash="965a78bfc709022b13bfb99d07efbfa2"/><file name="Suppliers.php" hash="507af045e1ac44a956e97d8a48355f2c"/><file name="Taxes.php" hash="d379c953130c39e5195c0f2f65036d3a"/></dir><dir name="Model"><file name="Bom.php" hash="2e31318df6c21bcb697ce1f6a903031e"/><dir name="Category"><file name="Observer.php" hash="0d87472d6333d3681dd66de8c4224866"/></dir><file name="Currencies.php" hash="6b8a36da6d7c55df5138d45dbeb633a4"/><dir name="Customer"><file name="Exporter.php" hash="ac724296dced11ed057046f86bb4760e"/><file name="Observer.php" hash="a5e447699baff8a76753aee1272264a8"/></dir><file name="Exporter.php" hash="a62ef834b3b0384f4737fd2364f059f0"/><dir name="Import"><dir name="Entity"><dir name="Customer"><file name="Address.php" hash="86a8b0f38ee6e5a4b29400cc451f09fa"/></dir></dir></dir><file name="Inventories.php" hash="fb481d874caf90249c80445053148767"/><file name="Megaventorylog.php" hash="29297786f36037e8c319264f2fa85f81"/><dir name="Mysql4"><dir name="Bom"><file name="Collection.php" hash="4e390a210021192a47484134e4d39a0e"/></dir><file name="Bom.php" hash="122e092508f8efba8403195aea99cc8f"/><dir name="Currencies"><file name="Collection.php" hash="c6a2447656a517980c12645dba12fd07"/></dir><file name="Currencies.php" hash="e138cf3ab27542eebaca9412e320bade"/><dir name="Inventories"><file name="Collection.php" hash="d6b534e8a607d6417e893fd3dcd5a30d"/></dir><file name="Inventories.php" hash="b87b6aac89db59e93f203713572b7594"/><dir name="Megaventorylog"><file name="Collection.php" hash="bf0a73388b11e7c26cc5629f4609dd33"/></dir><file name="Megaventorylog.php" hash="2d2acaa33c3a65338f3711232ac0727a"/><dir name="Productstocks"><file name="Collection.php" hash="4bbb1e8cb7365df22a5bb4becc1a2928"/></dir><file name="Productstocks.php" hash="875331f6f6eda5316276505396fb4626"/><dir name="Taxes"><file name="Collection.php" hash="2ba005f102cffc1e36fdf5a96042f22f"/></dir><file name="Taxes.php" hash="78f035f9d78f878ddccbc1b782ab63cb"/></dir><dir name="Notification"><file name="Feed.php" hash="3db99c6d0c19b60c20043d0cbacb9849"/></dir><file name="Observer.php" hash="1dd0dfbe65f1cc8efdb0c30a9b5a4fb2"/><dir name="Product"><file name="Observer.php" hash="e22ced29e7e33c180dea540ead9f0510"/></dir><file name="Productstocks.php" hash="cfb4905eb159b62b614cc463b8a4d09b"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="05c334b454b5f93f1cf3bbbf39485b97"/></dir></dir><dir name="Sales"><file name="Observer.php" hash="0bfb53a5e95defc780fbc38aa140a8e0"/></dir><dir name="Services"><dir name="Api"><file name="V2.php" hash="3fe9ab25a56006d4811e7d3da52b9c32"/></dir><file name="Api.php" hash="868008325f492742f102586847214ba1"/></dir><dir name="Stock"><file name="Exporter.php" hash="d3e449aca921c3ab4f8f2181db88dcaf"/></dir><dir name="Stockitem"><file name="Observer.php" hash="71df67605c432bfdc25ae8b60ae66b31"/></dir><file name="Taxes.php" hash="f223b7efcbfac4ceb4b553725281e9f2"/></dir><dir name="controllers"><file name="IndexController.php" hash="8315dab634a17fedc5a3f6755907e09a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d5a0c84053d9c954e3e3bf43e24dce29"/><file name="api.xml" hash="7cad22030a2e2c79e16de5ce0ba790e4"/><file name="config.xml" hash="5dd80fd610ce19e7e49d01c7897e5fa6"/><file name="system.xml" hash="0c4691ab690fdbfbfcd930195a07f8d3"/><file name="wsdl.xml" hash="98ae8557b66efd05e279e2ce56f36dc4"/></dir><dir name="sql"><dir name="megaventory_setup"><file name="mysql4-install-0.1.0.php" hash="2e1ce681394e2278868a10865660a41f"/><file name="mysql4-upgrade-0.1.0-0.1.5.php" hash="b9e25c46b3738eec98dbad13201c8751"/><file name="mysql4-upgrade-0.1.5-0.2.0.php" hash="2588ce62eb04c6dc20638e2110a3d2e5"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="3e4bcf4eecd578913fada55bbd4e4218"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="5dac061b4b58ff212722858db76de11d"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="megaventory"><dir name="catalog"><dir name="product"><dir name="tab"><file name="inventory.phtml" hash="4cbee14572a0291a66f48dc485670de0"/></dir></dir></dir><dir name="customer"><dir name="tab"><file name="view.phtml" hash="c5a30829f873360ffd69b9b55456318e"/></dir></dir><file name="megaventory.phtml" hash="202436eba0a6df86a10916d4e0edcc96"/></dir></dir><dir name="layout"><file name="megaventory.xml" hash="08683fe10ff8cfc1845870dfd0da7853"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Mv_Megaventory.xml" hash="a7b18008632193e463a04c92852d32c4"/></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="megaventory"><file name="accept.png" hash="90134a31c616bab56f31472981244c0e"/><file name="exclamation.png" hash="e4dd51f46566ed3ceacdc900bf2fdf01"/><file name="infobutton.png" hash="b57cba82d84d3b333dd3654c39b97120"/><file name="message.png" hash="3cc350d4638c397345658a18c492d685"/><file name="pdf.png" hash="3e34bb1d7ae246eda83a8243e371b0cc"/><file name="smallloader.gif" hash="eec22c24eb141346e57115232ccbd53e"/></dir></dir><dir name="megaventory"><file name="scripts.js" hash="cbf53ad5b77442e760860e19854f9b0e"/></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
skin/adminhtml/default/default/megaventory/scripts.js CHANGED
@@ -68,5 +68,26 @@ var MegaventoryManager={
68
  }
69
  });
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
  }
68
  }
69
  });
70
 
71
+ },
72
+
73
+ undeleteEntity : function(url, mvId, mvEntityType){
74
+
75
+ new Ajax.Request(url, {
76
+
77
+ method:'post',
78
+
79
+ parameters : {
80
+ mvId: mvId,
81
+ mvEntityType : mvEntityType
82
+ },
83
+ onFailure: function() {
84
+ alert('An error occurred while undeleting entity.');
85
+ },
86
+
87
+ onSuccess : function(response){
88
+ alert('Entity was undeleted successfully!Please press save again to update entity in Megaventory.');
89
+ }
90
+ });
91
+
92
  }
93
  }