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.8 |
Comparing to | |
See all releases |
Code changes from version 4.1.7 to 4.1.8
app/code/community/Mage/CodiScript/Model/Files.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
//
|
3 |
class ConfiguredProductLine{
|
4 |
public $optionIds = array();
|
5 |
public $line = NULL;
|
@@ -13,10 +13,12 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
13 |
public $productTypeGroupedModel;
|
14 |
public $productTypeConfigurableModel;
|
15 |
public $customerGroups = FALSE;
|
|
|
16 |
public $enablereviews = FALSE;
|
17 |
public $ignoretopcategory = FALSE;
|
18 |
public $includeshortdescription = FALSE;
|
19 |
public $includelongdescription = TRUE;
|
|
|
20 |
public $getgroupprices = FALSE;
|
21 |
public $publishtieredpricing = FALSE;
|
22 |
public $includetaxes = FALSE;
|
@@ -66,6 +68,10 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
66 |
$this->catalogInventoryModel = Mage::getModel('cataloginventory/stock_item')->setStoreId( $this->StoreId );
|
67 |
$this->mediaurl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_MEDIA );
|
68 |
$this->prodmediaurl = $this->mediaurl."catalog/product";
|
|
|
|
|
|
|
|
|
69 |
if( $this->publishtieredpricing || $this->getgroupprices ){
|
70 |
$this->customerGroups = array();
|
71 |
$customerGroups = Mage::getModel('customer/group')->getCollection();
|
@@ -190,10 +196,10 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
190 |
}
|
191 |
if( !empty( $ProductAttributes ) )
|
192 |
$ProductAttributes = $this->_cleanStr( $ProductAttributes );
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
$prodImages = array();
|
198 |
$firstImageFile = trim( $product->getImage() );
|
199 |
if( $firstImageFile == "no_selection" )
|
@@ -204,8 +210,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
204 |
if( is_array( $prodImageArray ) ){
|
205 |
foreach( $prodImageArray as $image ){
|
206 |
$imageFile = trim( $image['file'] );
|
207 |
-
|
208 |
-
|
209 |
if( !$imageFile || $imageFile == $firstImageFile )
|
210 |
continue;
|
211 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
@@ -262,8 +268,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
262 |
$ProdSFromDate = $UsedProduct->getSpecialFromDate();
|
263 |
$ProdSToDate = $UsedProduct->getSpecialToDate();
|
264 |
$ProdGroupPrices = FALSE;
|
265 |
-
$mageVersionArray
|
266 |
-
if( $mageVersionArray[ 'major' ] > 1 || $mageVersionArray[ 'minor' ] > 6 ){
|
267 |
$ProdGroupPrices = $UsedProduct->getData('group_price');
|
268 |
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
269 |
";
|
@@ -493,10 +498,10 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
493 |
}
|
494 |
if( !empty( $ProductAttributes ) )
|
495 |
$ProductAttributes = $this->_cleanStr( $ProductAttributes );
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
$prodImages = array();
|
501 |
$firstImageFile = trim( $product->getImage() );
|
502 |
if( $firstImageFile == "no_selection" )
|
@@ -507,8 +512,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
507 |
if( is_array($prodImageArray) ){
|
508 |
foreach( $prodImageArray as $image ){
|
509 |
$imageFile = trim( $image['file'] );
|
510 |
-
|
511 |
-
|
512 |
if( !$imageFile || $imageFile == $firstImageFile )
|
513 |
continue;
|
514 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
@@ -525,40 +530,41 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
525 |
$Reviews = $this->enablereviews ? $this->_getReviews($product->getId()) : '';
|
526 |
if( !empty( $Reviews ) )
|
527 |
$Reviews = $this->_cleanStr( $Reviews );
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
|
|
533 |
";
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
539 |
";
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
|
|
|
|
|
|
551 |
}
|
552 |
-
} else {
|
553 |
-
$ProdSpecGroupPrices[] = $groupPrice;
|
554 |
}
|
555 |
}
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
}
|
562 |
if( $this->_DEBUG ){
|
563 |
echo "used product IDs: ";
|
564 |
foreach( $UsedProductIds as $UsedProductid ) echo "".$UsedProductid." ";
|
@@ -629,25 +635,61 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
629 |
if( $qty <= $minQty )
|
630 |
continue;
|
631 |
}
|
632 |
-
if( $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
";
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
}
|
649 |
}
|
650 |
-
$attributes = $UsedProduct->getAttributes();
|
651 |
$ItemAttributes = "";
|
652 |
foreach( $ConfigurableAttributes as $attribute ){
|
653 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
@@ -679,28 +721,30 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
679 |
if( !empty( $ItemAttributes ) )
|
680 |
$ItemAttributes .= "|";
|
681 |
$ItemAttributes .= $AttributeLabel."=".$AttributeValue;
|
682 |
-
|
683 |
-
|
684 |
-
if( $addedPrice['
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
$
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
$SPrice
|
697 |
-
|
698 |
-
|
699 |
-
$
|
700 |
-
|
|
|
|
|
701 |
}
|
702 |
}
|
703 |
-
}
|
704 |
}
|
705 |
if( !empty($RPrice) && $this->includetaxes )
|
706 |
$RPrice = $this->taxhelper->getPrice( $UsedProduct, $RPrice, true );
|
@@ -745,12 +789,19 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
745 |
$ItemAttributes .= "price_".$this->customerGroups[ $groupID ]."=".$this->_formatPrice( $price );
|
746 |
}
|
747 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
if( $this->ignoreassprodimages ) $itemImages = "";
|
749 |
else{
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
$itemImages = array();
|
755 |
$firstImageFile = trim( $UsedProduct->getImage() );
|
756 |
if( $firstImageFile == "no_selection" )
|
@@ -761,8 +812,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
761 |
if( is_array($itemImageArray) ){
|
762 |
foreach( $itemImageArray as $image ){
|
763 |
$imageFile = trim( $image['file'] );
|
764 |
-
|
765 |
-
|
766 |
if( !$imageFile || $imageFile == $firstImageFile )
|
767 |
continue;
|
768 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
@@ -787,27 +838,26 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
787 |
unset( $UsedProducts );
|
788 |
unset( $UsedProductIds );
|
789 |
$optionIds = array();
|
790 |
-
$
|
|
|
|
|
791 |
foreach( $ConfigurableAttributes as $attribute ){
|
792 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
793 |
-
$
|
794 |
-
|
795 |
-
|
796 |
-
$
|
797 |
-
$
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
$optNumbers[] = 0;
|
805 |
$attrNumber++;
|
806 |
}
|
807 |
-
$
|
808 |
-
$attrNumber = 0;
|
809 |
-
$this->_fill( $attrNumber, $optNumbers, $optionIds, $optionIds2 );
|
810 |
-
// if( $this->_DEBUG ) foreach( $optionIds2 as $optionIdLine ) echo "ordered option ids: ".var_export( $optionIdLine, true )."
|
811 |
//";
|
812 |
// supplement prod attrs
|
813 |
if( $this->importoptionsasattributes ){
|
@@ -827,7 +877,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
827 |
}
|
828 |
}
|
829 |
// build prod part
|
830 |
-
$prodLine = "\t" .$productName //ProductName
|
831 |
."\t" .$ProductDescription
|
832 |
."\t" .$prodImages //ProductGraphic
|
833 |
."\t" .$ProductURL //ProductLink
|
@@ -837,39 +887,29 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
837 |
."\t" .$Reviews //Reviews
|
838 |
."\t" .$shortDescription
|
839 |
."\t";
|
840 |
-
|
841 |
-
$
|
842 |
-
foreach( $
|
843 |
-
|
844 |
-
|
845 |
-
$
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
}
|
852 |
-
$attrNo++;
|
853 |
-
}
|
854 |
-
if( $matching ){
|
855 |
-
// if( $this->_DEBUG ) echo "option ids: ".var_export( $cpLine->optionIds, true )."
|
856 |
-
//";
|
857 |
-
$ProducttoString .= $cpLine->line
|
858 |
-
.$prodLine
|
859 |
-
.$sequence
|
860 |
-
."\n";
|
861 |
-
$cpLine->line = FALSE;
|
862 |
-
$sequence++;
|
863 |
-
}
|
864 |
}
|
865 |
}
|
866 |
-
|
|
|
|
|
|
|
867 |
foreach( $cpLines as $cpLine ){
|
868 |
if( $cpLine->line ) echo "WARNING: not rendered config line: ".var_export( $cpLine->optionIds, true )."
|
869 |
";
|
870 |
}
|
871 |
unset( $cpLines );
|
872 |
-
return $
|
873 |
}
|
874 |
|
875 |
private function ProducttoStringSimple( &$product ){
|
@@ -904,10 +944,10 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
904 |
}
|
905 |
}
|
906 |
$prodImages = array();
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
$firstImageFile = trim( $product->getImage() );
|
912 |
if( $firstImageFile == "no_selection" )
|
913 |
$firstImageFile = FALSE;
|
@@ -917,8 +957,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
917 |
if( is_array( $prodImageArray ) ){
|
918 |
foreach( $prodImageArray as $image ){
|
919 |
$imageFile = trim( $image['file'] );
|
920 |
-
|
921 |
-
|
922 |
if( !$imageFile || $imageFile == $firstImageFile )
|
923 |
continue;
|
924 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
@@ -987,8 +1027,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
987 |
if( $this->_DEBUG ) echo "sku=".$product->getSku()." prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
988 |
";
|
989 |
$ProdGroupPrices = FALSE;
|
990 |
-
$mageVersionArray
|
991 |
-
if( $mageVersionArray[ 'major' ] > 1 || $mageVersionArray[ 'minor' ] > 6 ){
|
992 |
$ProdGroupPrices = $product->getData('group_price');
|
993 |
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
994 |
";
|
@@ -1109,23 +1148,44 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
1109 |
return $ProducttoString;
|
1110 |
}
|
1111 |
|
1112 |
-
private
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
$
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
}
|
1130 |
}
|
1131 |
|
@@ -1490,4 +1550,4 @@ Products: ".count( $prodIds )."
|
|
1490 |
unset( $UsedProductIds );
|
1491 |
return $ProducttoString;
|
1492 |
}
|
1493 |
-
} // Mage_CodiScript_Model_Files
|
1 |
<?php
|
2 |
+
// 2015-01-29
|
3 |
class ConfiguredProductLine{
|
4 |
public $optionIds = array();
|
5 |
public $line = NULL;
|
13 |
public $productTypeGroupedModel;
|
14 |
public $productTypeConfigurableModel;
|
15 |
public $customerGroups = FALSE;
|
16 |
+
public $mageVersionArray = FALSE;
|
17 |
public $enablereviews = FALSE;
|
18 |
public $ignoretopcategory = FALSE;
|
19 |
public $includeshortdescription = FALSE;
|
20 |
public $includelongdescription = TRUE;
|
21 |
+
public $getpricefromchild = FALSE;
|
22 |
public $getgroupprices = FALSE;
|
23 |
public $publishtieredpricing = FALSE;
|
24 |
public $includetaxes = FALSE;
|
68 |
$this->catalogInventoryModel = Mage::getModel('cataloginventory/stock_item')->setStoreId( $this->StoreId );
|
69 |
$this->mediaurl = Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_MEDIA );
|
70 |
$this->prodmediaurl = $this->mediaurl."catalog/product";
|
71 |
+
$this->mageVersionArray = Mage::getVersionInfo();
|
72 |
+
if( $this->_DEBUG )
|
73 |
+
echo "mageVersionArray: major ".$this->mageVersionArray[ 'major' ]." minor ".$this->mageVersionArray[ 'minor' ]."
|
74 |
+
";
|
75 |
if( $this->publishtieredpricing || $this->getgroupprices ){
|
76 |
$this->customerGroups = array();
|
77 |
$customerGroups = Mage::getModel('customer/group')->getCollection();
|
196 |
}
|
197 |
if( !empty( $ProductAttributes ) )
|
198 |
$ProductAttributes = $this->_cleanStr( $ProductAttributes );
|
199 |
+
if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
|
200 |
+
small image: ".$product->getSmallImage()."
|
201 |
+
thumbnail: ".$product->getThumbnail()."
|
202 |
+
";
|
203 |
$prodImages = array();
|
204 |
$firstImageFile = trim( $product->getImage() );
|
205 |
if( $firstImageFile == "no_selection" )
|
210 |
if( is_array( $prodImageArray ) ){
|
211 |
foreach( $prodImageArray as $image ){
|
212 |
$imageFile = trim( $image['file'] );
|
213 |
+
if( $this->_DEBUG ) echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
214 |
+
";
|
215 |
if( !$imageFile || $imageFile == $firstImageFile )
|
216 |
continue;
|
217 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
268 |
$ProdSFromDate = $UsedProduct->getSpecialFromDate();
|
269 |
$ProdSToDate = $UsedProduct->getSpecialToDate();
|
270 |
$ProdGroupPrices = FALSE;
|
271 |
+
if( $this->mageVersionArray[ 'major' ] > 1 || $this->mageVersionArray[ 'minor' ] > 6 ){
|
|
|
272 |
$ProdGroupPrices = $UsedProduct->getData('group_price');
|
273 |
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
274 |
";
|
498 |
}
|
499 |
if( !empty( $ProductAttributes ) )
|
500 |
$ProductAttributes = $this->_cleanStr( $ProductAttributes );
|
501 |
+
if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
|
502 |
+
small image: ".$product->getSmallImage()."
|
503 |
+
thumbnail: ".$product->getThumbnail()."
|
504 |
+
";
|
505 |
$prodImages = array();
|
506 |
$firstImageFile = trim( $product->getImage() );
|
507 |
if( $firstImageFile == "no_selection" )
|
512 |
if( is_array($prodImageArray) ){
|
513 |
foreach( $prodImageArray as $image ){
|
514 |
$imageFile = trim( $image['file'] );
|
515 |
+
if( $this->_DEBUG ) echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
516 |
+
";
|
517 |
if( !$imageFile || $imageFile == $firstImageFile )
|
518 |
continue;
|
519 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
530 |
$Reviews = $this->enablereviews ? $this->_getReviews($product->getId()) : '';
|
531 |
if( !empty( $Reviews ) )
|
532 |
$Reviews = $this->_cleanStr( $Reviews );
|
533 |
+
if( ! $this->getpricefromchild ){
|
534 |
+
$ProdRPrice = $product->getData('price');
|
535 |
+
$ProdSPrice = $product->getSpecialPrice();
|
536 |
+
$ProdSFromDate = $product->getSpecialFromDate();
|
537 |
+
$ProdSToDate = $product->getSpecialToDate();
|
538 |
+
if( $this->_DEBUG ) echo "prod prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
539 |
";
|
540 |
+
$ProdGroupPrices = FALSE;
|
541 |
+
if( $this->mageVersionArray[ 'major' ] > 1 || $this->mageVersionArray[ 'minor' ] > 6 ){
|
542 |
+
$ProdGroupPrices = $product->getData('group_price');
|
543 |
+
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
|
|
544 |
";
|
545 |
+
}
|
546 |
+
$ProdSpecGroupPrices = FALSE;
|
547 |
+
if( $ProdGroupPrices ){
|
548 |
+
$ProdSpecGroupPrices = array();
|
549 |
+
foreach( $ProdGroupPrices as $groupPrice ){
|
550 |
+
if( $groupPrice[ 'cust_group' ] == '0' ){
|
551 |
+
$notLoggedInPrice = 0.0 + $groupPrice[ 'price' ];
|
552 |
+
if( trim( $ProdSPrice ) == "" || $notLoggedInPrice < 0.0 + $ProdSPrice ){
|
553 |
+
$ProdSPrice = $groupPrice[ 'price' ];
|
554 |
+
$ProdSFromDate = FALSE;
|
555 |
+
$ProdSToDate = FALSE;
|
556 |
+
}
|
557 |
+
} else {
|
558 |
+
$ProdSpecGroupPrices[] = $groupPrice;
|
559 |
}
|
|
|
|
|
560 |
}
|
561 |
}
|
562 |
+
if( trim( $ProdSPrice ) == "" ){
|
563 |
+
$ProdSPrice = -1;
|
564 |
+
$ProdSFromDate = FALSE;
|
565 |
+
$ProdSToDate = FALSE;
|
566 |
+
}
|
567 |
+
} // ! $this->getpricefromchild
|
568 |
if( $this->_DEBUG ){
|
569 |
echo "used product IDs: ";
|
570 |
foreach( $UsedProductIds as $UsedProductid ) echo "".$UsedProductid." ";
|
635 |
if( $qty <= $minQty )
|
636 |
continue;
|
637 |
}
|
638 |
+
if( ! $this->getpricefromchild ){
|
639 |
+
$RPrice = $ProdRPrice;
|
640 |
+
$SPrice = $ProdSPrice;
|
641 |
+
$RPrice0 = $ProdRPrice;
|
642 |
+
$SPrice0 = $ProdSPrice;
|
643 |
+
$SFromDate = !empty( $SPrice ) ? $ProdSFromDate : FALSE;
|
644 |
+
$SToDate = !empty( $SPrice ) ? $ProdSToDate : FALSE;
|
645 |
+
$SpecGroupPrices = FALSE;
|
646 |
+
$SpecGroupPrices0 = FALSE;
|
647 |
+
if( $ProdSpecGroupPrices ){
|
648 |
+
$SpecGroupPrices = array();
|
649 |
+
$SpecGroupPrices0 = array();
|
650 |
+
foreach( $ProdSpecGroupPrices as $prodGroupPrice ){
|
651 |
+
$SpecGroupPrices[ $prodGroupPrice[ 'cust_group' ] ] = 0.0 + $prodGroupPrice[ 'price' ];
|
652 |
+
$SpecGroupPrices0[ $prodGroupPrice[ 'cust_group' ] ] = 0.0 + $prodGroupPrice[ 'price' ];
|
653 |
+
}
|
654 |
+
}
|
655 |
+
} else { // $this->getpricefromchild
|
656 |
+
if( $this->_DEBUG ) echo "sku=".$UsedProduct->getSku()." prices: Regular=".$UsedProduct->getData('price')." Final=".$UsedProduct->getFinalPrice()." Special=".$UsedProduct->getSpecialPrice()." FromDate=".$UsedProduct->getSpecialFromDate()." ToDate=".$UsedProduct->getSpecialToDate()."
|
657 |
";
|
658 |
+
$RPrice = $UsedProduct->getData('price');
|
659 |
+
$SPrice = $UsedProduct->getSpecialPrice();
|
660 |
+
$SFromDate = $UsedProduct->getSpecialFromDate();
|
661 |
+
$SToDate = $UsedProduct->getSpecialToDate();
|
662 |
+
if( $this->_DEBUG ) echo "prod prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
|
663 |
+
";
|
664 |
+
$ProdGroupPrices = FALSE;
|
665 |
+
if( $this->mageVersionArray[ 'major' ] > 1 || $this->mageVersionArray[ 'minor' ] > 6 ){
|
666 |
+
$ProdGroupPrices = $UsedProduct->getData('group_price');
|
667 |
+
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
668 |
+
";
|
669 |
+
}
|
670 |
+
$SpecGroupPrices = FALSE;
|
671 |
+
$SpecGroupPrices0 = FALSE;
|
672 |
+
if( $ProdGroupPrices ){
|
673 |
+
$SpecGroupPrices = array();
|
674 |
+
foreach( $ProdGroupPrices as $groupPrice ){
|
675 |
+
if( $groupPrice[ 'cust_group' ] == '0' ){
|
676 |
+
$notLoggedInPrice = 0.0 + $groupPrice[ 'price' ];
|
677 |
+
if( trim( $SPrice ) == "" || $notLoggedInPrice < 0.0 + $SPrice ){
|
678 |
+
$SPrice = $groupPrice[ 'price' ];
|
679 |
+
$SFromDate = FALSE;
|
680 |
+
$SToDate = FALSE;
|
681 |
+
}
|
682 |
+
} else {
|
683 |
+
$SpecGroupPrices[] = $groupPrice;
|
684 |
+
}
|
685 |
+
}
|
686 |
+
}
|
687 |
+
if( trim( $SPrice ) == "" ){
|
688 |
+
$SPrice = -1;
|
689 |
+
$SFromDate = FALSE;
|
690 |
+
$SToDate = FALSE;
|
691 |
}
|
692 |
}
|
|
|
693 |
$ItemAttributes = "";
|
694 |
foreach( $ConfigurableAttributes as $attribute ){
|
695 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
721 |
if( !empty( $ItemAttributes ) )
|
722 |
$ItemAttributes .= "|";
|
723 |
$ItemAttributes .= $AttributeLabel."=".$AttributeValue;
|
724 |
+
if( ! $this->getpricefromchild ){
|
725 |
+
foreach( $attribute->getPrices() as $addedPrice ){
|
726 |
+
if( $AttributeValue == $addedPrice['label']){
|
727 |
+
if( $addedPrice['is_percent'] ){
|
728 |
+
$RPrice += round( $RPrice0 * $addedPrice['pricing_value'] / 100, 2 );
|
729 |
+
if( $SPrice >= 0 )
|
730 |
+
$SPrice += round( $SPrice0 * $addedPrice['pricing_value'] / 100, 2 );
|
731 |
+
if( $SpecGroupPrices ){
|
732 |
+
foreach( $SpecGroupPrices0 as $key => $value ){
|
733 |
+
$SpecGroupPrices[ $key ] += round( $value * $addedPrice['pricing_value'] / 100, 2 );
|
734 |
+
}
|
735 |
+
}
|
736 |
+
} else {
|
737 |
+
$RPrice += $addedPrice['pricing_value'];
|
738 |
+
if( $SPrice >= 0 )
|
739 |
+
$SPrice += $addedPrice['pricing_value'];
|
740 |
+
if( $SpecGroupPrices ){
|
741 |
+
foreach( $SpecGroupPrices0 as $key => $value )
|
742 |
+
$SpecGroupPrices[ $key ] += $addedPrice['pricing_value'];
|
743 |
+
}
|
744 |
+
}
|
745 |
}
|
746 |
}
|
747 |
+
} // ! $this->getpricefromchild
|
748 |
}
|
749 |
if( !empty($RPrice) && $this->includetaxes )
|
750 |
$RPrice = $this->taxhelper->getPrice( $UsedProduct, $RPrice, true );
|
789 |
$ItemAttributes .= "price_".$this->customerGroups[ $groupID ]."=".$this->_formatPrice( $price );
|
790 |
}
|
791 |
}
|
792 |
+
if( ! $this->getpricefromchild ){
|
793 |
+
if( $this->publishtieredpricing == "1" ){
|
794 |
+
$TierPriceAttributes = $this->_getTierPrices($UsedProduct);
|
795 |
+
$sp = ( empty( $ItemAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
796 |
+
$ItemAttributes.= $sp.$TierPriceAttributes;
|
797 |
+
}
|
798 |
+
} // ! $this->getpricefromchild
|
799 |
if( $this->ignoreassprodimages ) $itemImages = "";
|
800 |
else{
|
801 |
+
if( $this->_DEBUG ) echo "config item image: ".$UsedProduct->getImage()."
|
802 |
+
small image: ".$UsedProduct->getSmallImage()."
|
803 |
+
thumbnail: ".$UsedProduct->getThumbnail()."
|
804 |
+
";
|
805 |
$itemImages = array();
|
806 |
$firstImageFile = trim( $UsedProduct->getImage() );
|
807 |
if( $firstImageFile == "no_selection" )
|
812 |
if( is_array($itemImageArray) ){
|
813 |
foreach( $itemImageArray as $image ){
|
814 |
$imageFile = trim( $image['file'] );
|
815 |
+
if( $this->_DEBUG ) echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
816 |
+
";
|
817 |
if( !$imageFile || $imageFile == $firstImageFile )
|
818 |
continue;
|
819 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
838 |
unset( $UsedProducts );
|
839 |
unset( $UsedProductIds );
|
840 |
$optionIds = array();
|
841 |
+
$attrNumber = 0;
|
842 |
+
$optNumbers = array();
|
843 |
+
$optCounters = array();
|
844 |
foreach( $ConfigurableAttributes as $attribute ){
|
845 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
846 |
+
if( empty( $configurableProdAttribute ) ){
|
847 |
+
continue;
|
848 |
+
}
|
849 |
+
$optionIdList = array();
|
850 |
+
$optionNo = 0;
|
851 |
+
foreach( $configurableProdAttribute->getSource()->getAllOptions() as $option ){
|
852 |
+
$optionIdList[] = trim( $option['value'] ) == "" ? 0 : intVal( $option['value'] );
|
853 |
+
$optionNo++;
|
854 |
+
}
|
855 |
+
$optionIds[] = $optionIdList;
|
856 |
+
$optCounters[] = $optionNo;
|
857 |
$optNumbers[] = 0;
|
858 |
$attrNumber++;
|
859 |
}
|
860 |
+
// if( $this->_DEBUG ) foreach( $optionIds as $key => $optionIdList ) echo "optionIds[".$key."]: ".var_export( $optionIdList, true )."
|
|
|
|
|
|
|
861 |
//";
|
862 |
// supplement prod attrs
|
863 |
if( $this->importoptionsasattributes ){
|
877 |
}
|
878 |
}
|
879 |
// build prod part
|
880 |
+
$this->prodLine = "\t" .$productName //ProductName
|
881 |
."\t" .$ProductDescription
|
882 |
."\t" .$prodImages //ProductGraphic
|
883 |
."\t" .$ProductURL //ProductLink
|
887 |
."\t" .$Reviews //Reviews
|
888 |
."\t" .$shortDescription
|
889 |
."\t";
|
890 |
+
// build cplines matrix
|
891 |
+
$cpLinesMatrix = array();
|
892 |
+
foreach( $cpLines as $cpLine ){
|
893 |
+
$optionId = $cpLine->optionIds[ 0 ];
|
894 |
+
if( $attrNumber > 1 ){
|
895 |
+
if( !isset( $cpLinesMatrix[ $optionId ] ) )
|
896 |
+
$cpLinesMatrix[ $optionId ] = array();
|
897 |
+
$this->_fillCPLinesMatrix( 1, $attrNumber, $cpLine, $cpLinesMatrix[ $optionId ] );
|
898 |
+
} else {
|
899 |
+
if( !isset( $cpLinesMatrix[ $optionId ] ) )
|
900 |
+
$cpLinesMatrix[ $optionId ] = $cpLine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
}
|
902 |
}
|
903 |
+
$this->configItemSequence = 1;
|
904 |
+
$this->configProducttoString = "";
|
905 |
+
$this->_fillConfigProdItems( 0, $attrNumber, $optNumbers, $optionIds, $optCounters, $cpLinesMatrix );
|
906 |
+
unset( $optionIds );
|
907 |
foreach( $cpLines as $cpLine ){
|
908 |
if( $cpLine->line ) echo "WARNING: not rendered config line: ".var_export( $cpLine->optionIds, true )."
|
909 |
";
|
910 |
}
|
911 |
unset( $cpLines );
|
912 |
+
return $this->configProducttoString;
|
913 |
}
|
914 |
|
915 |
private function ProducttoStringSimple( &$product ){
|
944 |
}
|
945 |
}
|
946 |
$prodImages = array();
|
947 |
+
if( $this->_DEBUG ) echo "product image: ".$product->getImage()."
|
948 |
+
small image: ".$product->getSmallImage()."
|
949 |
+
thumbnail: ".$product->getThumbnail()."
|
950 |
+
";
|
951 |
$firstImageFile = trim( $product->getImage() );
|
952 |
if( $firstImageFile == "no_selection" )
|
953 |
$firstImageFile = FALSE;
|
957 |
if( is_array( $prodImageArray ) ){
|
958 |
foreach( $prodImageArray as $image ){
|
959 |
$imageFile = trim( $image['file'] );
|
960 |
+
if( $this->_DEBUG ) echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
961 |
+
";
|
962 |
if( !$imageFile || $imageFile == $firstImageFile )
|
963 |
continue;
|
964 |
if( $this->ignoreexcludedimages && $image['disabled'] )
|
1027 |
if( $this->_DEBUG ) echo "sku=".$product->getSku()." prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
1028 |
";
|
1029 |
$ProdGroupPrices = FALSE;
|
1030 |
+
if( $this->mageVersionArray[ 'major' ] > 1 || $this->mageVersionArray[ 'minor' ] > 6 ){
|
|
|
1031 |
$ProdGroupPrices = $product->getData('group_price');
|
1032 |
if( $this->_DEBUG && count( $ProdGroupPrices ) > 0 ) echo "group_price: ".var_export( $ProdGroupPrices, true )."
|
1033 |
";
|
1148 |
return $ProducttoString;
|
1149 |
}
|
1150 |
|
1151 |
+
private $prodLine = null;
|
1152 |
+
private $configItemSequence = 0;
|
1153 |
+
private $configProducttoString = "";
|
1154 |
+
|
1155 |
+
private function _fillCPLinesMatrix( $attrNumber, $optNo, &$cpLine, &$cpLinesMatrix ){
|
1156 |
+
$optionId = $cpLine->optionIds[ $attrNumber ];
|
1157 |
+
if( $attrNumber < $optNo - 1 ){
|
1158 |
+
if( !isset( $cpLinesMatrix[ $optionId ] ) )
|
1159 |
+
$cpLinesMatrix[ $optionId ] = array();
|
1160 |
+
$this->_fillCPLinesMatrix( $attrNumber + 1, $optNo, $cpLine, $cpLinesMatrix[ $optionId ] );
|
1161 |
+
} else {
|
1162 |
+
if( !isset( $cpLinesMatrix[ $optionId ] ) )
|
1163 |
+
$cpLinesMatrix[ $optionId ] = $cpLine;
|
1164 |
+
}
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
private function _fillConfigProdItems( $attrNumber, $attrNo, &$optNumbers, &$optionIds, &$optCounters, &$cpLinesMatrix ){
|
1168 |
+
$optNumber = 0;
|
1169 |
+
$optionIdNo = $optCounters[ $attrNumber ];
|
1170 |
+
while( $optNumber < $optionIdNo ){
|
1171 |
+
$optionID = $optionIds[ $attrNumber ][ $optNumber ];
|
1172 |
+
if( isset( $cpLinesMatrix[ $optionID ] ) ){
|
1173 |
+
if( $attrNumber < $attrNo - 1 ){
|
1174 |
+
$optNumbers[ $attrNumber ] = $optNumber;
|
1175 |
+
$this->_fillConfigProdItems( $attrNumber + 1, $attrNo, $optNumbers, $optionIds, &$optCounters, $cpLinesMatrix[ $optionID ] );
|
1176 |
+
} else {
|
1177 |
+
$cpLine = $cpLinesMatrix[ $optionID ];
|
1178 |
+
// if( $this->_DEBUG ) echo "_fillConfigProdItems option ids: ".var_export( $cpLine->optionIds, true )."
|
1179 |
+
//";
|
1180 |
+
$this->configProducttoString .= $cpLine->line
|
1181 |
+
.$this->prodLine
|
1182 |
+
.$this->configItemSequence
|
1183 |
+
."\n";
|
1184 |
+
$cpLine->line = FALSE;
|
1185 |
+
$this->configItemSequence++;
|
1186 |
+
}
|
1187 |
+
}
|
1188 |
+
$optNumber++;
|
1189 |
}
|
1190 |
}
|
1191 |
|
1550 |
unset( $UsedProductIds );
|
1551 |
return $ProducttoString;
|
1552 |
}
|
1553 |
+
} // Mage_CodiScript_Model_Files
|
app/code/community/Mage/CodiScript/controllers/IndexController.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
define("__VERSION__","
|
3 |
define("__SCRIPTNAME__",basename(__FILE__));
|
4 |
|
5 |
class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
|
@@ -53,6 +53,7 @@ if( $Class=="DataFile" ){
|
|
53 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
54 |
$includeshortdescription = ( isset($_REQUEST["includeshortdescription"]) && $_REQUEST["includeshortdescription"] == "1" );
|
55 |
$includelongdescription = ( isset($_REQUEST["includelongdescription"]) ? $_REQUEST["includelongdescription"] == "1" : TRUE );
|
|
|
56 |
$getgroupprices = ( isset($_REQUEST["getgroupprices"]) && $_REQUEST["getgroupprices"] == "1" );
|
57 |
$publishtieredpricing = ( isset($_REQUEST["publishtieredpricing"]) && $_REQUEST["publishtieredpricing"] == "1" );
|
58 |
$quantitylabel = isset($_REQUEST["quantitylabel"]) ? $_REQUEST["quantitylabel"] : "Quantity";
|
@@ -85,6 +86,7 @@ if( $Class=="DataFile" ){
|
|
85 |
ignoretopcategory=".$ignoretopcategory."
|
86 |
includeshortdescription=".$includeshortdescription."
|
87 |
includelongdescription=".$includelongdescription."
|
|
|
88 |
getgroupprices=".$getgroupprices."
|
89 |
publishtieredpricing=".$publishtieredpricing."
|
90 |
quantitylabel=".$quantitylabel."
|
@@ -170,6 +172,7 @@ if( $Class=="DataFile" ){
|
|
170 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
171 |
$cfModel->includeshortdescription = $includeshortdescription;
|
172 |
$cfModel->includelongdescription = $includelongdescription;
|
|
|
173 |
$cfModel->getgroupprices = $getgroupprices;
|
174 |
$cfModel->publishtieredpricing = $publishtieredpricing;
|
175 |
$cfModel->quantitylabel = $quantitylabel;
|
@@ -230,6 +233,16 @@ executed in ".( time() - $started_time )." sec.
|
|
230 |
";
|
231 |
die();
|
232 |
/* RELEASE NOTES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
* 2014-11-10
|
234 |
* 1. Added instockonly option and implemented import of only items that are in stock
|
235 |
*
|
1 |
<?php
|
2 |
+
define("__VERSION__","2015-01-29");
|
3 |
define("__SCRIPTNAME__",basename(__FILE__));
|
4 |
|
5 |
class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
|
53 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
54 |
$includeshortdescription = ( isset($_REQUEST["includeshortdescription"]) && $_REQUEST["includeshortdescription"] == "1" );
|
55 |
$includelongdescription = ( isset($_REQUEST["includelongdescription"]) ? $_REQUEST["includelongdescription"] == "1" : TRUE );
|
56 |
+
$getpricefromchild = ( isset($_REQUEST["getpricefromchild"]) ? $_REQUEST["getpricefromchild"] == "1" : TRUE );
|
57 |
$getgroupprices = ( isset($_REQUEST["getgroupprices"]) && $_REQUEST["getgroupprices"] == "1" );
|
58 |
$publishtieredpricing = ( isset($_REQUEST["publishtieredpricing"]) && $_REQUEST["publishtieredpricing"] == "1" );
|
59 |
$quantitylabel = isset($_REQUEST["quantitylabel"]) ? $_REQUEST["quantitylabel"] : "Quantity";
|
86 |
ignoretopcategory=".$ignoretopcategory."
|
87 |
includeshortdescription=".$includeshortdescription."
|
88 |
includelongdescription=".$includelongdescription."
|
89 |
+
getpricefromchild=".$getpricefromchild."
|
90 |
getgroupprices=".$getgroupprices."
|
91 |
publishtieredpricing=".$publishtieredpricing."
|
92 |
quantitylabel=".$quantitylabel."
|
172 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
173 |
$cfModel->includeshortdescription = $includeshortdescription;
|
174 |
$cfModel->includelongdescription = $includelongdescription;
|
175 |
+
$cfModel->getpricefromchild = $getpricefromchild;
|
176 |
$cfModel->getgroupprices = $getgroupprices;
|
177 |
$cfModel->publishtieredpricing = $publishtieredpricing;
|
178 |
$cfModel->quantitylabel = $quantitylabel;
|
233 |
";
|
234 |
die();
|
235 |
/* RELEASE NOTES
|
236 |
+
* 2015-01-29
|
237 |
+
* Restored / reimplemented getpricefromchild
|
238 |
+
* - now forces getting individual associated product prices as iem prices
|
239 |
+
*
|
240 |
+
* 2015-01-08
|
241 |
+
* 1. Optimized configurable product items ordering
|
242 |
+
*
|
243 |
+
* 2014-12-16
|
244 |
+
* 1. Fixed configurable attributes processing bug
|
245 |
+
*
|
246 |
* 2014-11-10
|
247 |
* 1. Added instockonly option and implemented import of only items that are in stock
|
248 |
*
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_Codi</name>
|
4 |
-
<version>4.1.
|
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>
|
14 |
-
<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="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_Codi</name>
|
4 |
+
<version>4.1.8</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-02-01</date>
|
14 |
+
<time>00:26:11</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="78443efcfdba438b93160c970a78bbb5"/></dir><dir name="controllers"><file name="IndexController.php" hash="faf7f3ffeb917c904b3c9b1c8465b169"/></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>
|