Mage_Codi - Version 4.1.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.1.1
Comparing to
See all releases


Code changes from version 4.1.0 to 4.1.1

app/code/community/Mage/CodiScript/Model/Files.php CHANGED
@@ -1,11 +1,15 @@
1
  <?php
2
- // 2014-01-16
 
 
 
 
3
  class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
4
- public $version = VERSION;
5
  public $Store;
6
  public $StoreId;
7
  public $reviewsModel;
8
- public $cataloginventoryModel;
9
  public $productTypeGroupedModel;
10
  public $productTypeConfigurableModel;
11
  public $enablereviews = FALSE;
@@ -36,12 +40,12 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
36
  public $_DEBUG;
37
  const TAG_P_CLOSE = '</p>';
38
  const TAG_P = '<p>';
39
- const SCRIPTNAME = 'cod_exporter_for_magento.php';
40
 
41
  public function _construct() {
42
  parent::_construct();
43
- $this->_init('codi/codi2');
44
- Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
45
  }
46
 
47
  // Class=DataFile
@@ -55,7 +59,7 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
55
  $this->productTypeConfigurableModel = Mage::getModel('catalog/product_type_configurable');
56
  $this->productTypeGroupedModel = Mage::getModel('catalog/product_type_grouped');
57
  $this->reviewsModel = Mage::getModel('review/review')->setStoreId( $this->StoreId );
58
- $this->cataloginventoryModel = Mage::getModel('cataloginventory/stock_item')->setStoreId( $this->StoreId );
59
  $this->mediaurl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_MEDIA );
60
  $this->prodmediaurl = $this->mediaurl."catalog/product";
61
  $products = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->getCollection();
@@ -85,6 +89,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
85
  }
86
  $index++;
87
  $product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
 
 
88
  if( $product->isConfigurable() )
89
  echo $this->ProducttoStringConfigurable( $product );
90
  else if( $product->isGrouped() )
@@ -158,16 +164,16 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
158
  }
159
  if( !empty( $ProductAttributes ) )
160
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
161
- if($this->_DEBUG) echo "product image : ".$product->getImage()."
162
- product small image: ".$product->getSmallImage()."
163
- product thumbnail : ".$product->getThumbnail()."
164
- ";
165
  $prodImages = array();
166
  $prodImageArray = $product->getMediaGallery('images');
167
  if( is_array($prodImageArray) ){
168
  foreach( $prodImageArray as $image ){
169
- if($this->_DEBUG) echo "gallery image ".$image['file']." disabled=".$image['disabled']."
170
- ";
171
  if( $this->ignoreexcludedimages && $image['disabled'] )
172
  continue;
173
  $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
@@ -182,37 +188,86 @@ product thumbnail : ".$product->getThumbnail()."
182
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
183
  if( !empty( $Reviews ) )
184
  $Reviews = $this->cleanStr( $Reviews );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  $sequence = 1;
 
186
  foreach($AssociatedProductIds as $UsedProductid){
187
  $UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  $ItemName= $UsedProduct->getName();
189
  if( $this->getpricefromchild ) {
190
- $Price = $UsedProduct->getFinalPrice();
191
- if( !empty( $Price ) && $this->includetaxes )
192
- $Price = $this->taxhelper->getPrice( $UsedProduct, $Price, true );
193
- $sPrice = $UsedProduct->getSpecialPrice();
194
- if( !empty( $sPrice ) && $this->includetaxes )
195
- $sPrice = $this->taxhelper->getPrice( $UsedProduct, $sPrice, true );
196
- $sFromDate = $UsedProduct->getSpecialFromDate();
197
- $sToDate = $UsedProduct->getSpecialToDate();
198
- } else {
199
- $Price = $product->getFinalPrice();
200
- if( !empty( $Price ) && $this->includetaxes )
201
- $Price = $this->taxhelper->getPrice( $product, $Price, true );
202
- $sPrice = $product->getSpecialPrice();
203
- if( !empty( $sPrice ) && $this->includetaxes )
204
- $sPrice = $this->taxhelper->getPrice( $product, $sPrice, true );
205
- $sFromDate = $product->getSpecialFromDate();
206
- $sToDate = $product->getSpecialToDate();
 
 
 
 
 
 
 
 
 
207
  }
 
 
208
  if($this->ignoreassprodimages) $itemImages = "";
209
  else{
210
  $itemImages = array();
211
  $itemImageArray = $UsedProduct->getMediaGallery('images');
212
  if( is_array($itemImageArray) ){
213
  foreach( $itemImageArray as $image ){
214
- if($this->_DEBUG) echo "gallery image ".$image['file']." disabled=".$image['disabled']."
215
- ";
216
  if( $this->ignoreexcludedimages && $image['disabled'] )
217
  continue;
218
  $itemImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
@@ -240,60 +295,64 @@ product thumbnail : ".$product->getThumbnail()."
240
  if( $this->includeinvqty ){
241
  if( !empty( $ItemAttributes ) )
242
  $ItemAttributes .= "|";
243
- $ItemAttributes .= "Inventory=".$this->improveQty( "".$this->cataloginventoryModel->loadByProduct( $UsedProduct )->getQty() );
244
  }
245
- $Price = $this->improvePrice( $Price );
246
  if( $this->includespecialprice ){
247
- if( !empty( $sPrice ) ){
248
- $sPrice = $this->improvePrice( $sPrice );
249
  if( !empty( $ItemAttributes ) )
250
  $ItemAttributes .= "|";
251
- $ItemAttributes .= "Special Price=".$sPrice;
 
 
 
 
252
  }
253
  }
254
  if( $this->includespecialpricedatefrom ){
255
- if( !empty( $sFromDate ) ){
256
  if( !empty( $ItemAttributes ) )
257
  $ItemAttributes .= "|";
258
- $ItemAttributes .= "Special Price From Date=".substr( $sFromDate, 0, 10 );
259
  }
260
  }
261
  if( $this->includespecialpricedateto ){
262
- if( !empty( $sToDate ) ){
263
  if( !empty( $ItemAttributes ) )
264
  $ItemAttributes .= "|";
265
- $ItemAttributes .= "Special Price To Date=".substr( $sToDate, 0, 10 );
266
  }
267
  }
268
  $itemID = $UsedProduct->getSku();
269
  $ProducttoString .= $this->cleanStr( $itemID ) //ItemID
270
- . "\t" //ItemQty
271
- . "\t" //ItemUom
272
- . "\t". $Price //ItemPrice
273
- . "\t". $this->cleanStr( $ItemName) //ItemDescription
274
- . "\t" //ItemLink
275
- . "\t". $this->cleanStr( $ItemAttributes ) //ItemAttributes
276
- . "\t". $itemImages //ItemGraphic
277
- . "\t". $productName //ProductName
278
- . "\t". $ProductDescription
279
- . "\t". $prodImages //ProductGraphic
280
- . "\t". $ProductURL //ProductLink
281
- . "\t". $ProductAttributes //ProductAttributes
282
- . "\t". $Manufacturer //Manufacturer
283
- . "\t" //Category
284
- . "\t". $Reviews //Reviews
285
- . "\t". $shortDescription
286
- . "\t". $sequence
287
- . "\n";
288
  unset( $UsedProduct );
289
  $sequence++;
290
  }
 
291
  unset( $AssociatedProductIds );
292
  return $ProducttoString;
293
  }
294
 
295
  private function ProducttoStringConfigurable( &$product ){
296
- $ProducttoString = "";
297
  $UsedProductIds = $this->productTypeConfigurableModel->getUsedProductIds($product);
298
  $ProductDescription = "";
299
  $shortDescription = "";
@@ -351,16 +410,16 @@ product thumbnail : ".$product->getThumbnail()."
351
  }
352
  if( !empty( $ProductAttributes ) )
353
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
354
- if($this->_DEBUG) echo "product image : ".$product->getImage()."
355
- product small image: ".$product->getSmallImage()."
356
- product thumbnail : ".$product->getThumbnail()."
357
- ";
358
  $prodImages = array();
359
  $prodImageArray = $product->getMediaGallery('images');
360
  if( is_array($prodImageArray) ){
361
  foreach( $prodImageArray as $image ){
362
- if($this->_DEBUG) echo "gallery image ".$image['file']." disabled=".$image['disabled']."
363
- ";
364
  if( $this->ignoreexcludedimages && $image['disabled'] )
365
  continue;
366
  $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
@@ -375,34 +434,65 @@ product thumbnail : ".$product->getThumbnail()."
375
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
376
  if( !empty( $Reviews ) )
377
  $Reviews = $this->cleanStr( $Reviews );
378
- $sequence = 1;
379
- foreach($UsedProductIds as $UsedProductid){
380
- $UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
381
- if( $this->getpricefromchild ) {
382
- $Price = $UsedProduct->getFinalPrice();
383
- $sPrice = $UsedProduct->getSpecialPrice();
384
- $sFromDate = $UsedProduct->getSpecialFromDate();
385
- $sToDate = $UsedProduct->getSpecialToDate();
386
- } else {
387
- $Price = $product->getFinalPrice();
388
- $sPrice = $product->getSpecialPrice();
389
- $sFromDate = $product->getSpecialFromDate();
390
- $sToDate = $product->getSpecialToDate();
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  $attributes = $UsedProduct->getAttributes();
393
  $ItemAttributes = "";
394
- $AllowAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
395
- foreach ($AllowAttributes as $attribute){
396
  $configurableProdAttribute = $attribute->getProductAttribute();
397
  if( empty( $configurableProdAttribute ) ){
398
  $label = $attribute->getLabel();
399
  echo "WARNING: no product attribute for configurable attribute ".$label."
400
  ";
 
401
  continue;
402
  }
403
  $AttributeCode = $configurableProdAttribute->getAttributeCode();
404
  $AttributeLabel = $configurableProdAttribute->getFrontend()->getLabel();
405
  $AttribId = $UsedProduct->getData($AttributeCode);
 
406
  $AttributeValue = "";
407
  foreach ( $configurableProdAttribute->getSource()->getAllOptions() as $option ){
408
  if( $option['value'] == $AttribId ){
@@ -413,69 +503,75 @@ product thumbnail : ".$product->getThumbnail()."
413
  if( !empty( $ItemAttributes ) )
414
  $ItemAttributes .= "|";
415
  $ItemAttributes .= $AttributeLabel."=".$AttributeValue;
416
- foreach( $attribute->getPrices() as $addedPrice ){
417
- if( $AttributeValue == $addedPrice['label']){
418
- if( $addedPrice['is_percent'] ){
419
- $Price += $Price * $addedPrice['pricing_value'] / 100;
420
- $sPrice += $sPrice * $addedPrice['pricing_value'] / 100;
421
- } else {
422
- $Price += $addedPrice['pricing_value'];
423
- $sPrice += $addedPrice['pricing_value'];
 
 
 
 
424
  }
425
  }
426
  }
427
  }
428
  if( $this->getpricefromchild ){
429
- if( !empty($Price) && $this->includetaxes )
430
- $Price = $this->taxhelper->getPrice( $UsedProduct, $Price, true );
431
- if( !empty($sPrice) && $this->includetaxes )
432
- $sPrice = $this->taxhelper->getPrice( $UsedProduct, $sPrice, true );
433
  } else {
434
- if( !empty($Price) && $this->includetaxes )
435
- $Price = $this->taxhelper->getPrice( $product, $Price, true );
436
- if( !empty($sPrice) && $this->includetaxes )
437
- $sPrice = $this->taxhelper->getPrice( $product, $sPrice, true );
438
  }
439
  if( $this->includeinvqty ){
440
  if( !empty( $ItemAttributes ) )
441
  $ItemAttributes .= "|";
442
- $ItemAttributes .= "Inventory=".$this->improveQty( "".$this->cataloginventoryModel->loadByProduct( $UsedProduct )->getQty() );
443
  }
444
- $Price = $this->improvePrice( $Price );
 
 
445
  if( $this->includespecialprice ){
446
- if( !empty( $sPrice ) ){
447
- $sPrice = $this->improvePrice( $sPrice );
448
  if( !empty( $ItemAttributes ) )
449
  $ItemAttributes .= "|";
450
- $ItemAttributes .= "Special Price=".$sPrice;
451
  }
452
  }
453
  if( $this->includespecialpricedatefrom ){
454
- if( !empty( $sFromDate ) ){
455
  if( !empty( $ItemAttributes ) )
456
  $ItemAttributes .= "|";
457
- $ItemAttributes .= "Special Price From Date=".substr( $sFromDate, 0, 10 );
458
  }
459
  }
460
  if( $this->includespecialpricedateto ){
461
- if( !empty( $sToDate ) ){
462
  if( !empty( $ItemAttributes ) )
463
  $ItemAttributes .= "|";
464
- $ItemAttributes .= "Special Price To Date=".substr( $sToDate, 0, 10 );
465
  }
466
  }
467
- if($this->_DEBUG) echo "config item image : ".$UsedProduct->getImage()."
468
- config item small image: ".$UsedProduct->getSmallImage()."
469
- config item thumbnail : ".$UsedProduct->getThumbnail()."
470
- ";
471
  if($this->ignoreassprodimages) $itemImages = "";
472
  else{
473
  $itemImages = array();
474
  $itemImageArray = $UsedProduct->getMediaGallery('images');
475
  if( is_array($itemImageArray) ){
476
  foreach( $itemImageArray as $image ){
477
- if($this->_DEBUG) echo "gallery image ".$image['file']." disabled=".$image['disabled']."
478
- ";
479
  if( $this->ignoreexcludedimages && $image['disabled'] )
480
  continue;
481
  $itemImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
@@ -484,32 +580,85 @@ config item thumbnail : ".$UsedProduct->getThumbnail()."
484
  $itemImages = implode( "#|#", $itemImages );
485
  }
486
  $itemID = $UsedProduct->getSku();
487
- $ProducttoString .= $this->cleanStr( $itemID ) //ItemID
488
- . "\t" //ItemQty
489
- . "\t" //ItemUom
490
- . "\t" . $Price //ItemPrice
491
- . "\t" //ItemDescription
492
- . "\t" //ItemLink
493
- . "\t" . $this->cleanStr( $ItemAttributes ) //ItemAttributes
494
- . "\t" . $itemImages //ItemitemGraphic
495
- . "\t" . $productName //ProductName
496
- . "\t" . $ProductDescription
497
- . "\t" . $prodImages //ProductGraphic
498
- . "\t" . $ProductURL //ProductLink
499
- . "\t" . $ProductAttributes //ProductAttributes
500
- . "\t" . $Manufacturer //Manufacturer
501
- . "\t" //Category
502
- . "\t" . $Reviews //Reviews
503
- . "\t" . $shortDescription
504
- . "\t". $sequence
505
- . "\n";
506
  unset( $UsedProduct );
507
- $sequence++;
508
  }
 
509
  unset( $UsedProductIds );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  return $ProducttoString;
511
  }
512
-
513
  private function ProducttoStringSimple( &$product ){
514
  $ProductDescription = "";
515
  $shortDescription = "";
@@ -541,16 +690,16 @@ config item thumbnail : ".$UsedProduct->getThumbnail()."
541
  $ProductDescription .= $longDescription;
542
  }
543
  }
544
- if($this->_DEBUG) echo "product image : ".$product->getImage()."
545
- product small image: ".$product->getSmallImage()."
546
- product thumbnail : ".$product->getThumbnail()."
547
- ";
548
  $prodImages = array();
549
  $prodImageArray = $product->getMediaGallery('images');
550
  if( is_array($prodImageArray) ){
551
  foreach( $prodImageArray as $image ){
552
- if($this->_DEBUG) echo "gallery image ".$image['file']." disabled=".$image['disabled']."
553
- ";
554
  if( $this->ignoreexcludedimages && $image['disabled'] )
555
  continue;
556
  $prodImages[] = "Print#=#".$this->prodmediaurl.$image['file'];
@@ -586,39 +735,75 @@ product thumbnail : ".$product->getThumbnail()."
586
  }
587
  if( !empty( $ProductAttributes ) )
588
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
589
- $Price = $product->getFinalPrice();
590
- if( !empty( $Price ) && $this->includetaxes )
591
- $Price = $this->taxhelper->getPrice( $product, $Price, true );
592
- $sPrice = $product->getSpecialPrice();
593
- if( !empty( $sPrice ) && $this->includetaxes )
594
- $sPrice = $this->taxhelper->getPrice( $product, $sPrice, true );
595
- $sFromDate = $product->getSpecialFromDate();
596
- $sToDate = $product->getSpecialToDate();
597
- $ItemAttributes = "";
598
- if( $this->includeinvqty ){
599
- $ItemAttributes = "Inventory=".$this->improveQty( "".$this->cataloginventoryModel->loadByProduct( $product )->getQty() );
600
  }
601
- $Price = $this->improvePrice( $Price );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  if( $this->includespecialprice ){
603
- if( !empty( $sPrice ) ){
604
- $sPrice = $this->improvePrice( $sPrice );
605
  if( !empty( $ItemAttributes ) )
606
  $ItemAttributes .= "|";
607
- $ItemAttributes .= "Special Price=".$sPrice;
608
  }
609
  }
610
  if( $this->includespecialpricedatefrom ){
611
- if( !empty( $sFromDate ) ){
612
  if( !empty( $ItemAttributes ) )
613
  $ItemAttributes .= "|";
614
- $ItemAttributes .= "Special Price From Date=".substr( $sFromDate, 0, 10 );
615
  }
616
  }
617
  if( $this->includespecialpricedateto ){
618
- if( !empty( $sToDate ) ){
619
  if( !empty( $ItemAttributes ) )
620
  $ItemAttributes .= "|";
621
- $ItemAttributes .= "Special Price To Date=".substr( $sToDate, 0, 10 );
622
  }
623
  }
624
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
@@ -627,27 +812,47 @@ product thumbnail : ".$product->getThumbnail()."
627
  $prodSku = $product->getSku();
628
  $prodName = $product->getName();
629
  $ProducttoString = $this->cleanStr( $prodSku ) //ItemID
630
- . "\t" //ItemQty
631
- . "\t" //ItemUom
632
- . "\t" . $Price //ItemPrice
633
- . "\t" //ItemDescription
634
- . "\t" //ItemLink
635
- . "\t" . $ItemAttributes //ItemAttributes
636
- . "\t" //ItemitemGraphic
637
- . "\t" . $product->getId().'#$#'.$this->cleanStr( $prodName ) //ProductName
638
- . "\t" . $ProductDescription //ProductDescription
639
- . "\t" . $prodImages //ProductGraphic
640
- . "\t" . $URL //ProductLink
641
- . "\t" . $ProductAttributes //ProductAttributes
642
- . "\t" . $Manufacturer //Manufacturer
643
- . "\t" //Category
644
- . "\t" . $Reviews //Reviews
645
- . "\t" . $shortDescription
646
- . "\t1"
647
- . "\n";
648
  return $ProducttoString;
649
  }
650
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  private function cleanStr( &$str ){
652
  return str_replace("\n"," ", str_replace("\r"," ", str_replace("\r\n"," ", str_replace("\t"," ", $str ) ) ) );
653
  }
@@ -965,4 +1170,4 @@ Products: ".count( $prodIds )."
965
  unset( $UsedProductIds );
966
  return $ProducttoString;
967
  }
968
- } // Mage_CodiScript_Model_Files
1
  <?php
2
+ // 2014-01-18
3
+ class ConfiguredProductLine{
4
+ public $optionIds = array();
5
+ public $line = NULL;
6
+ }
7
  class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
8
+ public $version = __VERSION__;
9
  public $Store;
10
  public $StoreId;
11
  public $reviewsModel;
12
+ public $catalogInventoryModel;
13
  public $productTypeGroupedModel;
14
  public $productTypeConfigurableModel;
15
  public $enablereviews = FALSE;
40
  public $_DEBUG;
41
  const TAG_P_CLOSE = '</p>';
42
  const TAG_P = '<p>';
43
+ const SCRIPTNAME = __SCRIPTNAME__;
44
 
45
  public function _construct() {
46
  parent::_construct();
47
+ $this->_init( 'codi/codi2' );
48
+ Mage::app()->setCurrentStore( Mage_Core_Model_App::ADMIN_STORE_ID );
49
  }
50
 
51
  // Class=DataFile
59
  $this->productTypeConfigurableModel = Mage::getModel('catalog/product_type_configurable');
60
  $this->productTypeGroupedModel = Mage::getModel('catalog/product_type_grouped');
61
  $this->reviewsModel = Mage::getModel('review/review')->setStoreId( $this->StoreId );
62
+ $this->catalogInventoryModel = Mage::getModel('cataloginventory/stock_item')->setStoreId( $this->StoreId );
63
  $this->mediaurl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_MEDIA );
64
  $this->prodmediaurl = $this->mediaurl."catalog/product";
65
  $products = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->getCollection();
89
  }
90
  $index++;
91
  $product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
92
+ if($this->_DEBUG) echo "== PRODUCT: ".$product->getTypeId()." == ".$product->getId()."-".$product->getName()." ==
93
+ ";
94
  if( $product->isConfigurable() )
95
  echo $this->ProducttoStringConfigurable( $product );
96
  else if( $product->isGrouped() )
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'];
188
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
189
  if( !empty( $Reviews ) )
190
  $Reviews = $this->cleanStr( $Reviews );
191
+ $ProdRPrice = $product->getData('price');
192
+ $ProdFPrice = $product->getFinalPrice();
193
+ $ProdSPrice = $product->getSpecialPrice();
194
+ $ProdSFromDate = $product->getSpecialFromDate();
195
+ $ProdSToDate = $product->getSpecialToDate();
196
+ if($this->_DEBUG) echo "prod prices: Regular=".$ProdRPrice." Final=".$ProdFPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
197
+ ";
198
+ if( trim( $ProdSPrice ) == "" ){
199
+ $ProdSPrice = -1;
200
+ $ProdSFromDate = FALSE;
201
+ $ProdSToDate = FALSE;
202
+ }
203
+ if($this->_DEBUG){
204
+ echo "associated IDs: ";
205
+ foreach($AssociatedProductIds as $UsedProductid) echo "".$UsedProductid." ";
206
+ echo "
207
+ ";
208
+ }
209
  $sequence = 1;
210
+ $UsedProducts = array();
211
  foreach($AssociatedProductIds as $UsedProductid){
212
  $UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
213
+ $UsedProducts[] = $UsedProduct;
214
+ }
215
+ $renderSPrice = FALSE;
216
+ if( $this->includespecialprice ){
217
+ foreach($UsedProducts as $UsedProduct){
218
+ $SPrice = $ProdSPrice;
219
+ if( $this->getpricefromchild )
220
+ $SPrice = $UsedProduct->getSpecialPrice();
221
+ if( trim( $SPrice ) != "" ){
222
+ $renderSPrice = TRUE;
223
+ break;
224
+ }
225
+ }
226
+ }
227
+ if( $this->_DEBUG && $this->includespecialprice ) echo "renderSPrice: ".( $renderSPrice ? "TRUE" : "FALSE" )."
228
+ ";
229
+ foreach($UsedProducts as $UsedProduct){
230
+ if($this->_DEBUG) echo "".$UsedProduct->getSku()." prices: Regular=".$UsedProduct->getData('price')." Final=".$UsedProduct->getFinalPrice()." Special=".$UsedProduct->getSpecialPrice()." FromDate=".$UsedProduct->getSpecialFromDate()." ToDate=".$UsedProduct->getSpecialToDate()."
231
+ ";
232
  $ItemName= $UsedProduct->getName();
233
  if( $this->getpricefromchild ) {
234
+ $ProdRPrice = $UsedProduct->getData('price');
235
+ $ProdFPrice = $UsedProduct->getFinalPrice();
236
+ $ProdSPrice = $UsedProduct->getSpecialPrice();
237
+ $ProdSFromDate = $UsedProduct->getSpecialFromDate();
238
+ $ProdSToDate = $UsedProduct->getSpecialToDate();
239
+ if( trim( $ProdSPrice ) == "" ){
240
+ $ProdSPrice = -1;
241
+ $ProdSFromDate = FALSE;
242
+ $ProdSToDate = FALSE;
243
+ }
244
+ }
245
+ $SFromDate = $ProdSFromDate;
246
+ $SToDate = $ProdSToDate;
247
+ $RPrice = $ProdRPrice;
248
+ if( !empty( $RPrice ) && $this->includetaxes ){
249
+ if( $this->getpricefromchild )
250
+ $RPrice = $this->taxhelper->getPrice( $UsedProduct, $RPrice, true );
251
+ else
252
+ $RPrice = $this->taxhelper->getPrice( $product, $RPrice, true );
253
+ }
254
+ $SPrice = $ProdSPrice;
255
+ if( $SPrice >= 0 && $this->includetaxes ){
256
+ if( $this->getpricefromchild )
257
+ $SPrice = $this->taxhelper->getPrice( $UsedProduct, $SPrice, true );
258
+ else
259
+ $SPrice = $this->taxhelper->getPrice( $product, $SPrice, true );
260
  }
261
+ if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
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'];
295
  if( $this->includeinvqty ){
296
  if( !empty( $ItemAttributes ) )
297
  $ItemAttributes .= "|";
298
+ $ItemAttributes .= "Inventory=".$this->improveQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
299
  }
300
+ $RPrice = $this->improvePrice( $RPrice );
301
  if( $this->includespecialprice ){
302
+ if( $SPrice >= 0 ){
303
+ $SPrice = $this->improvePrice( $SPrice );
304
  if( !empty( $ItemAttributes ) )
305
  $ItemAttributes .= "|";
306
+ $ItemAttributes .= "Special Price=".$SPrice;
307
+ } else if( $renderSPrice ){
308
+ if( !empty( $ItemAttributes ) )
309
+ $ItemAttributes .= "|";
310
+ $ItemAttributes .= "Special Price=";
311
  }
312
  }
313
  if( $this->includespecialpricedatefrom ){
314
+ if( !empty( $SFromDate ) ){
315
  if( !empty( $ItemAttributes ) )
316
  $ItemAttributes .= "|";
317
+ $ItemAttributes .= "Special Price From Date=".substr( $SFromDate, 0, 10 );
318
  }
319
  }
320
  if( $this->includespecialpricedateto ){
321
+ if( !empty( $SToDate ) ){
322
  if( !empty( $ItemAttributes ) )
323
  $ItemAttributes .= "|";
324
+ $ItemAttributes .= "Special Price To Date=".substr( $SToDate, 0, 10 );
325
  }
326
  }
327
  $itemID = $UsedProduct->getSku();
328
  $ProducttoString .= $this->cleanStr( $itemID ) //ItemID
329
+ ."\t" //ItemQty
330
+ ."\t" //ItemUom
331
+ ."\t" .$RPrice //ItemPrice
332
+ ."\t" .$this->cleanStr( $ItemName) //ItemDescription
333
+ ."\t" //ItemLink
334
+ ."\t" .$this->cleanStr( $ItemAttributes ) //ItemAttributes
335
+ ."\t" .$itemImages //ItemGraphic
336
+ ."\t" .$productName //ProductName
337
+ ."\t" .$ProductDescription
338
+ ."\t" .$prodImages //ProductGraphic
339
+ ."\t" .$ProductURL //ProductLink
340
+ ."\t" .$ProductAttributes //ProductAttributes
341
+ ."\t" .$Manufacturer //Manufacturer
342
+ ."\t" //Category
343
+ ."\t" .$Reviews //Reviews
344
+ ."\t" .$shortDescription
345
+ ."\t" . $sequence
346
+ ."\n";
347
  unset( $UsedProduct );
348
  $sequence++;
349
  }
350
+ unset( $UsedProducts );
351
  unset( $AssociatedProductIds );
352
  return $ProducttoString;
353
  }
354
 
355
  private function ProducttoStringConfigurable( &$product ){
 
356
  $UsedProductIds = $this->productTypeConfigurableModel->getUsedProductIds($product);
357
  $ProductDescription = "";
358
  $shortDescription = "";
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'];
434
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
435
  if( !empty( $Reviews ) )
436
  $Reviews = $this->cleanStr( $Reviews );
437
+ $ProdRPrice = $product->getData('price');
438
+ $ProdFPrice = $product->getFinalPrice();
439
+ $ProdSPrice = $product->getSpecialPrice();
440
+ $ProdSFromDate = $product->getSpecialFromDate();
441
+ $ProdSToDate = $product->getSpecialToDate();
442
+ if($this->_DEBUG) echo "prod prices: Regular=".$ProdRPrice." Final=".$ProdFPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
443
+ ";
444
+ if( trim( $ProdSPrice ) == "" ){
445
+ $ProdSPrice = -1;
446
+ $ProdSFromDate = FALSE;
447
+ $ProdSToDate = FALSE;
448
+ }
449
+ if($this->_DEBUG){
450
+ echo "used product IDs: ";
451
+ foreach($UsedProductIds as $UsedProductid) echo "".$UsedProductid." ";
452
+ echo "
453
+ ";
454
+ }
455
+ $ConfigurableAttributes = $product->getTypeInstance( true )->getConfigurableAttributes( $product );
456
+ if($this->_DEBUG){
457
+ foreach( $ConfigurableAttributes as $attribute ){
458
+ $configurableProdAttribute = $attribute->getProductAttribute();
459
+ foreach ( $configurableProdAttribute->getSource()->getAllOptions() as $option ){
460
+ echo "variation option: ".var_export( $option, true )."
461
+ ";
462
+ }
463
  }
464
+ }
465
+ $UsedProducts = array();
466
+ foreach( $UsedProductIds as $UsedProductid ){
467
+ $UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
468
+ $UsedProducts[ $UsedProductid ] = $UsedProduct;
469
+ }
470
+ $cpLines = array();
471
+ foreach( $UsedProducts as $UsedProducti => $UsedProduct ){
472
+ $cpLine = new ConfiguredProductLine();
473
+ if($this->_DEBUG) echo "".$UsedProduct->getSku()." prices: Regular=".$UsedProduct->getData('price')." Final=".$UsedProduct->getFinalPrice()." Special=".$UsedProduct->getSpecialPrice()." FromDate=".$UsedProduct->getSpecialFromDate()." ToDate=".$UsedProduct->getSpecialToDate()."
474
+ ";
475
+ $RPrice = $ProdRPrice;
476
+ $SPrice = $ProdSPrice;
477
+ $RPrice0 = $ProdRPrice;
478
+ $SPrice0 = $ProdSPrice;
479
+ $SFromDate = !empty($SPrice) ? $ProdSFromDate : FALSE;
480
+ $SToDate = !empty($SPrice) ? $ProdSToDate : FALSE;
481
  $attributes = $UsedProduct->getAttributes();
482
  $ItemAttributes = "";
483
+ foreach( $ConfigurableAttributes as $attribute ){
 
484
  $configurableProdAttribute = $attribute->getProductAttribute();
485
  if( empty( $configurableProdAttribute ) ){
486
  $label = $attribute->getLabel();
487
  echo "WARNING: no product attribute for configurable attribute ".$label."
488
  ";
489
+ $cpLine->optionIds[] = 0;
490
  continue;
491
  }
492
  $AttributeCode = $configurableProdAttribute->getAttributeCode();
493
  $AttributeLabel = $configurableProdAttribute->getFrontend()->getLabel();
494
  $AttribId = $UsedProduct->getData($AttributeCode);
495
+ $cpLine->optionIds[] = intVal( $AttribId );
496
  $AttributeValue = "";
497
  foreach ( $configurableProdAttribute->getSource()->getAllOptions() as $option ){
498
  if( $option['value'] == $AttribId ){
503
  if( !empty( $ItemAttributes ) )
504
  $ItemAttributes .= "|";
505
  $ItemAttributes .= $AttributeLabel."=".$AttributeValue;
506
+ if( $this->getpricefromchild ) {
507
+ foreach( $attribute->getPrices() as $addedPrice ){
508
+ if( $AttributeValue == $addedPrice['label']){
509
+ if( $addedPrice['is_percent'] ){
510
+ $RPrice += round( $RPrice0 * $addedPrice['pricing_value'] / 100, 2 );
511
+ if( $SPrice >= 0 )
512
+ $SPrice += round( $RPrice0 * $addedPrice['pricing_value'] / 100, 2 );
513
+ } else {
514
+ $RPrice += $addedPrice['pricing_value'];
515
+ if( $SPrice >= 0 )
516
+ $SPrice += $addedPrice['pricing_value'];
517
+ }
518
  }
519
  }
520
  }
521
  }
522
  if( $this->getpricefromchild ){
523
+ if( !empty($RPrice) && $this->includetaxes )
524
+ $RPrice = $this->taxhelper->getPrice( $UsedProduct, $RPrice, true );
525
+ if( !empty($SPrice) && $this->includetaxes )
526
+ $SPrice = $this->taxhelper->getPrice( $UsedProduct, $SPrice, true );
527
  } else {
528
+ if( !empty($RPrice) && $this->includetaxes )
529
+ $RPrice = $this->taxhelper->getPrice( $product, $RPrice, true );
530
+ if( !empty($SPrice) && $this->includetaxes )
531
+ $SPrice = $this->taxhelper->getPrice( $product, $SPrice, true );
532
  }
533
  if( $this->includeinvqty ){
534
  if( !empty( $ItemAttributes ) )
535
  $ItemAttributes .= "|";
536
+ $ItemAttributes .= "Inventory=".$this->improveQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
537
  }
538
+ if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
539
+ ";
540
+ $RPrice = $this->improvePrice( $RPrice );
541
  if( $this->includespecialprice ){
542
+ if( $SPrice >= 0 ){
543
+ $SPrice = $this->improvePrice( $SPrice );
544
  if( !empty( $ItemAttributes ) )
545
  $ItemAttributes .= "|";
546
+ $ItemAttributes .= "Special Price=".$SPrice;
547
  }
548
  }
549
  if( $this->includespecialpricedatefrom ){
550
+ if( !empty( $SFromDate ) ){
551
  if( !empty( $ItemAttributes ) )
552
  $ItemAttributes .= "|";
553
+ $ItemAttributes .= "Special Price From Date=".substr( $SFromDate, 0, 10 );
554
  }
555
  }
556
  if( $this->includespecialpricedateto ){
557
+ if( !empty( $SToDate ) ){
558
  if( !empty( $ItemAttributes ) )
559
  $ItemAttributes .= "|";
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'];
580
  $itemImages = implode( "#|#", $itemImages );
581
  }
582
  $itemID = $UsedProduct->getSku();
583
+ $cpLine->line = $this->cleanStr( $itemID ) //ItemID
584
+ ."\t" //ItemQty
585
+ ."\t" //ItemUom
586
+ ."\t" .$RPrice //ItemPrice
587
+ ."\t" //ItemDescription
588
+ ."\t" //ItemLink
589
+ ."\t" .$this->cleanStr( $ItemAttributes ) //ItemAttributes
590
+ ."\t" .$itemImages //ItemitemGraphic
591
+ ."\t" .$productName //ProductName
592
+ ."\t" .$ProductDescription
593
+ ."\t" .$prodImages //ProductGraphic
594
+ ."\t" .$ProductURL //ProductLink
595
+ ."\t" .$ProductAttributes //ProductAttributes
596
+ ."\t" .$Manufacturer //Manufacturer
597
+ ."\t" //Category
598
+ ."\t" .$Reviews //Reviews
599
+ ."\t" .$shortDescription;
600
+ $cpLines[] = $cpLine;
 
601
  unset( $UsedProduct );
 
602
  }
603
+ unset( $UsedProducts );
604
  unset( $UsedProductIds );
605
+ $optionIds = array();
606
+ $attrNumberNo = 0;
607
+ foreach( $ConfigurableAttributes as $attribute ){
608
+ $configurableProdAttribute = $attribute->getProductAttribute();
609
+ $optionIdLine = array();
610
+ foreach ( $configurableProdAttribute->getSource()->getAllOptions() as $option )
611
+ $optionIdLine[] = trim( $option['value'] ) == "" ? 0 : intVal( $option['value'] );
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 ){
620
+ $optNumbers[] = 0;
621
+ $attrNumber++;
622
+ }
623
+ $optionIds2 = array();
624
+ $attrNumber = 0;
625
+ $this->_fill( $attrNumber, $optNumbers, $optionIds, $optionIds2 );
626
+ // if( $this->_DEBUG ) foreach( $optionIds2 as $optionIdLine ) echo "ordered option ids: ".var_export( $optionIdLine, true )."
627
+ //";
628
+ $ProducttoString = "";
629
+ $sequence = 1;
630
+ foreach( $optionIds2 as $optionIdLine ){
631
+ foreach( $cpLines as $cpLine ){
632
+ $matching = TRUE;
633
+ $attrNo = 0;
634
+ foreach( $optionIdLine as $optionId ){
635
+ $lineOptionId = $cpLine->optionIds[ $attrNo ];
636
+ if( $lineOptionId != $optionId ){
637
+ $matching = FALSE;
638
+ break;
639
+ }
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";
648
+ $cpLine->line = FALSE;
649
+ $sequence++;
650
+ }
651
+ }
652
+ }
653
+ unset( $optionIds2 );
654
+ foreach( $cpLines as $cpLine ){
655
+ if( $cpLine->line ) echo "WARNING: not rendered config line: ".var_export( $cpLine->optionIds, true )."
656
+ ";
657
+ }
658
+ unset( $cpLines );
659
  return $ProducttoString;
660
  }
661
+
662
  private function ProducttoStringSimple( &$product ){
663
  $ProductDescription = "";
664
  $shortDescription = "";
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'];
735
  }
736
  if( !empty( $ProductAttributes ) )
737
  $ProductAttributes = $this->cleanStr( $ProductAttributes );
738
+ $ProdRPrice = $product->getData('price');
739
+ $ProdFPrice = $product->getFinalPrice();
740
+ $ProdSPrice = $product->getSpecialPrice();
741
+ $ProdSFromDate = $product->getSpecialFromDate();
742
+ $ProdSToDate = $product->getSpecialToDate();
743
+ if($this->_DEBUG) echo "prod prices: Regular=".$ProdRPrice." Final=".$ProdFPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
744
+ ";
745
+ if( trim( $ProdSPrice ) == "" ){
746
+ $ProdSPrice = -1;
747
+ $ProdSFromDate = FALSE;
748
+ $ProdSToDate = FALSE;
749
  }
750
+ if( !$ProdRPrice && $product->getTypeId() == "bundle" ){
751
+ $priceModel = $product->getPriceModel();
752
+ $options = Mage::getSingleton('core/layout')->createBlock('bundle/catalog_product_view_type_bundle')->setProduct( $product )->getOptions();
753
+ $ProdRPrice = 0;
754
+ foreach( $options as $option ){
755
+ $selection = $option->getDefaultSelection();
756
+ $MinSelPrice = 0;
757
+ if( $selection ){
758
+ $MinSelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
759
+ } else if( !$selection && $option->_origData["required"] == "1" ){
760
+ foreach( $option->getSelections() as $selection ){
761
+ $SelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
762
+ if( ( $MinSelPrice == 0 && $SelPrice > 0 ) || ( $MinSelPrice > 0 && $SelPrice > 0 && $SelPrice < $MinSelPrice ) )
763
+ $MinSelPrice = $SelPrice;
764
+ }
765
+ }
766
+ if( $MinSelPrice <= 0 )
767
+ continue;
768
+ if( $this->_DEBUG ) echo "added ".$MinSelPrice."
769
+ ";
770
+ $ProdRPrice += $MinSelPrice;
771
+ }
772
+ if( $this->_DEBUG ) echo "Bundle=".$ProdRPrice."
773
+ ";
774
+ }
775
+ $RPrice = $ProdRPrice;
776
+ if( !empty( $RPrice ) && $this->includetaxes )
777
+ $RPrice = $this->taxhelper->getPrice( $product, $RPrice, true );
778
+ $SPrice = $ProdSPrice;
779
+ if( $SPrice >= 0 && $this->includetaxes )
780
+ $SPrice = $this->taxhelper->getPrice( $product, $SPrice, true );
781
+ if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
782
+ ";
783
+ $ItemAttributes = "";
784
+ if( $this->includeinvqty )
785
+ $ItemAttributes = "Inventory=".$this->improveQty( "".$this->catalogInventoryModel->loadByProduct( $product )->getQty() );
786
+ $RPrice = $this->improvePrice( $RPrice );
787
  if( $this->includespecialprice ){
788
+ if( $SPrice >= 0 ){
789
+ $SPrice = $this->improvePrice( $SPrice );
790
  if( !empty( $ItemAttributes ) )
791
  $ItemAttributes .= "|";
792
+ $ItemAttributes .= "Special Price=".$SPrice;
793
  }
794
  }
795
  if( $this->includespecialpricedatefrom ){
796
+ if( !empty( $ProdSFromDate ) ){
797
  if( !empty( $ItemAttributes ) )
798
  $ItemAttributes .= "|";
799
+ $ItemAttributes .= "Special Price From Date=".substr( $ProdSFromDate, 0, 10 );
800
  }
801
  }
802
  if( $this->includespecialpricedateto ){
803
+ if( !empty( $ProdSToDate ) ){
804
  if( !empty( $ItemAttributes ) )
805
  $ItemAttributes .= "|";
806
+ $ItemAttributes .= "Special Price To Date=".substr( $ProdSToDate, 0, 10 );
807
  }
808
  }
809
  $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '';
812
  $prodSku = $product->getSku();
813
  $prodName = $product->getName();
814
  $ProducttoString = $this->cleanStr( $prodSku ) //ItemID
815
+ ."\t" //ItemQty
816
+ ."\t" //ItemUom
817
+ ."\t" .$RPrice //ItemPrice
818
+ ."\t" //ItemDescription
819
+ ."\t" //ItemLink
820
+ ."\t" .$ItemAttributes //ItemAttributes
821
+ ."\t" //ItemitemGraphic
822
+ ."\t" .$product->getId().'#$#'.$this->cleanStr( $prodName ) //ProductName
823
+ ."\t" .$ProductDescription //ProductDescription
824
+ ."\t" .$prodImages //ProductGraphic
825
+ ."\t" .$URL //ProductLink
826
+ ."\t" .$ProductAttributes //ProductAttributes
827
+ ."\t" .$Manufacturer //Manufacturer
828
+ ."\t" //Category
829
+ ."\t" .$Reviews //Reviews
830
+ ."\t" .$shortDescription
831
+ ."\t1"
832
+ ."\n";
833
  return $ProducttoString;
834
  }
835
 
836
+ private function _fill( &$attrNumber, &$optNumbers, &$optionIds, &$optionIds2 ){
837
+ if( $attrNumber < count( $optNumbers ) ){
838
+ $attrNumberNext = $attrNumber + 1;
839
+ $optNumber = 0;
840
+ while( $optNumber < count( $optionIds[ $attrNumber ] ) ){
841
+ $optNumbers[ $attrNumber ] = $optNumber;
842
+ $this->_fill( $attrNumberNext, $optNumbers, $optionIds, $optionIds2 );
843
+ $optNumber++;
844
+ }
845
+ } else { // final
846
+ $attrNo = 0;
847
+ $optionIdLine = array();
848
+ foreach( $optNumbers as $optNumber ){
849
+ $optionIdLine[] = $optionIds[ $attrNo ][ $optNumber ];
850
+ $attrNo++;
851
+ }
852
+ $optionIds2[] = $optionIdLine;
853
+ }
854
+ }
855
+
856
  private function cleanStr( &$str ){
857
  return str_replace("\n"," ", str_replace("\r"," ", str_replace("\r\n"," ", str_replace("\t"," ", $str ) ) ) );
858
  }
1170
  unset( $UsedProductIds );
1171
  return $ProducttoString;
1172
  }
1173
+ } // Mage_CodiScript_Model_Files
app/code/community/Mage/CodiScript/controllers/IndexController.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
- define("VERSION","2014-01-16");
 
3
 
4
  class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
5
  public function indexAction(){
@@ -14,7 +15,7 @@ $gmdate_mod = gmdate('D, d M Y H:i:s', time()).' GMT';
14
  header('Last-Modified: '.$gmdate_mod);
15
  header('Content-Type: text/plain; charset=UTF-8');
16
  header('Content-Disposition: inline; filename="'.$Class.'.txt"');
17
- header('X-CoDSoftware-Version: '.VERSION);
18
  // Enable errors display / list versions
19
  ini_set('display_errors', '1');
20
  ini_set('error_reporting', E_ALL);
@@ -33,7 +34,7 @@ if($_DEBUG || $_INFO){
33
  $started_time = time();
34
  echo "PHP version: ".phpversion()."
35
  Magento version: ".Mage::getVersion()."
36
- Script version: ".VERSION."
37
  --------------------------------------------------------------------------------
38
  ";
39
  }
@@ -204,6 +205,11 @@ executed in ".( time() - $started_time )." sec.
204
  ";
205
  die();
206
  /* RELEASE NOTES
 
 
 
 
 
207
  * 2014-01-16
208
  * 1. Fixed sequencing issue for grouped products
209
  *
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{
6
  public function indexAction(){
15
  header('Last-Modified: '.$gmdate_mod);
16
  header('Content-Type: text/plain; charset=UTF-8');
17
  header('Content-Disposition: inline; filename="'.$Class.'.txt"');
18
+ header('X-CoDSoftware-Version: '.__VERSION__);
19
  // Enable errors display / list versions
20
  ini_set('display_errors', '1');
21
  ini_set('error_reporting', E_ALL);
34
  $started_time = time();
35
  echo "PHP version: ".phpversion()."
36
  Magento version: ".Mage::getVersion()."
37
+ Script version: ".__VERSION__."
38
  --------------------------------------------------------------------------------
39
  ";
40
  }
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
212
+ *
213
  * 2014-01-16
214
  * 1. Fixed sequencing issue for grouped products
215
  *
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_Codi</name>
4
- <version>4.1.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>2014-01-16</date>
14
- <time>23:47:08</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="9c166be2cb8f587516d4ebdaadacec20"/></dir><dir name="controllers"><file name="IndexController.php" hash="36330c372b4778f6726568be15c75751"/></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.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>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>