Mage_Codi - Version 4.2.1

Version Notes

Please contact our support desk if you have any problems.

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Codi
Version 4.2.1
Comparing to
See all releases


Code changes from version 4.2.0 to 4.2.1

app/code/community/Mage/CodiScript/Model/Files.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // 2015-03-02
3
  class ConfiguredProductLine{
4
  public $optionIds = array();
5
  public $line = NULL;
@@ -194,6 +194,14 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
194
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
195
  $ProductAttributes .= $sp.$TierPriceAttributes;
196
  }
 
 
 
 
 
 
 
 
197
  if( !empty( $ProductAttributes ) )
198
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
199
  if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
@@ -503,6 +511,14 @@ thumbnail: ".$product->getThumbnail()."
503
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
504
  $ProductAttributes.= $sp.$TierPriceAttributes;
505
  }
 
 
 
 
 
 
 
 
506
  if( !empty( $ProductAttributes ) )
507
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
508
  if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
@@ -584,7 +600,6 @@ thumbnail: ".$product->getThumbnail()."
584
  }
585
  $ConfigurableAttributes = $product->getTypeInstance( true )->getConfigurableAttributes( $product );
586
  foreach( $ConfigurableAttributes as $attribute ){
587
- // $attribute->setStoreId( $this->StoreId );
588
  if( $this->_DEBUG ){
589
  echo "configurable attr: ".$attribute->getLabel()."
590
  ";
@@ -1023,6 +1038,14 @@ thumbnail: ".$product->getThumbnail()."
1023
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
1024
  $ProductAttributes.= $sp.$TierPriceAttributes;
1025
  }
 
 
 
 
 
 
 
 
1026
  if( !empty( $ProductAttributes ) )
1027
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
1028
  $ProdRPrice = $product->getData('price');
@@ -1202,6 +1225,86 @@ thumbnail: ".$product->getThumbnail()."
1202
  $optNumber++;
1203
  }
1204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1205
 
1206
  private function _cleanStr( &$str ){
1207
  return str_replace("\n"," ", str_replace("\r"," ", str_replace("\r\n"," ", str_replace("\t"," ", $str ) ) ) );
1
  <?php
2
+ // 2015-03-30
3
  class ConfiguredProductLine{
4
  public $optionIds = array();
5
  public $line = NULL;
194
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
195
  $ProductAttributes .= $sp.$TierPriceAttributes;
196
  }
197
+ if( $this->importoptionsasattributes ){
198
+ $optionsAsAttributes = $this->_getCustomOptionsAsAttributes( $product );
199
+ if( !empty ( $optionsAsAttributes ) ){
200
+ if( !empty( $ProductAttributes ) )
201
+ $ProductAttributes .= "|";
202
+ $ProductAttributes .= $optionsAsAttributes;
203
+ }
204
+ }
205
  if( !empty( $ProductAttributes ) )
206
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
207
  if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
511
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
512
  $ProductAttributes.= $sp.$TierPriceAttributes;
513
  }
514
+ if( $this->importoptionsasattributes ){
515
+ $optionsAsAttributes = $this->_getCustomOptionsAsAttributes( $product );
516
+ if( !empty ( $optionsAsAttributes ) ){
517
+ if( !empty( $ProductAttributes ) )
518
+ $ProductAttributes .= "|";
519
+ $ProductAttributes .= $optionsAsAttributes;
520
+ }
521
+ }
522
  if( !empty( $ProductAttributes ) )
523
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
524
  if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
600
  }
601
  $ConfigurableAttributes = $product->getTypeInstance( true )->getConfigurableAttributes( $product );
602
  foreach( $ConfigurableAttributes as $attribute ){
 
603
  if( $this->_DEBUG ){
604
  echo "configurable attr: ".$attribute->getLabel()."
605
  ";
1038
  $sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
1039
  $ProductAttributes.= $sp.$TierPriceAttributes;
1040
  }
1041
+ if( $this->importoptionsasattributes ){
1042
+ $optionsAsAttributes = $this->_getCustomOptionsAsAttributes( $product );
1043
+ if( !empty ( $optionsAsAttributes ) ){
1044
+ if( !empty( $ProductAttributes ) )
1045
+ $ProductAttributes .= "|";
1046
+ $ProductAttributes .= $optionsAsAttributes;
1047
+ }
1048
+ }
1049
  if( !empty( $ProductAttributes ) )
1050
  $ProductAttributes = $this->_cleanStr( $ProductAttributes );
1051
  $ProdRPrice = $product->getData('price');
1225
  $optNumber++;
1226
  }
1227
  }
1228
+
1229
+ private function _getCustomOptionsAsAttributes( $product ){
1230
+ $attributes = "";
1231
+ $customOptions = $product->getOptions();
1232
+ if( $customOptions ){
1233
+ //We should support all 4 selects: dropdown, radio buttons, checkbox, and multiple select.
1234
+ //\app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
1235
+ if( $this->_DEBUG ) echo "=== customOptions ===
1236
+ ";
1237
+ $max_sort_order = 0;
1238
+ foreach( $customOptions as $option ){
1239
+ if( $option->getSortOrder() > $max_sort_order ){
1240
+ $max_sort_order = $option->getSortOrder();
1241
+ } else if( $option->getSortOrder() < 0 ){
1242
+ $option->setSortOrder( -1 );
1243
+ }
1244
+ }
1245
+ if( $this->_DEBUG ){
1246
+ for( $sortorder = -1; $sortorder <= $max_sort_order; $sortorder++ ){
1247
+ foreach ($customOptions as $option) {
1248
+ if( $option->getSortOrder() != $sortorder ) continue;
1249
+ echo "customOption #".$option->getOptionId()." title=".$option->getTitle()." storeTitle=".$option->getStoreTitle()." type=".$option->getType()." sort_order".$option->getSortOrder()."
1250
+ ";
1251
+ if( $option->getValues() ){
1252
+ $max_v_sort_order = 0;
1253
+ foreach ($option->getValues() as $_value) {
1254
+ if( $_value->getSortOrder() > $max_v_sort_order ){
1255
+ $max_v_sort_order = $_value->getSortOrder();
1256
+ } else if( $_value->getSortOrder() < 0 ){
1257
+ $_value->setSortOrder( -1 );
1258
+ }
1259
+ }
1260
+ for( $vsortorder = -1; $vsortorder <= $max_v_sort_order; $vsortorder++ ){
1261
+ if( $_value->getSortOrder() != $vsortorder ) continue;
1262
+ foreach ($option->getValues() as $_value) {
1263
+ echo "value title=".$_value->getTitle()." storeTitle=".$option->getStoreTitle()." price=".$_value->getPrice()." price_type=".$_value->getPriceType()." sku=".$_value->getSku()." sort_order=".$_value->getSortOrder()."
1264
+ ";
1265
+ }
1266
+ }
1267
+ }
1268
+ }
1269
+ }
1270
+ }
1271
+ for( $sortorder = -1; $sortorder <= $max_sort_order; $sortorder++ ){
1272
+ foreach ($customOptions as $option) {
1273
+ if( $option->getSortOrder() != $sortorder ) continue;
1274
+ if( $option->getType() != "drop_down" && $option->getType() != "radio" && $option->getType() != "multiple" && $option->getType() != "checkbox" ) continue;
1275
+ $optionTitle = $option->getStoreTitle();
1276
+ if( empty( $optionTitle ) )
1277
+ $optionTitle = $option->getTitle();
1278
+ $optionValues = "";
1279
+ if( $option->getValues() ){
1280
+ $max_v_sort_order = 0;
1281
+ foreach( $option->getValues() as $_value ){
1282
+ if( $_value->getSortOrder() > $max_v_sort_order ){
1283
+ $max_v_sort_order = $_value->getSortOrder();
1284
+ } else if( $_value->getSortOrder() < 0 ){
1285
+ $_value->setSortOrder( -1 );
1286
+ }
1287
+ }
1288
+ for( $vsortorder = -1; $vsortorder <= $max_v_sort_order; $vsortorder++ ){
1289
+ foreach( $option->getValues() as $_value ){
1290
+ if( $_value->getSortOrder() != $vsortorder ) continue;
1291
+ if( !empty( $optionValues ) )
1292
+ $optionValues .= "<br/>";
1293
+ $valueTitle = $_value->getStoreTitle();
1294
+ if( empty( $valueTitle ) )
1295
+ $valueTitle = $_value->getTitle();
1296
+ $optionValues .= $valueTitle;
1297
+ }
1298
+ }
1299
+ }
1300
+ if( !empty( $attributes ) )
1301
+ $attributes .= "|";
1302
+ $attributes .= $optionTitle . "=" . $optionValues;
1303
+ }
1304
+ }
1305
+ }
1306
+ return $attributes;
1307
+ }
1308
 
1309
  private function _cleanStr( &$str ){
1310
  return str_replace("\n"," ", str_replace("\r"," ", str_replace("\r\n"," ", str_replace("\t"," ", $str ) ) ) );
app/code/community/Mage/CodiScript/controllers/IndexController.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define("__VERSION__","2015-03-02");
3
  define("__SCRIPTNAME__",basename(__FILE__));
4
 
5
  class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
@@ -233,6 +233,9 @@ executed in ".( time() - $started_time )." sec.
233
  ";
234
  die();
235
  /* RELEASE NOTES
 
 
 
236
  * 2015-03-02
237
  * Filtering out disabled products improved for associated products of configurable products
238
  *
1
  <?php
2
+ define("__VERSION__","2015-03-30");
3
  define("__SCRIPTNAME__",basename(__FILE__));
4
 
5
  class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
233
  ";
234
  die();
235
  /* RELEASE NOTES
236
+ * 2015-03-30
237
+ * Added retrieval of custom product options in case of importoptionsasattributes=true
238
+ *
239
  * 2015-03-02
240
  * Filtering out disabled products improved for associated products of configurable products
241
  *
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Codi</name>
4
- <version>4.2.0</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,9 +10,9 @@
10
  <description>Extension to connect to the Catalog-on-Demand service for making print catalogs, brochures, and flyers.</description>
11
  <notes>Please contact our support desk if you have any problems.</notes>
12
  <authors><author><name>catalogondemand</name><user>auto-converted</user><email>timh@catalog-on-demand.com</email></author></authors>
13
- <date>2015-03-02</date>
14
- <time>17:31:37</time>
15
- <contents><target name="magecommunity"><dir name="Mage"><dir name="CodiScript"><dir name="Helper"><file name="Data.php" hash="3f99660cb06a9dc09f024b9993d43a3f"/></dir><dir name="Model"><file name="Files.php" hash="5b5801b0a9d13eef80c2800028e67071"/></dir><dir name="controllers"><file name="IndexController.php" hash="35dc155f02fb018d2d6d954d7a588551"/></dir><dir name="etc"><file name="adminhtml.xml" hash="40ab0bd86928c5ba175988926a9f6aee"/><file name="config.xml" hash="b960e9bd106f0c94559baa2bc5761e18"/><file name="system.xml" hash="1b5e5b18bfdce6b85e304fb4ef877274"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_CodiScript.xml" hash="f0502cac7918fc798b3b02d3d4b7e7fd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="codiscript.xml" hash="066f99333a6054e11943a75413f65ff0"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="codi"><file name="password_validation.js" hash="7223aeed118bb5774c73f951460ae0b0"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_CodiScript.csv" hash="183fc591065ced83f878a4c3e23f854c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Codi</name>
4
+ <version>4.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>Extension to connect to the Catalog-on-Demand service for making print catalogs, brochures, and flyers.</description>
11
  <notes>Please contact our support desk if you have any problems.</notes>
12
  <authors><author><name>catalogondemand</name><user>auto-converted</user><email>timh@catalog-on-demand.com</email></author></authors>
13
+ <date>2015-03-31</date>
14
+ <time>13:39:43</time>
15
+ <contents><target name="magecommunity"><dir name="Mage"><dir name="CodiScript"><dir name="Helper"><file name="Data.php" hash="3f99660cb06a9dc09f024b9993d43a3f"/></dir><dir name="Model"><file name="Files.php" hash="d714a47f138b57f074c25269f356b1e3"/></dir><dir name="controllers"><file name="IndexController.php" hash="1008449108e0e32c15c923430b37199e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="40ab0bd86928c5ba175988926a9f6aee"/><file name="config.xml" hash="b960e9bd106f0c94559baa2bc5761e18"/><file name="system.xml" hash="1b5e5b18bfdce6b85e304fb4ef877274"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_CodiScript.xml" hash="f0502cac7918fc798b3b02d3d4b7e7fd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="codiscript.xml" hash="066f99333a6054e11943a75413f65ff0"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="codi"><file name="password_validation.js" hash="7223aeed118bb5774c73f951460ae0b0"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_CodiScript.csv" hash="183fc591065ced83f878a4c3e23f854c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>