Mage_Codi - Version 4.1.2

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.1.2
Comparing to
See all releases


Code changes from version 4.1.1 to 4.1.2

app/code/community/Mage/CodiScript/Model/Files.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // 2014-01-18
3
  class ConfiguredProductLine{
4
  public $optionIds = array();
5
  public $line = NULL;
@@ -25,6 +25,7 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
25
  public $includespecialpricedateto = FALSE;
26
  public $ignoreexcludedimages = FALSE;
27
  public $ignoreassprodimages = FALSE;
 
28
  public $start = 0;
29
  public $pageSize = 1000000000;
30
  public $address = FALSE;
@@ -141,15 +142,28 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
141
  $attributes = $product->getAttributes();
142
  $Manufacturer = "";
143
  $ProductAttributes = "";
144
- foreach ($attributes as $attribute) {
 
 
 
 
 
 
145
  if( $attribute->getAttributeCode()=="manufacturer" ){
146
- $Manufacturer = $attribute->getFrontend()->getValue( $product );
147
- if( $Manufacturer == NULL || $Manufacturer == "No" || $Manufacturer == "Other" )
 
148
  $Manufacturer = "";
149
  continue;
150
  }
151
- if( $attribute->getIsVisibleOnFront() ){
 
152
  $value = $attribute->getFrontend()->getValue( $product );
 
 
 
 
 
153
  if( is_string( $value ) && strlen( $value ) ){
154
  if( !empty( $ProductAttributes ) )
155
  $ProductAttributes .= "|";
@@ -164,19 +178,27 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
164
  }
165
  if( !empty( $ProductAttributes ) )
166
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
167
- // echo "product image : ".$product->getImage()."
168
- //product small image: ".$product->getSmallImage()."
169
- //product thumbnail : ".$product->getThumbnail()."
170
  //";
171
  $prodImages = array();
 
 
 
 
 
172
  $prodImageArray = $product->getMediaGallery('images');
173
  if( is_array($prodImageArray) ){
174
  foreach( $prodImageArray as $image ){
175
- // echo "gallery image ".$image['file']." disabled=".$image['disabled']."
 
176
  //";
 
 
177
  if( $this->ignoreexcludedimages && $image['disabled'] )
178
  continue;
179
- $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
180
  }
181
  }
182
  $prodImages = implode( "#|#", $prodImages );
@@ -262,36 +284,58 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
262
  ";
263
  if($this->ignoreassprodimages) $itemImages = "";
264
  else{
 
 
 
 
265
  $itemImages = array();
 
 
 
 
 
266
  $itemImageArray = $UsedProduct->getMediaGallery('images');
267
  if( is_array($itemImageArray) ){
268
  foreach( $itemImageArray as $image ){
269
- // echo "gallery image ".$image['file']." disabled=".$image['disabled']."
 
270
  //";
 
 
271
  if( $this->ignoreexcludedimages && $image['disabled'] )
272
  continue;
273
- $itemImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
274
  }
275
  }
276
  $itemImages = implode( "#|#", $itemImages );
277
  }
278
  $attributes = $UsedProduct->getAttributes();
279
  $ItemAttributes = "";
280
- foreach ($attributes as $attribute) {
 
 
 
 
 
 
281
  if($attribute->getAttributeCode()=="manufacturer"){
282
- if( empty( $Manufacturer ) )
283
- $Manufacturer = $attribute->getFrontend()->getValue( $product );
284
- if( $Manufacturer == "No" || $Manufacturer == "Other" )
285
- $Manufacturer = "";
286
  continue;
287
  }
288
- if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), array() )){
 
289
  $value = $attribute->getFrontend()->getValue( $UsedProduct );
 
 
 
 
 
290
  if( is_string( $value ) && strlen( $value ) )
291
  $ItemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|";
292
  }
293
  }
294
- $ItemAttributes = substr($ItemAttributes, 0, strlen($ItemAttributes)-1 );
295
  if( $this->includeinvqty ){
296
  if( !empty( $ItemAttributes ) )
297
  $ItemAttributes .= "|";
@@ -387,16 +431,24 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
387
  $attributes = $product->getAttributes();
388
  $Manufacturer = "";
389
  $ProductAttributes = "";
390
- foreach ($attributes as $attribute) {
 
391
  if( $attribute->getAttributeCode()=="manufacturer" ){
392
- $Manufacturer = $attribute->getFrontend()->getValue( $product );
393
- if( $Manufacturer == NULL || $Manufacturer == "No" || $Manufacturer == "Other" )
 
394
  $Manufacturer = "";
395
  continue;
396
  }
397
- if ($attribute->getIsVisibleOnFront() ) {
398
- $value = $attribute->getFrontend()->getValue($product);
399
- if( is_string($value) && strlen( $value ) ){
 
 
 
 
 
 
400
  if( !empty( $ProductAttributes ) )
401
  $ProductAttributes .= "|";
402
  $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value;
@@ -410,19 +462,27 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
410
  }
411
  if( !empty( $ProductAttributes ) )
412
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
413
- // echo "product image : ".$product->getImage()."
414
- //product small image: ".$product->getSmallImage()."
415
- //product thumbnail : ".$product->getThumbnail()."
416
  //";
417
  $prodImages = array();
 
 
 
 
 
418
  $prodImageArray = $product->getMediaGallery('images');
419
  if( is_array($prodImageArray) ){
420
  foreach( $prodImageArray as $image ){
421
- // echo "gallery image ".$image['file']." disabled=".$image['disabled']."
 
422
  //";
 
 
423
  if( $this->ignoreexcludedimages && $image['disabled'] )
424
  continue;
425
- $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
426
  }
427
  }
428
  $prodImages = implode( "#|#", $prodImages );
@@ -481,6 +541,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
481
  $attributes = $UsedProduct->getAttributes();
482
  $ItemAttributes = "";
483
  foreach( $ConfigurableAttributes as $attribute ){
 
484
  $configurableProdAttribute = $attribute->getProductAttribute();
485
  if( empty( $configurableProdAttribute ) ){
486
  $label = $attribute->getLabel();
@@ -500,6 +561,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
500
  break;
501
  }
502
  }
 
 
503
  if( !empty( $ItemAttributes ) )
504
  $ItemAttributes .= "|";
505
  $ItemAttributes .= $AttributeLabel."=".$AttributeValue;
@@ -560,21 +623,29 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
560
  $ItemAttributes .= "Special Price To Date=".substr( $SToDate, 0, 10 );
561
  }
562
  }
563
- // echo "config item image : ".$UsedProduct->getImage()."
564
- //config item small image: ".$UsedProduct->getSmallImage()."
565
- //config item thumbnail : ".$UsedProduct->getThumbnail()."
566
- //";
567
  if($this->ignoreassprodimages) $itemImages = "";
568
  else{
 
 
 
 
569
  $itemImages = array();
 
 
 
 
 
570
  $itemImageArray = $UsedProduct->getMediaGallery('images');
571
  if( is_array($itemImageArray) ){
572
  foreach( $itemImageArray as $image ){
573
- // echo "gallery image ".$image['file']." disabled=".$image['disabled']."
 
574
  //";
 
 
575
  if( $this->ignoreexcludedimages && $image['disabled'] )
576
  continue;
577
- $itemImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
578
  }
579
  }
580
  $itemImages = implode( "#|#", $itemImages );
@@ -612,8 +683,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
612
  $optionIds[] = $optionIdLine;
613
  $attrNumberNo++;
614
  }
615
- if( $this->_DEBUG ) foreach( $optionIds as $key => $optionIdLine ) echo "optionIds[".$key."]: ".var_export( $optionIdLine, true )."
616
- ";
617
  $optNumbers = array();
618
  $attrNumber = 0;
619
  while( $attrNumber < $attrNumberNo ){
@@ -640,8 +711,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
640
  $attrNo++;
641
  }
642
  if( $matching ){
643
- if( $this->_DEBUG ) echo "option ids: ".var_export( $cpLine->optionIds, true )."
644
- ";
645
  $ProducttoString .= $cpLine->line
646
  ."\t". $sequence
647
  ."\n";
@@ -690,38 +761,61 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
690
  $ProductDescription .= $longDescription;
691
  }
692
  }
693
- // echo "product image : ".$product->getImage()."
694
- //product small image: ".$product->getSmallImage()."
695
- //product thumbnail : ".$product->getThumbnail()."
696
- //";
697
  $prodImages = array();
 
 
 
 
 
 
 
 
 
698
  $prodImageArray = $product->getMediaGallery('images');
699
  if( is_array($prodImageArray) ){
700
  foreach( $prodImageArray as $image ){
701
- // echo "gallery image ".$image['file']." disabled=".$image['disabled']."
 
702
  //";
 
 
703
  if( $this->ignoreexcludedimages && $image['disabled'] )
704
  continue;
705
- $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
706
  }
707
  }
708
  $prodImages = implode( "#|#", $prodImages );
709
  $URL = $product->getProductUrl();
 
 
710
  if( !empty( $URL ) )
711
  $URL = $this->correctProdUrlStr( $URL );
712
  $attributes = $product->getAttributes();
713
  $Manufacturer = "";
714
  $ProductAttributes = "";
715
- foreach ($attributes as $attribute) {
 
 
 
 
 
 
716
  if( $attribute->getAttributeCode()=="manufacturer" ){
717
- $Manufacturer = $attribute->getFrontend()->getValue( $product );
718
- if( $Manufacturer == NULL || $Manufacturer == "No" || $Manufacturer == "Other" )
 
719
  $Manufacturer = "";
720
  continue;
721
  }
722
- if ($attribute->getIsVisibleOnFront() ){
 
723
  $value = $attribute->getFrontend()->getValue( $product );
724
- if( is_string($value) && strlen( $value ) ){
 
 
 
 
 
725
  if( !empty( $ProductAttributes ) )
726
  $ProductAttributes .= "|";
727
  $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value;
@@ -949,7 +1043,13 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
949
  if( $count > 0 ){
950
  if($this->ignoretopcategory){
951
  foreach( $categories as $topcategory ){
952
- $children = $topcategory->getChildrenCategories();
 
 
 
 
 
 
953
  foreach ( $children as $category ){
954
  $name = $category->getName();
955
  $id = $category->getId();
@@ -974,7 +1074,13 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
974
 
975
  private function _drawCategory( &$category, $level=0, $hpath='', $i=1, $j=1, $path='' ){
976
  $html = "";
977
- $children = $category->getChildrenCategories();
 
 
 
 
 
 
978
  $id = $category->getId();
979
  $sec_path = "";
980
  if( $level != 1 ){
@@ -1016,7 +1122,13 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
1016
  $hpath = "";
1017
  if($this->ignoretopcategory){
1018
  foreach( $categories as $topcategory ){
1019
- $children = $topcategory->getChildrenCategories();
 
 
 
 
 
 
1020
  foreach ( $children as $category ){
1021
  $this->catmap[ $category->getId() ] = $category;
1022
  $this->_processCategory( $category, 1, $hpath );
@@ -1030,7 +1142,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
1030
  }
1031
  }
1032
  $this->unCatPosition = 1;
1033
- echo "proj_Key\tproj_ProdName\tproj_Sequence\tproj_Name\tproj_HierarchyPath\tproj_Flag\tproj_ProdLayout
1034
  ";
1035
  $products = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->getCollection();
1036
  $products->addAttributeToFilter('status', 1);//enabled
@@ -1069,7 +1181,13 @@ Products: ".count( $prodIds )."
1069
  $this->catpathmap[ $category->getId() ] = $hpath;
1070
  if($this->_DEBUG) echo "Category: ".$category->getId()." path=".$hpath."
1071
  ";
1072
- $children = $category->getChildrenCategories();
 
 
 
 
 
 
1073
  $htmlChildren = "";
1074
  if( count( $children ) ) foreach ( $children as $childcategory ){
1075
  $this->catmap[ $childcategory->getId() ] = $childcategory;
@@ -1170,4 +1288,4 @@ Products: ".count( $prodIds )."
1170
  unset( $UsedProductIds );
1171
  return $ProducttoString;
1172
  }
1173
- } // Mage_CodiScript_Model_Files
1
  <?php
2
+ // 2014-02-24
3
  class ConfiguredProductLine{
4
  public $optionIds = array();
5
  public $line = NULL;
25
  public $includespecialpricedateto = FALSE;
26
  public $ignoreexcludedimages = FALSE;
27
  public $ignoreassprodimages = FALSE;
28
+ public $includecustomfields = FALSE;
29
  public $start = 0;
30
  public $pageSize = 1000000000;
31
  public $address = FALSE;
142
  $attributes = $product->getAttributes();
143
  $Manufacturer = "";
144
  $ProductAttributes = "";
145
+ foreach( $attributes as $attribute ){
146
+ $attribute->setStoreId( $this->StoreId );
147
+ if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
148
+ $hasData = $product->getData($attribute->getAttributeCode()) ? TRUE : FALSE;
149
+ echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData."
150
+ ";
151
+ }
152
  if( $attribute->getAttributeCode()=="manufacturer" ){
153
+ if( $product->getData( $attribute->getAttributeCode() ) )
154
+ $Manufacturer = $attribute->getFrontend()->getValue( $product );
155
+ else
156
  $Manufacturer = "";
157
  continue;
158
  }
159
+ if( $attribute->getIsVisibleOnFront() ||
160
+ ( $this->includecustomfields && array_key_exists ( strtolower( $attribute->getAttributeCode() ), $this->includecustomfields ) ) ){
161
  $value = $attribute->getFrontend()->getValue( $product );
162
+ if( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ){
163
+ $hasData = $product->getData( $attribute->getAttributeCode() ) ? TRUE : FALSE;
164
+ if( !$hasData )
165
+ $value = "";
166
+ }
167
  if( is_string( $value ) && strlen( $value ) ){
168
  if( !empty( $ProductAttributes ) )
169
  $ProductAttributes .= "|";
178
  }
179
  if( !empty( $ProductAttributes ) )
180
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
181
+ // echo "product image: ".$product->getImage()."
182
+ //small image: ".$product->getSmallImage()."
183
+ //thumbnail: ".$product->getThumbnail()."
184
  //";
185
  $prodImages = array();
186
+ $firstImageFile = trim( $product->getImage() );
187
+ if( $firstImageFile == "no_selection" )
188
+ $firstImageFile = FALSE;
189
+ if( $firstImageFile )
190
+ $prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
191
  $prodImageArray = $product->getMediaGallery('images');
192
  if( is_array($prodImageArray) ){
193
  foreach( $prodImageArray as $image ){
194
+ $imageFile = trim( $image['file'] );
195
+ // echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
196
  //";
197
+ if( !$imageFile || $imageFile == $firstImageFile )
198
+ continue;
199
  if( $this->ignoreexcludedimages && $image['disabled'] )
200
  continue;
201
+ $prodImages[] = "Print#=#".$this->prodmediaurl.$imageFile;
202
  }
203
  }
204
  $prodImages = implode( "#|#", $prodImages );
284
  ";
285
  if($this->ignoreassprodimages) $itemImages = "";
286
  else{
287
+ // echo "grouped item image: ".$UsedProduct->getImage()."
288
+ //small image: ".$UsedProduct->getSmallImage()."
289
+ //thumbnail: ".$UsedProduct->getThumbnail()."
290
+ //";
291
  $itemImages = array();
292
+ $firstImageFile = trim( $UsedProduct->getImage() );
293
+ if( $firstImageFile == "no_selection" )
294
+ $firstImageFile = FALSE;
295
+ if( $firstImageFile )
296
+ $itemImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
297
  $itemImageArray = $UsedProduct->getMediaGallery('images');
298
  if( is_array($itemImageArray) ){
299
  foreach( $itemImageArray as $image ){
300
+ $imageFile = trim( $image['file'] );
301
+ // echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
302
  //";
303
+ if( !$imageFile || $imageFile == $firstImageFile )
304
+ continue;
305
  if( $this->ignoreexcludedimages && $image['disabled'] )
306
  continue;
307
+ $itemImages[] = "Print#=#".$this->prodmediaurl.$imageFile;
308
  }
309
  }
310
  $itemImages = implode( "#|#", $itemImages );
311
  }
312
  $attributes = $UsedProduct->getAttributes();
313
  $ItemAttributes = "";
314
+ foreach( $attributes as $attribute ){
315
+ $attribute->setStoreId( $this->StoreId );
316
+ if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
317
+ $hasData = $UsedProduct->getData($attribute->getAttributeCode()) ? "YES" : "NO";
318
+ echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $UsedProduct )." input=".$attribute->getFrontendInput()." data=".$UsedProduct->getData($attribute->getAttributeCode())." hasData=".$hasData."
319
+ ";
320
+ }
321
  if($attribute->getAttributeCode()=="manufacturer"){
322
+ if( $UsedProduct->getData( $attribute->getAttributeCode() ) )
323
+ $Manufacturer = $attribute->getFrontend()->getValue( $UsedProduct );
 
 
324
  continue;
325
  }
326
+ if( $attribute->getIsVisibleOnFront() ||
327
+ ( $this->includecustomfields && array_key_exists ( strtolower( $attribute->getAttributeCode() ), $this->includecustomfields ) ) ){
328
  $value = $attribute->getFrontend()->getValue( $UsedProduct );
329
+ if( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ){
330
+ $hasData = $UsedProduct->getData( $attribute->getAttributeCode() ) ? TRUE : FALSE;
331
+ if( !$hasData )
332
+ $value = "";
333
+ }
334
  if( is_string( $value ) && strlen( $value ) )
335
  $ItemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|";
336
  }
337
  }
338
+ $ItemAttributes = substr( $ItemAttributes, 0, strlen($ItemAttributes)-1 );
339
  if( $this->includeinvqty ){
340
  if( !empty( $ItemAttributes ) )
341
  $ItemAttributes .= "|";
431
  $attributes = $product->getAttributes();
432
  $Manufacturer = "";
433
  $ProductAttributes = "";
434
+ foreach( $attributes as $attribute ){
435
+ $attribute->setStoreId( $this->StoreId );
436
  if( $attribute->getAttributeCode()=="manufacturer" ){
437
+ if( $product->getData( $attribute->getAttributeCode() ) )
438
+ $Manufacturer = $attribute->getFrontend()->getValue( $product );
439
+ else
440
  $Manufacturer = "";
441
  continue;
442
  }
443
+ if( $attribute->getIsVisibleOnFront() ||
444
+ ( $this->includecustomfields && array_key_exists ( strtolower( $attribute->getAttributeCode() ), $this->includecustomfields ) ) ){
445
+ $value = $attribute->getFrontend()->getValue( $product );
446
+ if( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ){
447
+ $hasData = $product->getData( $attribute->getAttributeCode() ) ? TRUE : FALSE;
448
+ if( !$hasData )
449
+ $value = "";
450
+ }
451
+ if( is_string( $value ) && strlen( $value ) ){
452
  if( !empty( $ProductAttributes ) )
453
  $ProductAttributes .= "|";
454
  $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value;
462
  }
463
  if( !empty( $ProductAttributes ) )
464
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
465
+ // echo "product image: ".$product->getImage()."
466
+ //small image: ".$product->getSmallImage()."
467
+ //thumbnail: ".$product->getThumbnail()."
468
  //";
469
  $prodImages = array();
470
+ $firstImageFile = trim( $product->getImage() );
471
+ if( $firstImageFile == "no_selection" )
472
+ $firstImageFile = FALSE;
473
+ if( $firstImageFile )
474
+ $prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
475
  $prodImageArray = $product->getMediaGallery('images');
476
  if( is_array($prodImageArray) ){
477
  foreach( $prodImageArray as $image ){
478
+ $imageFile = trim( $image['file'] );
479
+ // echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
480
  //";
481
+ if( !$imageFile || $imageFile == $firstImageFile )
482
+ continue;
483
  if( $this->ignoreexcludedimages && $image['disabled'] )
484
  continue;
485
+ $prodImages[] = "Print#=#".$this->prodmediaurl.$imageFile;
486
  }
487
  }
488
  $prodImages = implode( "#|#", $prodImages );
541
  $attributes = $UsedProduct->getAttributes();
542
  $ItemAttributes = "";
543
  foreach( $ConfigurableAttributes as $attribute ){
544
+ $attribute->setStoreId( $this->StoreId );
545
  $configurableProdAttribute = $attribute->getProductAttribute();
546
  if( empty( $configurableProdAttribute ) ){
547
  $label = $attribute->getLabel();
561
  break;
562
  }
563
  }
564
+ if($this->_DEBUG) echo "config attr code=".$AttributeCode." label=".$AttributeLabel." id=".$AttribId." value=".$AttributeValue."
565
+ ";
566
  if( !empty( $ItemAttributes ) )
567
  $ItemAttributes .= "|";
568
  $ItemAttributes .= $AttributeLabel."=".$AttributeValue;
623
  $ItemAttributes .= "Special Price To Date=".substr( $SToDate, 0, 10 );
624
  }
625
  }
 
 
 
 
626
  if($this->ignoreassprodimages) $itemImages = "";
627
  else{
628
+ // echo "config item image: ".$UsedProduct->getImage()."
629
+ //small image: ".$UsedProduct->getSmallImage()."
630
+ //thumbnail: ".$UsedProduct->getThumbnail()."
631
+ //";
632
  $itemImages = array();
633
+ $firstImageFile = trim( $UsedProduct->getImage() );
634
+ if( $firstImageFile == "no_selection" )
635
+ $firstImageFile = FALSE;
636
+ if( $firstImageFile )
637
+ $itemImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
638
  $itemImageArray = $UsedProduct->getMediaGallery('images');
639
  if( is_array($itemImageArray) ){
640
  foreach( $itemImageArray as $image ){
641
+ $imageFile = trim( $image['file'] );
642
+ // echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
643
  //";
644
+ if( !$imageFile || $imageFile == $firstImageFile )
645
+ continue;
646
  if( $this->ignoreexcludedimages && $image['disabled'] )
647
  continue;
648
+ $itemImages[] = "Print#=#".$this->prodmediaurl.$imageFile;
649
  }
650
  }
651
  $itemImages = implode( "#|#", $itemImages );
683
  $optionIds[] = $optionIdLine;
684
  $attrNumberNo++;
685
  }
686
+ // if( $this->_DEBUG ) foreach( $optionIds as $key => $optionIdLine ) echo "optionIds[".$key."]: ".var_export( $optionIdLine, true )."
687
+ //";
688
  $optNumbers = array();
689
  $attrNumber = 0;
690
  while( $attrNumber < $attrNumberNo ){
711
  $attrNo++;
712
  }
713
  if( $matching ){
714
+ // if( $this->_DEBUG ) echo "option ids: ".var_export( $cpLine->optionIds, true )."
715
+ //";
716
  $ProducttoString .= $cpLine->line
717
  ."\t". $sequence
718
  ."\n";
761
  $ProductDescription .= $longDescription;
762
  }
763
  }
 
 
 
 
764
  $prodImages = array();
765
+ // echo "product image: ".$product->getImage()."
766
+ //small image: ".$product->getSmallImage()."
767
+ //thumbnail: ".$product->getThumbnail()."
768
+ //";
769
+ $firstImageFile = trim( $product->getImage() );
770
+ if( $firstImageFile == "no_selection" )
771
+ $firstImageFile = FALSE;
772
+ if( $firstImageFile )
773
+ $prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
774
  $prodImageArray = $product->getMediaGallery('images');
775
  if( is_array($prodImageArray) ){
776
  foreach( $prodImageArray as $image ){
777
+ $imageFile = trim( $image['file'] );
778
+ // echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
779
  //";
780
+ if( !$imageFile || $imageFile == $firstImageFile )
781
+ continue;
782
  if( $this->ignoreexcludedimages && $image['disabled'] )
783
  continue;
784
+ $prodImages[] = "Print#=#".$this->prodmediaurl.$imageFile;
785
  }
786
  }
787
  $prodImages = implode( "#|#", $prodImages );
788
  $URL = $product->getProductUrl();
789
+ if( $this->_DEBUG ) echo "URL= ".$URL."
790
+ ";
791
  if( !empty( $URL ) )
792
  $URL = $this->correctProdUrlStr( $URL );
793
  $attributes = $product->getAttributes();
794
  $Manufacturer = "";
795
  $ProductAttributes = "";
796
+ foreach( $attributes as $attribute ){
797
+ $attribute->setStoreId( $this->StoreId );
798
+ if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
799
+ $hasData = $product->getData($attribute->getAttributeCode()) ? "YES" : "NO";
800
+ echo "simple prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData." store=".$product->_storeId."
801
+ ";
802
+ }
803
  if( $attribute->getAttributeCode()=="manufacturer" ){
804
+ if( $product->getData( $attribute->getAttributeCode() ) )
805
+ $Manufacturer = $attribute->getFrontend()->getValue( $product );
806
+ else
807
  $Manufacturer = "";
808
  continue;
809
  }
810
+ if( $attribute->getIsVisibleOnFront() ||
811
+ ( $this->includecustomfields && array_key_exists ( strtolower( $attribute->getAttributeCode() ), $this->includecustomfields ) ) ){
812
  $value = $attribute->getFrontend()->getValue( $product );
813
+ if( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ){
814
+ $hasData = $product->getData( $attribute->getAttributeCode() ) ? TRUE : FALSE;
815
+ if( !$hasData )
816
+ $value = "";
817
+ }
818
+ if( is_string( $value ) && strlen( $value ) ){
819
  if( !empty( $ProductAttributes ) )
820
  $ProductAttributes .= "|";
821
  $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value;
1043
  if( $count > 0 ){
1044
  if($this->ignoretopcategory){
1045
  foreach( $categories as $topcategory ){
1046
+ $children = $topcategory->getCollection();
1047
+ $children->setStoreId( $this->StoreId )
1048
+ ->addAttributeToSelect('name')
1049
+ ->addAttributeToFilter('is_active', array('eq' => 1))
1050
+ ->addAttributeToSort('position', 'asc')
1051
+ ->addIdFilter($topcategory->getChildren())
1052
+ ->load();
1053
  foreach ( $children as $category ){
1054
  $name = $category->getName();
1055
  $id = $category->getId();
1074
 
1075
  private function _drawCategory( &$category, $level=0, $hpath='', $i=1, $j=1, $path='' ){
1076
  $html = "";
1077
+ $children = $category->getCollection();
1078
+ $children->setStoreId( $this->StoreId )
1079
+ ->addAttributeToSelect('name')
1080
+ ->addAttributeToFilter('is_active', array('eq' => 1))
1081
+ ->addAttributeToSort('position', 'asc')
1082
+ ->addIdFilter($category->getChildren())
1083
+ ->load();
1084
  $id = $category->getId();
1085
  $sec_path = "";
1086
  if( $level != 1 ){
1122
  $hpath = "";
1123
  if($this->ignoretopcategory){
1124
  foreach( $categories as $topcategory ){
1125
+ $children = $topcategory->getCollection();
1126
+ $children->setStoreId( $this->StoreId )
1127
+ ->addAttributeToSelect('name')
1128
+ ->addAttributeToFilter('is_active', array('eq' => 1))
1129
+ ->addAttributeToSort('position', 'asc')
1130
+ ->addIdFilter($topcategory->getChildren())
1131
+ ->load();
1132
  foreach ( $children as $category ){
1133
  $this->catmap[ $category->getId() ] = $category;
1134
  $this->_processCategory( $category, 1, $hpath );
1142
  }
1143
  }
1144
  $this->unCatPosition = 1;
1145
+ if( $this->start == 0 ) echo "proj_Key\tproj_ProdName\tproj_Sequence\tproj_Name\tproj_HierarchyPath\tproj_Flag\tproj_ProdLayout
1146
  ";
1147
  $products = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->getCollection();
1148
  $products->addAttributeToFilter('status', 1);//enabled
1181
  $this->catpathmap[ $category->getId() ] = $hpath;
1182
  if($this->_DEBUG) echo "Category: ".$category->getId()." path=".$hpath."
1183
  ";
1184
+ $children = $category->getCollection();
1185
+ $children->setStoreId( $this->StoreId )
1186
+ ->addAttributeToSelect('name')
1187
+ ->addAttributeToFilter('is_active', array('eq' => 1))
1188
+ ->addAttributeToSort('position', 'asc')
1189
+ ->addIdFilter($category->getChildren())
1190
+ ->load();
1191
  $htmlChildren = "";
1192
  if( count( $children ) ) foreach ( $children as $childcategory ){
1193
  $this->catmap[ $childcategory->getId() ] = $childcategory;
1288
  unset( $UsedProductIds );
1289
  return $ProducttoString;
1290
  }
1291
+ } // Mage_CodiScript_Model_Files
app/code/community/Mage/CodiScript/controllers/IndexController.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define("__VERSION__","2014-01-18");
3
  define("__SCRIPTNAME__",basename(__FILE__));
4
 
5
  class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
@@ -65,6 +65,18 @@ if( $Class=="DataFile" ){
65
  $includespecialpricedateto = ( isset($_REQUEST["includespecialpricedateto"]) && $_REQUEST["includespecialpricedateto"] == "1" );
66
  $ignoreexcludedimages = ( isset($_REQUEST["ignoreexcludedimages"]) && $_REQUEST["ignoreexcludedimages"] == "1" );
67
  $ignoreassprodimages = ( isset($_REQUEST["ignoreassprodimages"]) && $_REQUEST["ignoreassprodimages"] == "1" );
 
 
 
 
 
 
 
 
 
 
 
 
68
  $start = isset($_REQUEST["start"]) ? intval( $_REQUEST["start"] ) : 0;
69
  $pageSize = isset($_REQUEST["pageSize"]) ? intval( $_REQUEST["pageSize"] ) : 1000000000;
70
  if($_DEBUG) echo "enablereviews=".$enablereviews."
@@ -83,6 +95,7 @@ includespecialpricedatefrom=".$includespecialpricedatefrom."
83
  includespecialpricedateto=".$includespecialpricedateto."
84
  ignoreexcludedimages=".$ignoreexcludedimages."
85
  ignoreassprodimages=".$ignoreassprodimages."
 
86
  start=".$start."
87
  pageSize=".$pageSize."
88
  ";
@@ -161,6 +174,7 @@ if($Class=="DataFile"){
161
  $cfModel->includespecialpricedateto = $includespecialpricedateto;
162
  $cfModel->ignoreexcludedimages = $ignoreexcludedimages;
163
  $cfModel->ignoreassprodimages = $ignoreassprodimages;
 
164
  $cfModel->start = $start;
165
  $cfModel->pageSize = $pageSize;
166
  if($cfModel->includetaxes)
@@ -205,7 +219,15 @@ executed in ".( time() - $started_time )." sec.
205
  ";
206
  die();
207
  /* RELEASE NOTES
208
- * 2014-01-18
 
 
 
 
 
 
 
 
209
  * 1. Configurable products - pricing updates / fixes
210
  * 2. Configurable products - items ordering updates
211
  * 3. Bundled products -pricing updates
1
  <?php
2
+ define("__VERSION__","2014-02-24");
3
  define("__SCRIPTNAME__",basename(__FILE__));
4
 
5
  class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
65
  $includespecialpricedateto = ( isset($_REQUEST["includespecialpricedateto"]) && $_REQUEST["includespecialpricedateto"] == "1" );
66
  $ignoreexcludedimages = ( isset($_REQUEST["ignoreexcludedimages"]) && $_REQUEST["ignoreexcludedimages"] == "1" );
67
  $ignoreassprodimages = ( isset($_REQUEST["ignoreassprodimages"]) && $_REQUEST["ignoreassprodimages"] == "1" );
68
+ $includecustomfields = isset($_REQUEST["includecustomfields"])? trim( $_REQUEST["includecustomfields"] ) : FALSE;
69
+ if( empty ( $includecustomfields ) )
70
+ $includecustomfields = FALSE;
71
+ else{
72
+ $arr = explode( ",", $includecustomfields );
73
+ $includecustomfields = array();
74
+ foreach( $arr as $part ){
75
+ $part = trim( $part );
76
+ if( !empty( $part ) )
77
+ $includecustomfields[ strtolower( $part ) ] = TRUE;
78
+ }
79
+ }
80
  $start = isset($_REQUEST["start"]) ? intval( $_REQUEST["start"] ) : 0;
81
  $pageSize = isset($_REQUEST["pageSize"]) ? intval( $_REQUEST["pageSize"] ) : 1000000000;
82
  if($_DEBUG) echo "enablereviews=".$enablereviews."
95
  includespecialpricedateto=".$includespecialpricedateto."
96
  ignoreexcludedimages=".$ignoreexcludedimages."
97
  ignoreassprodimages=".$ignoreassprodimages."
98
+ includecustomfields=".( $includecustomfields ? implode( ",", array_keys( $includecustomfields ) ) : $includecustomfields )."
99
  start=".$start."
100
  pageSize=".$pageSize."
101
  ";
174
  $cfModel->includespecialpricedateto = $includespecialpricedateto;
175
  $cfModel->ignoreexcludedimages = $ignoreexcludedimages;
176
  $cfModel->ignoreassprodimages = $ignoreassprodimages;
177
+ $cfModel->includecustomfields = $includecustomfields;
178
  $cfModel->start = $start;
179
  $cfModel->pageSize = $pageSize;
180
  if($cfModel->includetaxes)
219
  ";
220
  die();
221
  /* RELEASE NOTES
222
+ * 2014-02-24
223
+ * 1. includecustomfields parameter added / implemented
224
+ * 2. Improved langiage-specific section rendering
225
+ *
226
+ * 2014-02-04
227
+ * 1. "MagentoBase" role introduced for base product images.
228
+ * 2. Improved product attributes import: excluded attributes of "select" / "muitiselect" type having no selection
229
+ *
230
+ * * 2014-01-18
231
  * 1. Configurable products - pricing updates / fixes
232
  * 2. Configurable products - items ordering updates
233
  * 3. Bundled products -pricing updates
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Codi</name>
4
- <version>4.1.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,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>2014-01-29</date>
14
- <time>19:48:50</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="d426cc8ef54c890095b58376f3c4759c"/></dir><dir name="controllers"><file name="IndexController.php" hash="36af92c24a1c847b1274ea3358107efc"/></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.1.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
  <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>2014-03-05</date>
14
+ <time>14:25:50</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="e22db128865afdd26374f3637070524e"/></dir><dir name="controllers"><file name="IndexController.php" hash="c8fce8ae02e6dc7e85fce1530e8d8362"/></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>