LinnLiveConnect - Version 1.1.40

Version Notes

minor bug fixes

Download this release

Release Info

Developer Albert Andrejev
Extension LinnLiveConnect
Version 1.1.40
Comparing to
See all releases


Code changes from version 1.1.39 to 1.1.40

app/code/local/LinnSystems/LinnLiveConnect/Model/Api/V2.php CHANGED
@@ -79,7 +79,7 @@ class Factory{
79
  $version = intval($version);
80
 
81
  if ($version == 0)
82
- throw new Mage_Api_Exception('version_not_specified');
83
  if (Settings::$VERSION < $version )
84
  throw new Mage_Api_Exception('wrong_version');
85
  }
@@ -390,8 +390,7 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
390
  $indexer = Mage::getSingleton('index/indexer');
391
  $process = $indexer->getProcessByCode('catalog_product_price');
392
  $process->reindexEverything();
393
- }
394
- catch (Mage_Core_Exception $e) {
395
  throw new Mage_Api_Exception('configurable_creating_error', $e->getMessage());
396
  }
397
  }
@@ -533,20 +532,6 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
533
  return $this->_getStore()->getCode();
534
  }
535
 
536
- private function _getProductBySku($sku)
537
- {
538
- if($sku){
539
- $product = Mage::getModel('catalog/product');
540
- $productId = $product->getIdBySku((string)$sku);
541
- if($productId){
542
- $product->load($productId);
543
- if($product->getId()){
544
- return $product;
545
- }
546
- }
547
- }
548
- }
549
-
550
  private function _getStore($storeCode=null)
551
  {
552
  if (Mage::app()->isSingleStoreMode()) {
@@ -710,10 +695,10 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
710
 
711
 
712
  /*
713
- *
714
- * Public functions(API)
715
- *
716
- */
717
  public function configurableProduct($set, $sku, $reindex, $productData, $productsSet, $attributesSet, $store=null)
718
  {
719
  if (!$set || !$sku) {
@@ -752,34 +737,26 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
752
 
753
  public function updateConfigurableProduct($productId, $reindex, $productData, $productsSet, $attributesSet, $store=null, $identifierType='id')
754
  {
 
 
 
755
 
 
 
 
 
756
 
757
  $this->_prepareConfigurableData($store, $productData, $assignedProductsArray,
758
  $attributesSetArray, $productsSet, $attributesSet);
759
 
760
  try {
761
  $storeId = Mage::app()->getStore($store)->getId();
762
- }
763
- catch (Mage_Core_Model_Store_Exception $e) {
764
  throw new Mage_Api_Exception('store_not_exists', null);
765
  }
766
- /*
767
- if ($identifierType == 'id')
768
- {
769
- $productId = intval($productId);
770
-
771
- if ($productId < 1) {
772
- throw new Mage_Api_Exception('product_not_exists', null);
773
- }
774
- }*/
775
 
776
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
777
 
778
- if (!$_loadedProduct->getId())
779
- {
780
- throw new Mage_Api_Exception('product_not_exists', null);
781
- }
782
-
783
  $_categoryIds = $_loadedProduct->getCategoryIds();
784
  if (property_exists($productData, 'category_ids'))
785
  {
@@ -831,8 +808,8 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
831
  }
832
 
833
  /*
834
- * Checks if this Magento server has valid Extension installed
835
- */
836
  public function storesList()
837
  {
838
  return ($this->_getCurrentVersion() >= 160);
@@ -845,33 +822,24 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
845
 
846
  public function deleteAssigned($productId, $store=null, $identifierType='id')
847
  {
 
 
 
 
 
 
 
 
 
848
  $store = $this->_currentStoreCode($store);
849
 
850
  try {
851
  $storeId = Mage::app()->getStore($store)->getId();
852
- }
853
- catch (Mage_Core_Model_Store_Exception $e) {
854
  throw new Mage_Api_Exception('store_not_exists', null);
855
  }
856
- /*
857
- if ($identifierType == 'id')
858
- {
859
- $productId = intval($productId);
860
-
861
- if ($productId < 1) {
862
- throw new Mage_Api_Exception('product_not_exists', null);
863
- }
864
- }*/
865
-
866
 
867
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
868
-
869
- if (!$_loadedProduct->getId())
870
- {
871
- throw new Mage_Api_Exception('product_not_exists', null);
872
- }
873
-
874
-
875
  $currentWebsites = $_loadedProduct->getWebsiteIds();
876
  $websiteId = $this->_getWebsiteId($store);
877
  $websiteId = $websiteId[0];
@@ -957,12 +925,12 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
957
  }
958
 
959
  /*
960
- * Implementation of catalogProductList because of bug in associativeArray.
961
- * Extended to filter by category id too.
962
- *
963
- * Use 'entity_id' for product_id,
964
- * 'type_id' instead of product type.
965
- */
966
  public function productList($page, $perPage, $filters = null, $store = null)
967
  {
968
  $arrayParams = array(
@@ -974,8 +942,7 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
974
 
975
  try {
976
  $storeId = Mage::app()->getStore($store)->getId();
977
- }
978
- catch (Mage_Core_Model_Store_Exception $e) {
979
  throw new Mage_Api_Exception('store_not_exists', null);
980
  }
981
 
@@ -1032,8 +999,7 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
1032
  foreach ($preparedFilters as $field => $value) {
1033
  $collection->addFieldToFilter($field, $value);
1034
  }
1035
- }
1036
- catch (Mage_Core_Exception $e) {
1037
  throw new Mage_Api_Exception('filters_invalid', $e->getMessage());
1038
  }
1039
  }
@@ -1213,31 +1179,24 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
1213
 
1214
  public function update($productId, $productData, $store = null, $identifierType = 'id')
1215
  {
 
 
 
 
 
 
 
 
 
1216
  $store = $this->_currentStoreCode($store);
1217
  try {
1218
  $storeId = Mage::app()->getStore($store)->getId();
1219
- }
1220
- catch (Mage_Core_Model_Store_Exception $e) {
1221
  throw new Mage_Api_Exception('store_not_exists', null);
1222
  }
1223
- /*
1224
- if ($identifierType == 'id')
1225
- {
1226
- $productId = intval($productId);
1227
-
1228
- if ($productId < 1) {
1229
- throw new Mage_Api_Exception('product_not_exists', null);
1230
- }
1231
- }*/
1232
 
1233
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
1234
 
1235
- if (!$_loadedProduct->getId())
1236
- {
1237
- throw new Mage_Api_Exception('product_not_exists', null);
1238
- }
1239
-
1240
-
1241
  $_categoryIds = $_loadedProduct->getCategoryIds();
1242
  if (property_exists($productData, 'category_ids'))
1243
  {
@@ -1292,11 +1251,6 @@ class LinnLiveMain extends Mage_Core_Model_Abstract{
1292
 
1293
  public function create($type, $set, $sku, $productData, $store = null)
1294
  {
1295
- $product = $this->_getProductBySku($sku);
1296
- if($product){
1297
- return $product->getId();
1298
- }
1299
-
1300
  $store = $this->_currentStoreCode($store);
1301
 
1302
  $DefaultStore = $this->_getStore();
@@ -1443,7 +1397,7 @@ class LinnLiveEnterprise extends LinnLiveMain{
1443
  }
1444
  else
1445
  {
1446
- $productData->additional_attributes->single_data[$i]->value = $_availableOptions[$option->attribute_id][strtolower($option->label)];
1447
  }
1448
  }
1449
  else
@@ -1454,7 +1408,7 @@ class LinnLiveEnterprise extends LinnLiveMain{
1454
  }
1455
  else
1456
  {
1457
- $productData->additional_attributes->single_data[$i]->value = $option->value;
1458
  }
1459
  }
1460
  $i++;
79
  $version = intval($version);
80
 
81
  if ($version == 0)
82
+ throw new Mage_Api_Exception('version is not specified');
83
  if (Settings::$VERSION < $version )
84
  throw new Mage_Api_Exception('wrong_version');
85
  }
390
  $indexer = Mage::getSingleton('index/indexer');
391
  $process = $indexer->getProcessByCode('catalog_product_price');
392
  $process->reindexEverything();
393
+ } catch (Mage_Core_Exception $e) {
 
394
  throw new Mage_Api_Exception('configurable_creating_error', $e->getMessage());
395
  }
396
  }
532
  return $this->_getStore()->getCode();
533
  }
534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  private function _getStore($storeCode=null)
536
  {
537
  if (Mage::app()->isSingleStoreMode()) {
695
 
696
 
697
  /*
698
+ *
699
+ * Public functions(API)
700
+ *
701
+ */
702
  public function configurableProduct($set, $sku, $reindex, $productData, $productsSet, $attributesSet, $store=null)
703
  {
704
  if (!$set || !$sku) {
737
 
738
  public function updateConfigurableProduct($productId, $reindex, $productData, $productsSet, $attributesSet, $store=null, $identifierType='id')
739
  {
740
+ if ($identifierType == 'id')
741
+ {
742
+ $productId = intval($productId);
743
 
744
+ if ($productId < 1) {
745
+ throw new Mage_Api_Exception('product_not_exists', null);
746
+ }
747
+ }
748
 
749
  $this->_prepareConfigurableData($store, $productData, $assignedProductsArray,
750
  $attributesSetArray, $productsSet, $attributesSet);
751
 
752
  try {
753
  $storeId = Mage::app()->getStore($store)->getId();
754
+ } catch (Mage_Core_Model_Store_Exception $e) {
 
755
  throw new Mage_Api_Exception('store_not_exists', null);
756
  }
 
 
 
 
 
 
 
 
 
757
 
758
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
759
 
 
 
 
 
 
760
  $_categoryIds = $_loadedProduct->getCategoryIds();
761
  if (property_exists($productData, 'category_ids'))
762
  {
808
  }
809
 
810
  /*
811
+ * Checks if this Magento server has valid Extension installed
812
+ */
813
  public function storesList()
814
  {
815
  return ($this->_getCurrentVersion() >= 160);
822
 
823
  public function deleteAssigned($productId, $store=null, $identifierType='id')
824
  {
825
+ if ($identifierType == 'id')
826
+ {
827
+ $productId = intval($productId);
828
+
829
+ if ($productId < 1) {
830
+ throw new Mage_Api_Exception('product_not_exists', null);
831
+ }
832
+ }
833
+
834
  $store = $this->_currentStoreCode($store);
835
 
836
  try {
837
  $storeId = Mage::app()->getStore($store)->getId();
838
+ } catch (Mage_Core_Model_Store_Exception $e) {
 
839
  throw new Mage_Api_Exception('store_not_exists', null);
840
  }
 
 
 
 
 
 
 
 
 
 
841
 
842
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
 
 
 
 
 
 
 
843
  $currentWebsites = $_loadedProduct->getWebsiteIds();
844
  $websiteId = $this->_getWebsiteId($store);
845
  $websiteId = $websiteId[0];
925
  }
926
 
927
  /*
928
+ * Implementation of catalogProductList because of bug in associativeArray.
929
+ * Extended to filter by category id too.
930
+ *
931
+ * Use 'entity_id' for product_id,
932
+ * 'type_id' instead of product type.
933
+ */
934
  public function productList($page, $perPage, $filters = null, $store = null)
935
  {
936
  $arrayParams = array(
942
 
943
  try {
944
  $storeId = Mage::app()->getStore($store)->getId();
945
+ } catch (Mage_Core_Model_Store_Exception $e) {
 
946
  throw new Mage_Api_Exception('store_not_exists', null);
947
  }
948
 
999
  foreach ($preparedFilters as $field => $value) {
1000
  $collection->addFieldToFilter($field, $value);
1001
  }
1002
+ } catch (Mage_Core_Exception $e) {
 
1003
  throw new Mage_Api_Exception('filters_invalid', $e->getMessage());
1004
  }
1005
  }
1179
 
1180
  public function update($productId, $productData, $store = null, $identifierType = 'id')
1181
  {
1182
+ if ($identifierType == 'id')
1183
+ {
1184
+ $productId = intval($productId);
1185
+
1186
+ if ($productId < 1) {
1187
+ throw new Mage_Api_Exception('product_not_exists', null);
1188
+ }
1189
+ }
1190
+
1191
  $store = $this->_currentStoreCode($store);
1192
  try {
1193
  $storeId = Mage::app()->getStore($store)->getId();
1194
+ } catch (Mage_Core_Model_Store_Exception $e) {
 
1195
  throw new Mage_Api_Exception('store_not_exists', null);
1196
  }
 
 
 
 
 
 
 
 
 
1197
 
1198
  $_loadedProduct = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);
1199
 
 
 
 
 
 
 
1200
  $_categoryIds = $_loadedProduct->getCategoryIds();
1201
  if (property_exists($productData, 'category_ids'))
1202
  {
1251
 
1252
  public function create($type, $set, $sku, $productData, $store = null)
1253
  {
 
 
 
 
 
1254
  $store = $this->_currentStoreCode($store);
1255
 
1256
  $DefaultStore = $this->_getStore();
1397
  }
1398
  else
1399
  {
1400
+ $productData->additional_attributes->single_data[$i]->value = $_availableOptions[$option->attribute_id][strtolower($option->label)];
1401
  }
1402
  }
1403
  else
1408
  }
1409
  else
1410
  {
1411
+ $productData->additional_attributes->single_data[$i]->value = $option->value;
1412
  }
1413
  }
1414
  $i++;
app/etc/modules/LinnSystems_LinnLiveConnect.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <LinnSystems_LinnLiveConnect>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </LinnSystems_LinnLiveConnect>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LinnLiveConnect</name>
4
- <version>1.1.39</version>
5
  <stability>stable</stability>
6
  <license>GPL v2</license>
7
  <channel>community</channel>
@@ -10,10 +10,10 @@
10
  <description>Extended SOAP WS-I compliant API to support integration with LinnLive2 (http://www.linnlive.com).&#xD;
11
  Contains some workarounds to avoid bugs in original Magento modules and additional functionality to operate Magento store remotely.</description>
12
  <notes>minor bug fixes</notes>
13
- <authors><author><name>Albert Andrejev</name><user>albert_andrejev</user><email>albert@linnsystems.com</email></author></authors>
14
  <date>2014-04-16</date>
15
- <time>10:43:30</time>
16
- <contents><target name="magelocal"><dir name="LinnSystems"><dir name="LinnLiveConnect"><dir name="Helper"><file name="Data.php" hash="5fe5216de67d4e69a0f418b0cd7780ee"/></dir><dir name="Model"><dir name="Api"><file name="V2.php" hash="935a40c9f311e3f4fe379ce6066e2b1c"/></dir></dir><dir name="etc"><file name="api.xml" hash="2d53cb9b318de468f6d2e3d388bb8732"/><file name="config.xml" hash="2d1d6338d93e36b730efde622893b4e6"/><file name="wsdl.xml" hash="fc21f2963c1253f5f40e5e8414312174"/><file name="wsi.xml" hash="ef000d5115f5988664f58df8b9139e5e"/></dir></dir></dir></target></contents>
17
  <compatible/>
18
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>LinnLiveConnect</name>
4
+ <version>1.1.40</version>
5
  <stability>stable</stability>
6
  <license>GPL v2</license>
7
  <channel>community</channel>
10
  <description>Extended SOAP WS-I compliant API to support integration with LinnLive2 (http://www.linnlive.com).&#xD;
11
  Contains some workarounds to avoid bugs in original Magento modules and additional functionality to operate Magento store remotely.</description>
12
  <notes>minor bug fixes</notes>
13
+ <authors><author><name>Albert Andrejev</name><user>albert_andrejev</user><email>albert@linnsystems.com</email></author><author><name>Pavel Nikolajev</name><user>Pavel_LL2</user><email>pavel.nokolajev@linnsystems.com</email></author><author><name>Aleksandr Kornev</name><user>alex_LL2</user><email>alex.kornevs@linnsystems.com</email></author></authors>
14
  <date>2014-04-16</date>
15
+ <time>12:49:47</time>
16
+ <contents><target name="magelocal"><dir name="LinnSystems"><dir name="LinnLiveConnect"><dir name="Helper"><file name="Data.php" hash="5fe5216de67d4e69a0f418b0cd7780ee"/></dir><dir name="Model"><dir name="Api"><file name="V2.php" hash="488b6fe5c1eb60f1d812387cf570a046"/></dir></dir><dir name="etc"><file name="api.xml" hash="2d53cb9b318de468f6d2e3d388bb8732"/><file name="config.xml" hash="2d1d6338d93e36b730efde622893b4e6"/><file name="wsdl.xml" hash="fc21f2963c1253f5f40e5e8414312174"/><file name="wsi.xml" hash="ef000d5115f5988664f58df8b9139e5e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LinnSystems_LinnLiveConnect.xml" hash="19c48712cd0516815d6784592ada0881"/></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>