Version Notes
Variation price update process improved
Download this release
Release Info
| Developer | Albert Andrejev |
| Extension | LinnLiveConnect |
| Version | 1.1.60 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.59 to 1.1.60
app/code/local/LinnSystems/LinnLiveConnect/Helper/Data.php
CHANGED
|
@@ -69,7 +69,7 @@ class LinnSystems_LinnLiveConnect_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 69 |
return $preparedFilters;
|
| 70 |
}
|
| 71 |
|
| 72 |
-
protected function
|
| 73 |
|
| 74 |
Mage::log(print_r($message, true), null, 'LinnLiveExt.log');
|
| 75 |
}
|
| 69 |
return $preparedFilters;
|
| 70 |
}
|
| 71 |
|
| 72 |
+
protected function log($message) {
|
| 73 |
|
| 74 |
Mage::log(print_r($message, true), null, 'LinnLiveExt.log');
|
| 75 |
}
|
app/code/local/LinnSystems/LinnLiveConnect/Model/Community.php
CHANGED
|
@@ -306,7 +306,7 @@ class LinnSystems_LinnLiveConnect_Model_Community extends LinnSystems_LinnLiveCo
|
|
| 306 |
$productAPI = Mage::getModel('catalog/product_api_v2');
|
| 307 |
$productId = $productAPI -> create('configurable', $set, $sku, $productData, $store);
|
| 308 |
|
| 309 |
-
list($assignedProductsArray, $attributesSetArray) = $this -> _prepareConfigurableData($productsSet, $attributesSet, false);
|
| 310 |
$this -> _updateConfigurable($store, $productId, $assignedProductsArray, $attributesSetArray, 'id', false, $reindex);
|
| 311 |
|
| 312 |
return $productId;
|
|
@@ -374,7 +374,7 @@ class LinnSystems_LinnLiveConnect_Model_Community extends LinnSystems_LinnLiveCo
|
|
| 374 |
|
| 375 |
$productAPI -> update($productId, $productData, $store, $identifierType);
|
| 376 |
|
| 377 |
-
list($assignedProductsArray, $attributesSetArray) = $this -> _prepareConfigurableData($productsSet, $attributesSet, true);
|
| 378 |
|
| 379 |
return $this -> _updateConfigurable($store, $productId, $assignedProductsArray, $attributesSetArray, $identifierType, true, $reindex);
|
| 380 |
}
|
| 306 |
$productAPI = Mage::getModel('catalog/product_api_v2');
|
| 307 |
$productId = $productAPI -> create('configurable', $set, $sku, $productData, $store);
|
| 308 |
|
| 309 |
+
list($assignedProductsArray, $attributesSetArray) = $this -> _prepareConfigurableData($productsSet, $attributesSet, $productId, false);
|
| 310 |
$this -> _updateConfigurable($store, $productId, $assignedProductsArray, $attributesSetArray, 'id', false, $reindex);
|
| 311 |
|
| 312 |
return $productId;
|
| 374 |
|
| 375 |
$productAPI -> update($productId, $productData, $store, $identifierType);
|
| 376 |
|
| 377 |
+
list($assignedProductsArray, $attributesSetArray) = $this -> _prepareConfigurableData($productsSet, $attributesSet, $productId, true);
|
| 378 |
|
| 379 |
return $this -> _updateConfigurable($store, $productId, $assignedProductsArray, $attributesSetArray, $identifierType, true, $reindex);
|
| 380 |
}
|
app/code/local/LinnSystems/LinnLiveConnect/Model/Main.php
CHANGED
|
@@ -5,7 +5,7 @@ class LinnSystems_LinnLiveConnect_Model_Main extends Mage_Core_Model_Abstract {
|
|
| 5 |
|
| 6 |
protected $_permittedAttributes = array('select', 'multiselect', 'text', 'textarea', 'date', 'price');
|
| 7 |
|
| 8 |
-
protected function _prepareConfigurableData($productsSet, $attributesSet, $isUpdate) {
|
| 9 |
|
| 10 |
$helper = Mage::helper('linnLiveConnect');
|
| 11 |
|
|
@@ -20,14 +20,30 @@ class LinnSystems_LinnLiveConnect_Model_Main extends Mage_Core_Model_Abstract {
|
|
| 20 |
$attributesSet = array($attributesSet);
|
| 21 |
}
|
| 22 |
|
| 23 |
-
$attributesSetArray = $this -> _prepareAttributesData($helper -> objectToArray($attributesSet), $assignedProductsArray);
|
| 24 |
-
|
| 25 |
foreach ($attributesSetArray as $key => $value) {
|
| 26 |
$attributesSetArray[$key]["id"] = NULL;
|
| 27 |
$attributesSetArray[$key]["position"] = NULL;
|
| 28 |
$attributesSetArray[$key]["store_label"] = isset($value['frontend_label']) ? $value['frontend_label'] : NULL;
|
| 29 |
//$attributesSetArray[$key]["use_default"] = 0;
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
if ($isUpdate == false) {
|
| 32 |
//check if attribute exists and available
|
| 33 |
$checkAttribute = Mage::getModel('catalog/resource_eav_attribute') -> loadByCode('catalog_product', $attributesSetArray[$key]["attribute_code"]);
|
|
@@ -36,8 +52,8 @@ class LinnSystems_LinnLiveConnect_Model_Main extends Mage_Core_Model_Abstract {
|
|
| 36 |
throw new Mage_Api_Exception('invalid_variation_attribute', 'Invalid attribute [' . $checkAttribute['attribute_code'] . '] provided to Magento extension for creating Variation / Product with options. Check attributes/variations in LinnLive Magento configurator if they do exist/match the ones on the back-end.');
|
| 37 |
}
|
| 38 |
}
|
| 39 |
-
|
| 40 |
}
|
|
|
|
| 41 |
return array($assignedProductsArray, $attributesSetArray);
|
| 42 |
}
|
| 43 |
|
|
@@ -138,10 +154,9 @@ class LinnSystems_LinnLiveConnect_Model_Main extends Mage_Core_Model_Abstract {
|
|
| 138 |
|
| 139 |
$product -> setConfigurableProductsData($assignedProducts);
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
}
|
| 145 |
|
| 146 |
try {
|
| 147 |
$result = $product -> save();
|
|
@@ -240,7 +255,7 @@ class LinnSystems_LinnLiveConnect_Model_Main extends Mage_Core_Model_Abstract {
|
|
| 240 |
return $result;
|
| 241 |
}
|
| 242 |
|
| 243 |
-
protected function
|
| 244 |
|
| 245 |
Mage::log(print_r($message, true), null, 'LinnLiveExt.log');
|
| 246 |
}
|
| 5 |
|
| 6 |
protected $_permittedAttributes = array('select', 'multiselect', 'text', 'textarea', 'date', 'price');
|
| 7 |
|
| 8 |
+
protected function _prepareConfigurableData($productsSet, $attributesSet, $productId, $isUpdate) {
|
| 9 |
|
| 10 |
$helper = Mage::helper('linnLiveConnect');
|
| 11 |
|
| 20 |
$attributesSet = array($attributesSet);
|
| 21 |
}
|
| 22 |
|
| 23 |
+
$attributesSetArray = $this -> _prepareAttributesData($helper -> objectToArray($attributesSet), $assignedProductsArray);
|
| 24 |
+
|
| 25 |
foreach ($attributesSetArray as $key => $value) {
|
| 26 |
$attributesSetArray[$key]["id"] = NULL;
|
| 27 |
$attributesSetArray[$key]["position"] = NULL;
|
| 28 |
$attributesSetArray[$key]["store_label"] = isset($value['frontend_label']) ? $value['frontend_label'] : NULL;
|
| 29 |
//$attributesSetArray[$key]["use_default"] = 0;
|
| 30 |
+
|
| 31 |
+
if($isUpdate && isset($value['attribute_id']) && $value['attribute_id'] > 0) {
|
| 32 |
+
$superAttribute = Mage::getModel('catalog/product_type_configurable_attribute')->getCollection()
|
| 33 |
+
->addFieldToFilter('product_id', $productId)
|
| 34 |
+
->addFieldToFilter('attribute_id', $value['attribute_id'])
|
| 35 |
+
->getData();
|
| 36 |
+
|
| 37 |
+
if(sizeof($superAttribute)){
|
| 38 |
+
$superAttribute= array_pop($superAttribute);
|
| 39 |
+
if(isset($superAttribute['product_super_attribute_id']))
|
| 40 |
+
{
|
| 41 |
+
$attributesSetArray[$key]["id"] = $superAttribute['product_super_attribute_id'];
|
| 42 |
+
$attributesSetArray[$key]["position"] = $superAttribute['position'];
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
if ($isUpdate == false) {
|
| 48 |
//check if attribute exists and available
|
| 49 |
$checkAttribute = Mage::getModel('catalog/resource_eav_attribute') -> loadByCode('catalog_product', $attributesSetArray[$key]["attribute_code"]);
|
| 52 |
throw new Mage_Api_Exception('invalid_variation_attribute', 'Invalid attribute [' . $checkAttribute['attribute_code'] . '] provided to Magento extension for creating Variation / Product with options. Check attributes/variations in LinnLive Magento configurator if they do exist/match the ones on the back-end.');
|
| 53 |
}
|
| 54 |
}
|
|
|
|
| 55 |
}
|
| 56 |
+
|
| 57 |
return array($assignedProductsArray, $attributesSetArray);
|
| 58 |
}
|
| 59 |
|
| 154 |
|
| 155 |
$product -> setConfigurableProductsData($assignedProducts);
|
| 156 |
|
| 157 |
+
$product -> setConfigurableAttributesData($assignedAttributes);
|
| 158 |
+
$product -> setCanSaveConfigurableAttributes(true);
|
| 159 |
+
|
|
|
|
| 160 |
|
| 161 |
try {
|
| 162 |
$result = $product -> save();
|
| 255 |
return $result;
|
| 256 |
}
|
| 257 |
|
| 258 |
+
protected function log($message) {
|
| 259 |
|
| 260 |
Mage::log(print_r($message, true), null, 'LinnLiveExt.log');
|
| 261 |
}
|
app/code/local/LinnSystems/LinnLiveConnect/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<LinnSystems_LinnLiveConnect>
|
| 5 |
-
<version>1.1.
|
| 6 |
</LinnSystems_LinnLiveConnect>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<LinnSystems_LinnLiveConnect>
|
| 5 |
+
<version>1.1.60</version>
|
| 6 |
</LinnSystems_LinnLiveConnect>
|
| 7 |
</modules>
|
| 8 |
<global>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>LinnLiveConnect</name>
|
| 4 |
-
<version>1.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL v2</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -9,11 +9,11 @@
|
|
| 9 |
<summary>Extended SOAP WS-I compliant API to support integration with LinnLive2.</summary>
|
| 10 |
<description>Extended SOAP WS-I compliant API to support integration with LinnLive2 (http://www.linnlive.com).
|
| 11 |
Contains some workarounds to avoid bugs in original Magento modules and additional functionality to operate Magento store remotely.</description>
|
| 12 |
-
<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-12-
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magelocal"><dir name="LinnSystems"><dir name="LinnLiveConnect"><dir name="Helper"><file name="Data.php" hash="
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>LinnLiveConnect</name>
|
| 4 |
+
<version>1.1.60</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL v2</license>
|
| 7 |
<channel>community</channel>
|
| 9 |
<summary>Extended SOAP WS-I compliant API to support integration with LinnLive2.</summary>
|
| 10 |
<description>Extended SOAP WS-I compliant API to support integration with LinnLive2 (http://www.linnlive.com).
|
| 11 |
Contains some workarounds to avoid bugs in original Magento modules and additional functionality to operate Magento store remotely.</description>
|
| 12 |
+
<notes>Variation price update process improved</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-12-15</date>
|
| 15 |
+
<time>13:21:24</time>
|
| 16 |
+
<contents><target name="magelocal"><dir name="LinnSystems"><dir name="LinnLiveConnect"><dir name="Helper"><file name="Data.php" hash="5b967436961a83d0d2d28f661531d057"/><file name="Factory.php" hash="7e0a0e26fa3618917f3540b799b05840"/><file name="Settings.php" hash="086ba912d38dc66964a2f40f685394a5"/></dir><dir name="Model"><dir name="Api"><file name="V2.php" hash="a60247b30a00144ee34b77b74821266a"/></dir><dir name="Category"><file name="Api.php" hash="c01d5bb1dfb59a559c3b94615593e38d"/></dir><file name="Community.php" hash="4b189c380cf34ce0016d8e72304dd44e"/><file name="Main.php" hash="f0e9eff62c728f566e9a7da8730ac4d6"/><dir name="Product"><dir name="Api"><file name="V2.php" hash="0497a6775a80f0292b47aa0e64eee77d"/></dir><file name="Api.php" hash="721f80734374313c91d2cfbf46fb7a17"/><dir name="Attribute"><file name="Api.php" hash="d0678623a145bc2d76993819bd63bdb9"/><dir name="Media"><file name="Api.php" hash="62d58c61d93371793ebe94162755c4cd"/></dir></dir><dir name="Link"><file name="Api.php" hash="d42a76ca6368eabad4e4a96fd40a93a2"/></dir></dir></dir><dir name="etc"><file name="api.xml" hash="a4b2a568bf5b2def5f3fe32c06b4528c"/><file name="config.xml" hash="5d5da05c233d4d321e294ebdea55e944"/><file name="wsdl.xml" hash="2b450fd6a6332d20583aaa4fc52012b6"/><file name="wsi.xml" hash="ad8aa3b49ac9cd24a3d1a4bef61d846d"/></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>
|
