Mashon_Sync - Version 1.3.3

Version Notes

developed on magento 1.5.1.0;

- changed SKU setting for Templates so that it now uses client SKU rather than internal SKU when creating a product
- now products with only one Size or Color option will not import these options

Download this release

Release Info

Developer brandonWargo
Extension Mashon_Sync
Version 1.3.3
Comparing to
See all releases


Code changes from version 1.3.2 to 1.3.3

app/code/community/Mashon/Sync/Helper/Data.php CHANGED
@@ -30,13 +30,13 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
30
  if($jsonResponse){
31
  //check for duplicate SKUs first
32
  $checkProduct = null;
33
- if($designedProduct == "true"){
34
  //Mage::log("About to load product");
35
- $checkProduct = Mage::getModel('catalog/product')->getIdBySku($jsonResponse->{'clientSku'});
36
- }
37
- else {
38
- $checkProduct = Mage::getModel('catalog/product')->getIdBySku($jsonResponse->{'internalSku'});
39
- }
40
  if($checkProduct){
41
  return array("_id" => $jsonResponse->{'_id'},"success" => false,"message" => "Duplicate Sku. Please change your client sku and re-sync.","shopProductId" => "");
42
  }
@@ -44,7 +44,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
44
  $response = $this->_createShopProduct($jsonResponse,$designedProduct);
45
  //Mage::log("Created product");
46
  if($response){
47
- return array("_id" => $jsonResponse->{'_id'},"success" => true,"message" => "Product was successfully updated in your store. ","shopProductId" => $response); //newly created Magento Shop Product Id
48
  }
49
  }
50
  else{
@@ -75,7 +75,11 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
75
  $jsonResponse = $this->_getDabbleJson($dabbleId,$designedProduct);
76
 
77
  if($jsonResponse){
78
-
 
 
 
 
79
  $response = $this->_updateShopProduct($jsonResponse,$designedProduct,$magentoid);
80
 
81
  if($response){
@@ -127,12 +131,11 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
127
  $product->setShortDescription($data->{'shortDescription'});
128
  $product->setPrice($data->{'MSRP'});
129
  $product->setWeight($data->{'weight'});
 
130
  if($designedProduct == "true"){
131
- $product->setSku($data->{'clientSku'});
132
  $product->setProducttype('designed');
133
  }
134
  else {
135
- $product->setSku($data->{'internalSku'});
136
  $product->setProducttype('configured');
137
  }
138
 
@@ -219,7 +222,7 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
219
  $cart->init();
220
 
221
  $_product = Mage::getModel('catalog/product');
222
- $productId = $_product->getIdBySku($productData->attributes['internalSku']);
223
  $product = $_product->load($productId);
224
  $product->setCanSaveConfigurableAttributes(true);
225
  $product->setCanSaveCustomOptions(true);
@@ -350,26 +353,25 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
350
  $product->setTemplateid($data->{'_id'});
351
  $product->setStatus(1);
352
  $product->setTaxClassId(2); # 0 - not taxed, 2 - taxable goods, 4 - taxable shipping
353
-
354
- //had to comment this out, seems that it takes too long for the product to save if this is set; by default though a product is saved this way
355
- /*$product->setStockData(array(
356
- 'manage_stock' => 0,
357
- 'use_config_manage_stock' => 0
358
- ));*/
 
 
359
  $product->setHasOptions(1);
360
 
361
  //had to comment this out for now, it's up to the shopowners to set up dabble in the product detail page
362
  //$product->setCustomDesign('default/dabble');
363
  //$product->setPageLayout('one_column');
364
 
365
- if($designedProduct == "true"){
366
- $product->setSku($data->{'clientSku'});
367
  $product->setProducttype('designed');
368
  }
369
  else {
370
- $product->setSku($data->{'internalSku'});
371
- $product->setProducttype('configured');
372
-
373
  }
374
 
375
  $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
@@ -460,9 +462,6 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
460
  }
461
  if(count($tempOptions) > 1){
462
  $arrayOption[] = $this->_setCustomOption($tempOptions, "Size", "drop_down", false, $tempPrices, 1);
463
- }
464
- else{
465
- $arrayOption[] = $this->_setCustomOption($tempOptions, "Size", "drop_down", false, $tempPrices, 1);
466
  }
467
  }
468
  if($optionKey == 'colors'){
@@ -483,9 +482,6 @@ class Mashon_Sync_Helper_Data extends Mage_Core_Helper_Abstract
483
  if(count($tempOptions) > 1){
484
  $arrayOption[] = $this->_setCustomOption($tempOptions, "Color", "drop_down", false, $tempPrices, 1);
485
  }
486
- else{
487
- $arrayOption[] = $this->_setCustomOption($tempOptions, "Color", "drop_down", false, $tempPrices, 1);
488
- }
489
  }
490
  } //end foreach
491
  if($designedProduct != "true"){
30
  if($jsonResponse){
31
  //check for duplicate SKUs first
32
  $checkProduct = null;
33
+ //if($designedProduct == "true"){
34
  //Mage::log("About to load product");
35
+ $checkProduct = Mage::getModel('catalog/product')->getIdBySku($jsonResponse->{'clientSku'});
36
+ //}
37
+ //else {
38
+ // $checkProduct = Mage::getModel('catalog/product')->getIdBySku($jsonResponse->{'internalSku'});
39
+ // }
40
  if($checkProduct){
41
  return array("_id" => $jsonResponse->{'_id'},"success" => false,"message" => "Duplicate Sku. Please change your client sku and re-sync.","shopProductId" => "");
42
  }
44
  $response = $this->_createShopProduct($jsonResponse,$designedProduct);
45
  //Mage::log("Created product");
46
  if($response){
47
+ return array("_id" => $jsonResponse->{'_id'},"success" => true,"message" => "Product was successfully created in your store. ","shopProductId" => $response); //newly created Magento Shop Product Id
48
  }
49
  }
50
  else{
75
  $jsonResponse = $this->_getDabbleJson($dabbleId,$designedProduct);
76
 
77
  if($jsonResponse){
78
+ $checkProduct = null;
79
+ $checkProduct = Mage::getModel('catalog/product')->getIdBySku($jsonResponse->{'clientSku'});
80
+ if($checkProduct){
81
+ return array("_id" => $jsonResponse->{'_id'},"success" => false,"message" => "Duplicate Sku. Please change your client sku and re-sync.","shopProductId" => "");
82
+ }
83
  $response = $this->_updateShopProduct($jsonResponse,$designedProduct,$magentoid);
84
 
85
  if($response){
131
  $product->setShortDescription($data->{'shortDescription'});
132
  $product->setPrice($data->{'MSRP'});
133
  $product->setWeight($data->{'weight'});
134
+ $product->setSku($data->{'clientSku'});
135
  if($designedProduct == "true"){
 
136
  $product->setProducttype('designed');
137
  }
138
  else {
 
139
  $product->setProducttype('configured');
140
  }
141
 
222
  $cart->init();
223
 
224
  $_product = Mage::getModel('catalog/product');
225
+ $productId = $_product->getIdBySku($productData->attributes['clientSku']);
226
  $product = $_product->load($productId);
227
  $product->setCanSaveConfigurableAttributes(true);
228
  $product->setCanSaveCustomOptions(true);
353
  $product->setTemplateid($data->{'_id'});
354
  $product->setStatus(1);
355
  $product->setTaxClassId(2); # 0 - not taxed, 2 - taxable goods, 4 - taxable shipping
356
+ $product->setSku($data->{'clientSku'});
357
+
358
+ $product->setStockData(array(
359
+ 'manage_stock' => 0,
360
+ 'use_config_manage_stock' => 0,
361
+ 'inventory_use_config_min_sale_qty' => 1,
362
+ 'inventory_use_config_max_sale_qty' => 1
363
+ ));
364
  $product->setHasOptions(1);
365
 
366
  //had to comment this out for now, it's up to the shopowners to set up dabble in the product detail page
367
  //$product->setCustomDesign('default/dabble');
368
  //$product->setPageLayout('one_column');
369
 
370
+ if($designedProduct == "true"){
 
371
  $product->setProducttype('designed');
372
  }
373
  else {
374
+ $product->setProducttype('configured');
 
 
375
  }
376
 
377
  $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
462
  }
463
  if(count($tempOptions) > 1){
464
  $arrayOption[] = $this->_setCustomOption($tempOptions, "Size", "drop_down", false, $tempPrices, 1);
 
 
 
465
  }
466
  }
467
  if($optionKey == 'colors'){
482
  if(count($tempOptions) > 1){
483
  $arrayOption[] = $this->_setCustomOption($tempOptions, "Color", "drop_down", false, $tempPrices, 1);
484
  }
 
 
 
485
  }
486
  } //end foreach
487
  if($designedProduct != "true"){
app/code/community/Mashon/Sync/etc/config.xml CHANGED
@@ -11,7 +11,7 @@
11
  <config>
12
  <modules>
13
  <Mashon_Sync>
14
- <version>1.3.2</version>
15
  </Mashon_Sync>
16
  </modules>
17
  <global>
11
  <config>
12
  <modules>
13
  <Mashon_Sync>
14
+ <version>1.3.3</version>
15
  </Mashon_Sync>
16
  </modules>
17
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mashon_Sync</name>
4
- <version>1.3.2</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>
@@ -10,13 +10,12 @@
10
  <description>Mashon_Sync allows the Magento shop owner to easily integrate Dabble into their Magento version 1.5.1.0 shop. This extension allows you to sync your Dabble Templates and Designed Products into Magento.</description>
11
  <notes>developed on magento 1.5.1.0;&#xD;
12
  &#xD;
13
- - improved error messaging system&#xD;
14
- - fixed bug when check for duplicate skus&#xD;
15
- - changed tax class to Taxable Goods when creating new products</notes>
16
  <authors><author><name>brandonWargo</name><user>brandonWargo</user><email>brandon.wargo@mashon.com</email></author></authors>
17
- <date>2012-02-09</date>
18
- <time>20:48:46</time>
19
- <contents><target name="magecommunity"><dir name="Mashon"><dir name="Sync"><dir name="Block"><file name="Sync.php" hash="d880873f5863ac7d2e627edad0289266"/></dir><dir name="Helper"><file name="Data.php" hash="b78ec0288cb926371da4cb381a1526e8"/></dir><dir name="controllers"><file name="CartController.php" hash="56a3e95f9fe636a1c77567effa2dae0f"/><file name="OrderController.php" hash="5a834a5d4980b05f8684e7d10739e20a"/><file name="ProductController.php" hash="1558404804f2174b04d7163059522bf0"/></dir><dir name="etc"><file name="config.xml" hash="1c6e26c088811a8af53befe1c1d60e9e"/></dir><dir name="sql"><dir name="mashon_setup"><file name="mysql4-install-1.0.php" hash="68360fce812822c6b9b802c629288c46"/><file name="mysql4-upgrade-1.0-1.1.php" hash="46e3030b6acf2a66aaa843924a8af710"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mashon_All.xml" hash="2929381275448f2ea1409a08703b6349"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="dabble"><dir name="template"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="1883d9ac26da40bfbba351448d0997cc"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="7cb8b98411059ecd0651cc116fa973e3"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mashon_Sync</name>
4
+ <version>1.3.3</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>
10
  <description>Mashon_Sync allows the Magento shop owner to easily integrate Dabble into their Magento version 1.5.1.0 shop. This extension allows you to sync your Dabble Templates and Designed Products into Magento.</description>
11
  <notes>developed on magento 1.5.1.0;&#xD;
12
  &#xD;
13
+ - changed SKU setting for Templates so that it now uses client SKU rather than internal SKU when creating a product&#xD;
14
+ - now products with only one Size or Color option will not import these options</notes>
 
15
  <authors><author><name>brandonWargo</name><user>brandonWargo</user><email>brandon.wargo@mashon.com</email></author></authors>
16
+ <date>2012-02-28</date>
17
+ <time>00:30:44</time>
18
+ <contents><target name="magecommunity"><dir name="Mashon"><dir name="Sync"><dir name="Block"><file name="Sync.php" hash="d880873f5863ac7d2e627edad0289266"/></dir><dir name="Helper"><file name="Data.php" hash="4aba45ffcb9eca559eac0d3890bdbf47"/></dir><dir name="controllers"><file name="CartController.php" hash="56a3e95f9fe636a1c77567effa2dae0f"/><file name="OrderController.php" hash="5a834a5d4980b05f8684e7d10739e20a"/><file name="ProductController.php" hash="1558404804f2174b04d7163059522bf0"/></dir><dir name="etc"><file name="config.xml" hash="da7efac7cfccb4de678f00cf767d1b82"/></dir><dir name="sql"><dir name="mashon_setup"><file name="mysql4-install-1.0.php" hash="68360fce812822c6b9b802c629288c46"/><file name="mysql4-upgrade-1.0-1.1.php" hash="46e3030b6acf2a66aaa843924a8af710"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mashon_All.xml" hash="2929381275448f2ea1409a08703b6349"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="dabble"><dir name="template"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="1883d9ac26da40bfbba351448d0997cc"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="7cb8b98411059ecd0651cc116fa973e3"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>