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.7 |
| Comparing to | |
| See all releases | |
Code changes from version 4.1.5 to 4.1.7
app/code/community/Mage/CodiScript/Model/Files.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
// 2014-
|
| 3 |
class ConfiguredProductLine{
|
| 4 |
public $optionIds = array();
|
| 5 |
public $line = NULL;
|
|
@@ -28,6 +28,7 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
| 28 |
public $ignoreassprodimages = FALSE;
|
| 29 |
public $includecustomfields = FALSE;
|
| 30 |
public $importoptionsasattributes = FALSE;
|
|
|
|
| 31 |
public $start = 0;
|
| 32 |
public $pageSize = 1000000000;
|
| 33 |
public $address = FALSE;
|
|
@@ -53,10 +54,10 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
| 53 |
|
| 54 |
// Class=DataFile
|
| 55 |
public function renderDataFile(){
|
| 56 |
-
if($this->_DEBUG){
|
| 57 |
echo "memory_get_usage real: ".memory_get_usage(TRUE)." allocated: ".memory_get_usage()."
|
| 58 |
";
|
| 59 |
-
foreach
|
| 60 |
";
|
| 61 |
}
|
| 62 |
$this->productTypeConfigurableModel = Mage::getModel('catalog/product_type_configurable');
|
|
@@ -70,7 +71,7 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
| 70 |
$customerGroups = Mage::getModel('customer/group')->getCollection();
|
| 71 |
foreach( $customerGroups as $cg ){
|
| 72 |
$this->customerGroups[$cg->_data['customer_group_id']] = $cg->_data['customer_group_code'];
|
| 73 |
-
if($this->_DEBUG) echo "customer group #".$cg->_data['customer_group_id']."-".$cg->_data['customer_group_code']."
|
| 74 |
";
|
| 75 |
}
|
| 76 |
}
|
|
@@ -78,7 +79,7 @@ class Mage_CodiScript_Model_Files extends Mage_Core_Model_Abstract {
|
|
| 78 |
$products->addAttributeToFilter('status', 1);//enabled
|
| 79 |
$products->addAttributeToFilter('visibility', 4);//catalog, search
|
| 80 |
$prodIds = $this->_DEBUG ? $products->getAllIds(1000,0) : $products->getAllIds();
|
| 81 |
-
if($this->_DEBUG) echo "StoreId: ".$this->StoreId."
|
| 82 |
Products: ".count($prodIds)."
|
| 83 |
Media URL: ".$this->mediaurl."
|
| 84 |
memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
@@ -101,7 +102,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 101 |
}
|
| 102 |
$index++;
|
| 103 |
$product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
|
| 104 |
-
if($this->_DEBUG) echo "== PRODUCT: ".$product->getTypeId()." == ".$product->getId()."-".$product->getName()." ==
|
| 105 |
";
|
| 106 |
if( $product->isConfigurable() )
|
| 107 |
echo $this->ProducttoStringConfigurable( $product );
|
|
@@ -110,7 +111,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 110 |
else
|
| 111 |
echo $this->ProducttoStringSimple( $product );
|
| 112 |
unset( $product );
|
| 113 |
-
if($this->_DEBUG) echo "#".$count.": memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
| 114 |
";
|
| 115 |
$count++;
|
| 116 |
}
|
|
@@ -155,7 +156,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 155 |
$ProductAttributes = "";
|
| 156 |
foreach( $attributes as $attribute ){
|
| 157 |
$attribute->setStoreId( $this->StoreId );
|
| 158 |
-
if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 159 |
$hasData = $product->getData($attribute->getAttributeCode()) ? TRUE : FALSE;
|
| 160 |
echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData."
|
| 161 |
";
|
|
@@ -182,7 +183,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 182 |
}
|
| 183 |
}
|
| 184 |
}
|
| 185 |
-
if($this->publishtieredpricing == "1"){
|
| 186 |
$TierPriceAttributes = $this->_getTierPrices( $product );
|
| 187 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 188 |
$ProductAttributes .= $sp.$TierPriceAttributes;
|
|
@@ -199,8 +200,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 199 |
$firstImageFile = FALSE;
|
| 200 |
if( $firstImageFile )
|
| 201 |
$prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
|
| 202 |
-
$prodImageArray = $product->getMediaGallery('images');
|
| 203 |
-
if( is_array($prodImageArray) ){
|
| 204 |
foreach( $prodImageArray as $image ){
|
| 205 |
$imageFile = trim( $image['file'] );
|
| 206 |
// echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
|
@@ -221,21 +222,21 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 221 |
$Reviews = $this->enablereviews ? $this->_getReviews($product->getId()) : '';
|
| 222 |
if( !empty( $Reviews ) )
|
| 223 |
$Reviews = $this->_cleanStr( $Reviews );
|
| 224 |
-
if($this->_DEBUG){
|
| 225 |
echo "associated IDs: ";
|
| 226 |
-
foreach($AssociatedProductIds as $UsedProductid) echo "".$UsedProductid." ";
|
| 227 |
echo "
|
| 228 |
";
|
| 229 |
}
|
| 230 |
$sequence = 1;
|
| 231 |
$UsedProducts = array();
|
| 232 |
-
foreach($AssociatedProductIds as $UsedProductid){
|
| 233 |
$UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
|
| 234 |
$UsedProducts[] = $UsedProduct;
|
| 235 |
}
|
| 236 |
$renderSPrice = FALSE;
|
| 237 |
if( $this->includespecialprice ){
|
| 238 |
-
foreach($UsedProducts as $UsedProduct){
|
| 239 |
$SPrice = $UsedProduct->getSpecialPrice();
|
| 240 |
if( trim( $SPrice ) != "" ){
|
| 241 |
$renderSPrice = TRUE;
|
|
@@ -243,10 +244,17 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 243 |
}
|
| 244 |
}
|
| 245 |
}
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
";
|
| 248 |
-
|
| 249 |
-
|
|
|
|
|
|
|
| 250 |
";
|
| 251 |
$ItemName= $UsedProduct->getName();
|
| 252 |
$ProdRPrice = $UsedProduct->getData('price');
|
|
@@ -288,7 +296,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 288 |
$SPrice = $ProdSPrice;
|
| 289 |
if( $SPrice >= 0 && $this->includetaxes )
|
| 290 |
$SPrice = $this->taxhelper->getPrice( $UsedProduct, $SPrice, true );
|
| 291 |
-
if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
|
| 292 |
";
|
| 293 |
if( $this->ignoreassprodimages ) $itemImages = "";
|
| 294 |
else{
|
|
@@ -321,12 +329,12 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 321 |
$ItemAttributes = "";
|
| 322 |
foreach( $attributes as $attribute ){
|
| 323 |
$attribute->setStoreId( $this->StoreId );
|
| 324 |
-
if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 325 |
$hasData = $UsedProduct->getData($attribute->getAttributeCode()) ? "YES" : "NO";
|
| 326 |
echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $UsedProduct )." input=".$attribute->getFrontendInput()." data=".$UsedProduct->getData($attribute->getAttributeCode())." hasData=".$hasData."
|
| 327 |
";
|
| 328 |
}
|
| 329 |
-
if($attribute->getAttributeCode()=="manufacturer"){
|
| 330 |
if( $UsedProduct->getData( $attribute->getAttributeCode() ) )
|
| 331 |
$Manufacturer = $attribute->getFrontend()->getValue( $UsedProduct );
|
| 332 |
continue;
|
|
@@ -343,12 +351,17 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 343 |
$ItemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|";
|
| 344 |
}
|
| 345 |
}
|
| 346 |
-
$ItemAttributes = substr( $ItemAttributes, 0, strlen($ItemAttributes)-1 );
|
| 347 |
if( $this->includeinvqty ){
|
| 348 |
if( !empty( $ItemAttributes ) )
|
| 349 |
$ItemAttributes .= "|";
|
| 350 |
$ItemAttributes .= "Inventory=".$this->_formatQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
|
| 351 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
$RPrice = $this->_formatPrice( $RPrice );
|
| 353 |
if( $this->includespecialprice ){
|
| 354 |
if( $SPrice >= 0 ){
|
|
@@ -473,7 +486,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 473 |
}
|
| 474 |
}
|
| 475 |
}
|
| 476 |
-
if($this->publishtieredpricing == "1"){
|
| 477 |
$TierPriceAttributes = $this->_getTierPrices($product);
|
| 478 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 479 |
$ProductAttributes.= $sp.$TierPriceAttributes;
|
|
@@ -516,7 +529,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 516 |
$ProdSPrice = $product->getSpecialPrice();
|
| 517 |
$ProdSFromDate = $product->getSpecialFromDate();
|
| 518 |
$ProdSToDate = $product->getSpecialToDate();
|
| 519 |
-
if($this->_DEBUG) echo "prod prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
| 520 |
";
|
| 521 |
$ProdGroupPrices = FALSE;
|
| 522 |
$mageVersionArray = Mage::getVersionInfo();
|
|
@@ -546,9 +559,9 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 546 |
$ProdSFromDate = FALSE;
|
| 547 |
$ProdSToDate = FALSE;
|
| 548 |
}
|
| 549 |
-
if($this->_DEBUG){
|
| 550 |
echo "used product IDs: ";
|
| 551 |
-
foreach($UsedProductIds as $UsedProductid) echo "".$UsedProductid." ";
|
| 552 |
echo "
|
| 553 |
";
|
| 554 |
}
|
|
@@ -558,7 +571,11 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 558 |
}
|
| 559 |
$ConfigurableAttributes = $product->getTypeInstance( true )->getConfigurableAttributes( $product );
|
| 560 |
foreach( $ConfigurableAttributes as $attribute ){
|
| 561 |
-
$attribute->setStoreId( $this->StoreId );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 562 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
| 563 |
if( empty( $configurableProdAttribute ) ){
|
| 564 |
$label = $attribute->getLabel();
|
|
@@ -566,26 +583,29 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 566 |
";
|
| 567 |
continue;
|
| 568 |
}
|
| 569 |
-
$
|
| 570 |
-
if($this->_DEBUG){
|
| 571 |
-
echo "configurable prod attr: ".$
|
| 572 |
";
|
| 573 |
}
|
|
|
|
|
|
|
|
|
|
| 574 |
if( $this->importoptionsasattributes ){
|
| 575 |
$usedConfigurableAttributes[ $AttributeLabel ] = array();
|
| 576 |
-
if($this->_DEBUG){
|
| 577 |
echo "created usedConfigurableAttributes array for \"".$AttributeLabel."\"
|
| 578 |
";
|
| 579 |
}
|
| 580 |
}
|
| 581 |
-
foreach
|
| 582 |
-
if($this->_DEBUG){
|
| 583 |
echo "variation option: ".$option['value' ]."=>".$option['label' ]."
|
| 584 |
";
|
| 585 |
}
|
| 586 |
if( $this->importoptionsasattributes ){
|
| 587 |
$usedConfigurableAttributes[ $AttributeLabel ][ $option['label' ] ] = FALSE;
|
| 588 |
-
if($this->_DEBUG){
|
| 589 |
echo "created usedConfigurableAttributes label \"".$option['label' ]."\"
|
| 590 |
";
|
| 591 |
}
|
|
@@ -600,14 +620,23 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 600 |
$cpLines = array();
|
| 601 |
foreach( $UsedProducts as $UsedProductid => $UsedProduct ){
|
| 602 |
$cpLine = new ConfiguredProductLine();
|
| 603 |
-
if($this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
";
|
| 605 |
$RPrice = $ProdRPrice;
|
| 606 |
$SPrice = $ProdSPrice;
|
| 607 |
$RPrice0 = $ProdRPrice;
|
| 608 |
$SPrice0 = $ProdSPrice;
|
| 609 |
-
$SFromDate = !empty($SPrice) ? $ProdSFromDate : FALSE;
|
| 610 |
-
$SToDate = !empty($SPrice) ? $ProdSToDate : FALSE;
|
| 611 |
$SpecGroupPrices = FALSE;
|
| 612 |
$SpecGroupPrices0 = FALSE;
|
| 613 |
if( $ProdSpecGroupPrices ){
|
|
@@ -630,11 +659,13 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 630 |
continue;
|
| 631 |
}
|
| 632 |
$AttributeCode = $configurableProdAttribute->getAttributeCode();
|
| 633 |
-
$AttributeLabel = $
|
|
|
|
|
|
|
| 634 |
$AttribId = $UsedProduct->getData($AttributeCode);
|
| 635 |
$cpLine->optionIds[] = intVal( $AttribId );
|
| 636 |
$AttributeValue = "";
|
| 637 |
-
foreach
|
| 638 |
if( $option['value'] == $AttribId ){
|
| 639 |
$AttributeValue = $option['label'];
|
| 640 |
break;
|
|
@@ -643,7 +674,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 643 |
if( $this->importoptionsasattributes && trim( $AttributeValue ) ){
|
| 644 |
$usedConfigurableAttributes[ $AttributeLabel ][ $AttributeValue ] = TRUE;
|
| 645 |
}
|
| 646 |
-
if($this->_DEBUG) echo "config attr code=".$AttributeCode." label=".$AttributeLabel." id=".$AttribId." value=".$AttributeValue."
|
| 647 |
";
|
| 648 |
if( !empty( $ItemAttributes ) )
|
| 649 |
$ItemAttributes .= "|";
|
|
@@ -664,9 +695,8 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 664 |
if( $SPrice >= 0 )
|
| 665 |
$SPrice += $addedPrice['pricing_value'];
|
| 666 |
if( $SpecGroupPrices ){
|
| 667 |
-
foreach( $SpecGroupPrices0 as $key => $value )
|
| 668 |
$SpecGroupPrices[ $key ] += $addedPrice['pricing_value'];
|
| 669 |
-
}
|
| 670 |
}
|
| 671 |
}
|
| 672 |
}
|
|
@@ -681,7 +711,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 681 |
$ItemAttributes .= "|";
|
| 682 |
$ItemAttributes .= "Inventory=".$this->_formatQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
|
| 683 |
}
|
| 684 |
-
if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
|
| 685 |
";
|
| 686 |
$RPrice = $this->_formatPrice( $RPrice );
|
| 687 |
if( $this->includespecialprice ){
|
|
@@ -715,7 +745,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 715 |
$ItemAttributes .= "price_".$this->customerGroups[ $groupID ]."=".$this->_formatPrice( $price );
|
| 716 |
}
|
| 717 |
}
|
| 718 |
-
if($this->ignoreassprodimages) $itemImages = "";
|
| 719 |
else{
|
| 720 |
// echo "config item image: ".$UsedProduct->getImage()."
|
| 721 |
//small image: ".$UsedProduct->getSmallImage()."
|
|
@@ -761,7 +791,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 761 |
foreach( $ConfigurableAttributes as $attribute ){
|
| 762 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
| 763 |
$optionIdLine = array();
|
| 764 |
-
foreach
|
| 765 |
$optionIdLine[] = trim( $option['value'] ) == "" ? 0 : intVal( $option['value'] );
|
| 766 |
$optionIds[] = $optionIdLine;
|
| 767 |
$attrNumberNo++;
|
|
@@ -781,16 +811,15 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 781 |
//";
|
| 782 |
// supplement prod attrs
|
| 783 |
if( $this->importoptionsasattributes ){
|
| 784 |
-
foreach
|
| 785 |
if( !empty( $ProductAttributes ) )
|
| 786 |
$ProductAttributes .= "|";
|
| 787 |
$ProductAttributes .= $attrName."=";
|
| 788 |
$valCount = 0;
|
| 789 |
-
foreach
|
| 790 |
if( $used ){
|
| 791 |
-
if( $valCount > 0 )
|
| 792 |
$ProductAttributes .= "<br />";
|
| 793 |
-
}
|
| 794 |
$ProductAttributes .= $attrValue;
|
| 795 |
$valCount++;
|
| 796 |
}
|
|
@@ -885,7 +914,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 885 |
if( $firstImageFile )
|
| 886 |
$prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
|
| 887 |
$prodImageArray = $product->getMediaGallery('images');
|
| 888 |
-
if( is_array($prodImageArray) ){
|
| 889 |
foreach( $prodImageArray as $image ){
|
| 890 |
$imageFile = trim( $image['file'] );
|
| 891 |
// echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
|
@@ -908,7 +937,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 908 |
$ProductAttributes = "";
|
| 909 |
foreach( $attributes as $attribute ){
|
| 910 |
$attribute->setStoreId( $this->StoreId );
|
| 911 |
-
if($this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 912 |
$hasData = $product->getData($attribute->getAttributeCode()) ? "YES" : "NO";
|
| 913 |
echo "simple prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData." store=".$product->_storeId."
|
| 914 |
";
|
|
@@ -935,7 +964,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 935 |
}
|
| 936 |
}
|
| 937 |
}
|
| 938 |
-
if($this->publishtieredpricing == "1"){
|
| 939 |
$TierPriceAttributes = $this->_getTierPrices( $product );
|
| 940 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 941 |
$ProductAttributes.= $sp.$TierPriceAttributes;
|
|
@@ -946,7 +975,16 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 946 |
$ProdSPrice = $product->getSpecialPrice();
|
| 947 |
$ProdSFromDate = $product->getSpecialFromDate();
|
| 948 |
$ProdSToDate = $product->getSpecialToDate();
|
| 949 |
-
if($this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 950 |
";
|
| 951 |
$ProdGroupPrices = FALSE;
|
| 952 |
$mageVersionArray = Mage::getVersionInfo();
|
|
@@ -982,9 +1020,9 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 982 |
foreach( $options as $option ){
|
| 983 |
$selection = $option->getDefaultSelection();
|
| 984 |
$MinSelPrice = 0;
|
| 985 |
-
if( $selection )
|
| 986 |
$MinSelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
|
| 987 |
-
|
| 988 |
foreach( $option->getSelections() as $selection ){
|
| 989 |
$SelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
|
| 990 |
if( ( $MinSelPrice == 0 && $SelPrice > 0 ) || ( $MinSelPrice > 0 && $SelPrice > 0 && $SelPrice < $MinSelPrice ) )
|
|
@@ -1006,7 +1044,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1006 |
$SPrice = $ProdSPrice;
|
| 1007 |
if( $SPrice >= 0 && $this->includetaxes )
|
| 1008 |
$SPrice = $this->taxhelper->getPrice( $product, $SPrice, true );
|
| 1009 |
-
if($this->_DEBUG) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
| 1010 |
";
|
| 1011 |
$ItemAttributes = "";
|
| 1012 |
if( $this->includeinvqty )
|
|
@@ -1118,12 +1156,32 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1118 |
}
|
| 1119 |
|
| 1120 |
private function _formatPrice( $Price ){
|
| 1121 |
-
$
|
| 1122 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1123 |
return "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1124 |
$tail = strrchr( $rv, "." );
|
| 1125 |
if( !empty( $tail ) && strlen( $tail ) > 3 )
|
| 1126 |
$rv = substr( $rv, 0, strlen( $rv ) - ( strlen( $tail ) - 3 ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1127 |
else if( !$tail )
|
| 1128 |
$rv = $rv.".00";
|
| 1129 |
return $rv;
|
|
@@ -1181,11 +1239,11 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1181 |
->addAttributeToSort('position', 'asc');
|
| 1182 |
$i = 1;
|
| 1183 |
$count = count( $categories );
|
| 1184 |
-
if($this->_DEBUG) echo "StoreId: ".$this->StoreId." Top categories: ".$count."
|
| 1185 |
";
|
| 1186 |
echo "sec_Project\tsec_Sequence\tsec_HierarchyPath\tsec_Flag\n";
|
| 1187 |
if( $count > 0 ){
|
| 1188 |
-
if($this->ignoretopcategory){
|
| 1189 |
foreach( $categories as $topcategory ){
|
| 1190 |
$children = $topcategory->getCollection();
|
| 1191 |
$children->setStoreId( $this->StoreId )
|
|
@@ -1194,7 +1252,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1194 |
->addAttributeToSort('position', 'asc')
|
| 1195 |
->addIdFilter($topcategory->getChildren())
|
| 1196 |
->load();
|
| 1197 |
-
foreach
|
| 1198 |
$name = $category->getName();
|
| 1199 |
$id = $category->getId();
|
| 1200 |
echo $this->_drawCategory( $category, 1, $name, $i );
|
|
@@ -1240,7 +1298,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1240 |
$htmlChildren = "";
|
| 1241 |
if( count( $children ) ){
|
| 1242 |
$j = 1;
|
| 1243 |
-
foreach
|
| 1244 |
$htmlChildren .= $this->_drawCategory( $cat, $level + 1, $hpath, $i, $j, $path );
|
| 1245 |
$j++;
|
| 1246 |
}
|
|
@@ -1260,11 +1318,11 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1260 |
->addAttributeToFilter('is_active', array('eq' => 1))
|
| 1261 |
->addAttributeToSort('position', 'asc');
|
| 1262 |
$count = count( $categories );
|
| 1263 |
-
if($this->_DEBUG) echo "StoreId: ".$this->StoreId." Top categories: ".$count."
|
| 1264 |
";
|
| 1265 |
if( $count > 0 ){
|
| 1266 |
$hpath = "";
|
| 1267 |
-
if($this->ignoretopcategory){
|
| 1268 |
foreach( $categories as $topcategory ){
|
| 1269 |
$children = $topcategory->getCollection();
|
| 1270 |
$children->setStoreId( $this->StoreId )
|
|
@@ -1273,7 +1331,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1273 |
->addAttributeToSort('position', 'asc')
|
| 1274 |
->addIdFilter($topcategory->getChildren())
|
| 1275 |
->load();
|
| 1276 |
-
foreach
|
| 1277 |
$this->catmap[ $category->getId() ] = $category;
|
| 1278 |
$this->_processCategory( $category, 1, $hpath );
|
| 1279 |
}
|
|
@@ -1292,7 +1350,7 @@ memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
|
| 1292 |
$products->addAttributeToFilter('status', 1);//enabled
|
| 1293 |
$products->addAttributeToFilter('visibility', 4);//catalog, search
|
| 1294 |
$prodIds = $this->_DEBUG ? $products->getAllIds(1000,0) : $products->getAllIds();
|
| 1295 |
-
if($this->_DEBUG) echo "StoreId: ".$this->StoreId."
|
| 1296 |
Products: ".count( $prodIds )."
|
| 1297 |
";
|
| 1298 |
$count = 0;
|
|
@@ -1313,7 +1371,7 @@ Products: ".count( $prodIds )."
|
|
| 1313 |
$product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
|
| 1314 |
echo $product->isConfigurable() ? $this->CatalogProjectStringConfigurable( $product ) : $this->CatalogProjectStringSimple( $product );
|
| 1315 |
unset( $product );
|
| 1316 |
-
if($this->_DEBUG) echo "#".$count.": memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
| 1317 |
";
|
| 1318 |
$count++;
|
| 1319 |
}
|
|
@@ -1323,7 +1381,7 @@ Products: ".count( $prodIds )."
|
|
| 1323 |
private function _processCategory( &$category, $level=0, $hpath='', $path='' ){
|
| 1324 |
$hpath = $level != 1 ? $hpath.'#$#'.$category->getName() : $hpath = $category->getName();
|
| 1325 |
$this->catpathmap[ $category->getId() ] = $hpath;
|
| 1326 |
-
if($this->_DEBUG) echo "Category: ".$category->getId()." path=".$hpath."
|
| 1327 |
";
|
| 1328 |
$children = $category->getCollection();
|
| 1329 |
$children->setStoreId( $this->StoreId )
|
|
@@ -1333,7 +1391,7 @@ Products: ".count( $prodIds )."
|
|
| 1333 |
->addIdFilter($category->getChildren())
|
| 1334 |
->load();
|
| 1335 |
$htmlChildren = "";
|
| 1336 |
-
if( count( $children ) ) foreach
|
| 1337 |
$this->catmap[ $childcategory->getId() ] = $childcategory;
|
| 1338 |
$htmlChildren .= $this->_processCategory( $childcategory, $level + 1, $hpath, $path );
|
| 1339 |
}
|
|
@@ -1346,7 +1404,7 @@ Products: ".count( $prodIds )."
|
|
| 1346 |
if( $categoryIds ){
|
| 1347 |
foreach( $categoryIds as $k => $category_id ){
|
| 1348 |
if( !isset( $this->catmap[ $category_id ] ) ){
|
| 1349 |
-
if($this->_DEBUG) echo "No category: ".$category_id."
|
| 1350 |
";
|
| 1351 |
continue;
|
| 1352 |
}
|
|
@@ -1393,7 +1451,7 @@ Products: ".count( $prodIds )."
|
|
| 1393 |
if( $categoryIds ){
|
| 1394 |
foreach( $categoryIds as $k => $category_id ){
|
| 1395 |
if( !isset( $this->catmap[ $category_id ] ) ){
|
| 1396 |
-
if($this->_DEBUG) echo "No category: ".$category_id."
|
| 1397 |
";
|
| 1398 |
continue;
|
| 1399 |
}
|
| 1 |
<?php
|
| 2 |
+
// 2014-11-10
|
| 3 |
class ConfiguredProductLine{
|
| 4 |
public $optionIds = array();
|
| 5 |
public $line = NULL;
|
| 28 |
public $ignoreassprodimages = FALSE;
|
| 29 |
public $includecustomfields = FALSE;
|
| 30 |
public $importoptionsasattributes = FALSE;
|
| 31 |
+
public $instockonly = FALSE;
|
| 32 |
public $start = 0;
|
| 33 |
public $pageSize = 1000000000;
|
| 34 |
public $address = FALSE;
|
| 54 |
|
| 55 |
// Class=DataFile
|
| 56 |
public function renderDataFile(){
|
| 57 |
+
if( $this->_DEBUG ){
|
| 58 |
echo "memory_get_usage real: ".memory_get_usage(TRUE)." allocated: ".memory_get_usage()."
|
| 59 |
";
|
| 60 |
+
foreach( Mage::app()->getStores() as $store ) echo "store: ".$store->getId()." code=".$store->getCode()." isActive=".$store->getIsActive()."
|
| 61 |
";
|
| 62 |
}
|
| 63 |
$this->productTypeConfigurableModel = Mage::getModel('catalog/product_type_configurable');
|
| 71 |
$customerGroups = Mage::getModel('customer/group')->getCollection();
|
| 72 |
foreach( $customerGroups as $cg ){
|
| 73 |
$this->customerGroups[$cg->_data['customer_group_id']] = $cg->_data['customer_group_code'];
|
| 74 |
+
if( $this->_DEBUG ) echo "customer group #".$cg->_data['customer_group_id']."-".$cg->_data['customer_group_code']."
|
| 75 |
";
|
| 76 |
}
|
| 77 |
}
|
| 79 |
$products->addAttributeToFilter('status', 1);//enabled
|
| 80 |
$products->addAttributeToFilter('visibility', 4);//catalog, search
|
| 81 |
$prodIds = $this->_DEBUG ? $products->getAllIds(1000,0) : $products->getAllIds();
|
| 82 |
+
if( $this->_DEBUG ) echo "StoreId: ".$this->StoreId."
|
| 83 |
Products: ".count($prodIds)."
|
| 84 |
Media URL: ".$this->mediaurl."
|
| 85 |
memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
| 102 |
}
|
| 103 |
$index++;
|
| 104 |
$product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
|
| 105 |
+
if( $this->_DEBUG ) echo "== PRODUCT: ".$product->getTypeId()." == ".$product->getId()."-".$product->getName()." ==
|
| 106 |
";
|
| 107 |
if( $product->isConfigurable() )
|
| 108 |
echo $this->ProducttoStringConfigurable( $product );
|
| 111 |
else
|
| 112 |
echo $this->ProducttoStringSimple( $product );
|
| 113 |
unset( $product );
|
| 114 |
+
if( $this->_DEBUG ) echo "#".$count.": memory_get_usage ".memory_get_usage()." / ".memory_get_usage( TRUE )."
|
| 115 |
";
|
| 116 |
$count++;
|
| 117 |
}
|
| 156 |
$ProductAttributes = "";
|
| 157 |
foreach( $attributes as $attribute ){
|
| 158 |
$attribute->setStoreId( $this->StoreId );
|
| 159 |
+
if( $this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 160 |
$hasData = $product->getData($attribute->getAttributeCode()) ? TRUE : FALSE;
|
| 161 |
echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData."
|
| 162 |
";
|
| 183 |
}
|
| 184 |
}
|
| 185 |
}
|
| 186 |
+
if( $this->publishtieredpricing == "1" ){
|
| 187 |
$TierPriceAttributes = $this->_getTierPrices( $product );
|
| 188 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 189 |
$ProductAttributes .= $sp.$TierPriceAttributes;
|
| 200 |
$firstImageFile = FALSE;
|
| 201 |
if( $firstImageFile )
|
| 202 |
$prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
|
| 203 |
+
$prodImageArray = $product->getMediaGallery( 'images' );
|
| 204 |
+
if( is_array( $prodImageArray ) ){
|
| 205 |
foreach( $prodImageArray as $image ){
|
| 206 |
$imageFile = trim( $image['file'] );
|
| 207 |
// echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
| 222 |
$Reviews = $this->enablereviews ? $this->_getReviews($product->getId()) : '';
|
| 223 |
if( !empty( $Reviews ) )
|
| 224 |
$Reviews = $this->_cleanStr( $Reviews );
|
| 225 |
+
if( $this->_DEBUG ){
|
| 226 |
echo "associated IDs: ";
|
| 227 |
+
foreach( $AssociatedProductIds as $UsedProductid ) echo "".$UsedProductid." ";
|
| 228 |
echo "
|
| 229 |
";
|
| 230 |
}
|
| 231 |
$sequence = 1;
|
| 232 |
$UsedProducts = array();
|
| 233 |
+
foreach( $AssociatedProductIds as $UsedProductid ){
|
| 234 |
$UsedProduct = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $UsedProductid );
|
| 235 |
$UsedProducts[] = $UsedProduct;
|
| 236 |
}
|
| 237 |
$renderSPrice = FALSE;
|
| 238 |
if( $this->includespecialprice ){
|
| 239 |
+
foreach( $UsedProducts as $UsedProduct ){
|
| 240 |
$SPrice = $UsedProduct->getSpecialPrice();
|
| 241 |
if( trim( $SPrice ) != "" ){
|
| 242 |
$renderSPrice = TRUE;
|
| 244 |
}
|
| 245 |
}
|
| 246 |
}
|
| 247 |
+
foreach( $UsedProducts as $UsedProduct ){
|
| 248 |
+
if( $this->instockonly ){
|
| 249 |
+
$inventory = $this->catalogInventoryModel->loadByProduct( $UsedProduct );
|
| 250 |
+
$qty = $inventory->getQty();
|
| 251 |
+
$minQty = $inventory->getMinQty();
|
| 252 |
+
if( $this->_DEBUG ) echo "sku=".$UsedProduct->getSku()." qty=".$qty." minQty=".$minQty."
|
| 253 |
";
|
| 254 |
+
if( $qty <= $minQty )
|
| 255 |
+
continue;
|
| 256 |
+
}
|
| 257 |
+
if( $this->_DEBUG ) echo "sku=".$UsedProduct->getSku()." prices: Regular=".$UsedProduct->getData('price')." Final=".$UsedProduct->getFinalPrice()." Special=".$UsedProduct->getSpecialPrice()." FromDate=".$UsedProduct->getSpecialFromDate()." ToDate=".$UsedProduct->getSpecialToDate()."
|
| 258 |
";
|
| 259 |
$ItemName= $UsedProduct->getName();
|
| 260 |
$ProdRPrice = $UsedProduct->getData('price');
|
| 296 |
$SPrice = $ProdSPrice;
|
| 297 |
if( $SPrice >= 0 && $this->includetaxes )
|
| 298 |
$SPrice = $this->taxhelper->getPrice( $UsedProduct, $SPrice, true );
|
| 299 |
+
if( $this->_DEBUG ) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
|
| 300 |
";
|
| 301 |
if( $this->ignoreassprodimages ) $itemImages = "";
|
| 302 |
else{
|
| 329 |
$ItemAttributes = "";
|
| 330 |
foreach( $attributes as $attribute ){
|
| 331 |
$attribute->setStoreId( $this->StoreId );
|
| 332 |
+
if( $this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 333 |
$hasData = $UsedProduct->getData($attribute->getAttributeCode()) ? "YES" : "NO";
|
| 334 |
echo "grouped prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $UsedProduct )." input=".$attribute->getFrontendInput()." data=".$UsedProduct->getData($attribute->getAttributeCode())." hasData=".$hasData."
|
| 335 |
";
|
| 336 |
}
|
| 337 |
+
if( $attribute->getAttributeCode() == "manufacturer" ){
|
| 338 |
if( $UsedProduct->getData( $attribute->getAttributeCode() ) )
|
| 339 |
$Manufacturer = $attribute->getFrontend()->getValue( $UsedProduct );
|
| 340 |
continue;
|
| 351 |
$ItemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|";
|
| 352 |
}
|
| 353 |
}
|
| 354 |
+
$ItemAttributes = substr( $ItemAttributes, 0, strlen( $ItemAttributes ) - 1 );
|
| 355 |
if( $this->includeinvqty ){
|
| 356 |
if( !empty( $ItemAttributes ) )
|
| 357 |
$ItemAttributes .= "|";
|
| 358 |
$ItemAttributes .= "Inventory=".$this->_formatQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
|
| 359 |
}
|
| 360 |
+
if( $this->publishtieredpricing == "1" ){
|
| 361 |
+
$TierPriceAttributes = $this->_getTierPrices( $UsedProduct );
|
| 362 |
+
$sp = ( empty( $ItemAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 363 |
+
$ItemAttributes .= $sp.$TierPriceAttributes;
|
| 364 |
+
}
|
| 365 |
$RPrice = $this->_formatPrice( $RPrice );
|
| 366 |
if( $this->includespecialprice ){
|
| 367 |
if( $SPrice >= 0 ){
|
| 486 |
}
|
| 487 |
}
|
| 488 |
}
|
| 489 |
+
if( $this->publishtieredpricing == "1" ){
|
| 490 |
$TierPriceAttributes = $this->_getTierPrices($product);
|
| 491 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 492 |
$ProductAttributes.= $sp.$TierPriceAttributes;
|
| 529 |
$ProdSPrice = $product->getSpecialPrice();
|
| 530 |
$ProdSFromDate = $product->getSpecialFromDate();
|
| 531 |
$ProdSToDate = $product->getSpecialToDate();
|
| 532 |
+
if( $this->_DEBUG ) echo "prod prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
| 533 |
";
|
| 534 |
$ProdGroupPrices = FALSE;
|
| 535 |
$mageVersionArray = Mage::getVersionInfo();
|
| 559 |
$ProdSFromDate = FALSE;
|
| 560 |
$ProdSToDate = FALSE;
|
| 561 |
}
|
| 562 |
+
if( $this->_DEBUG ){
|
| 563 |
echo "used product IDs: ";
|
| 564 |
+
foreach( $UsedProductIds as $UsedProductid ) echo "".$UsedProductid." ";
|
| 565 |
echo "
|
| 566 |
";
|
| 567 |
}
|
| 571 |
}
|
| 572 |
$ConfigurableAttributes = $product->getTypeInstance( true )->getConfigurableAttributes( $product );
|
| 573 |
foreach( $ConfigurableAttributes as $attribute ){
|
| 574 |
+
// $attribute->setStoreId( $this->StoreId );
|
| 575 |
+
if( $this->_DEBUG ){
|
| 576 |
+
echo "configurable attr: ".$attribute->getLabel()."
|
| 577 |
+
";
|
| 578 |
+
}
|
| 579 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
| 580 |
if( empty( $configurableProdAttribute ) ){
|
| 581 |
$label = $attribute->getLabel();
|
| 583 |
";
|
| 584 |
continue;
|
| 585 |
}
|
| 586 |
+
$configurableProdAttribute->setStoreId( $this->StoreId );
|
| 587 |
+
if( $this->_DEBUG ){
|
| 588 |
+
echo "configurable prod attr: ".$configurableProdAttribute->getFrontend()->getLabel()."
|
| 589 |
";
|
| 590 |
}
|
| 591 |
+
$AttributeLabel = $attribute->getLabel();
|
| 592 |
+
if( !$AttributeLabel )
|
| 593 |
+
$AttributeLabel = $configurableProdAttribute->getFrontend()->getLabel();
|
| 594 |
if( $this->importoptionsasattributes ){
|
| 595 |
$usedConfigurableAttributes[ $AttributeLabel ] = array();
|
| 596 |
+
if( $this->_DEBUG ){
|
| 597 |
echo "created usedConfigurableAttributes array for \"".$AttributeLabel."\"
|
| 598 |
";
|
| 599 |
}
|
| 600 |
}
|
| 601 |
+
foreach( $configurableProdAttribute->getSource()->getAllOptions() as $option ) {
|
| 602 |
+
if( $this->_DEBUG ){
|
| 603 |
echo "variation option: ".$option['value' ]."=>".$option['label' ]."
|
| 604 |
";
|
| 605 |
}
|
| 606 |
if( $this->importoptionsasattributes ){
|
| 607 |
$usedConfigurableAttributes[ $AttributeLabel ][ $option['label' ] ] = FALSE;
|
| 608 |
+
if( $this->_DEBUG ){
|
| 609 |
echo "created usedConfigurableAttributes label \"".$option['label' ]."\"
|
| 610 |
";
|
| 611 |
}
|
| 620 |
$cpLines = array();
|
| 621 |
foreach( $UsedProducts as $UsedProductid => $UsedProduct ){
|
| 622 |
$cpLine = new ConfiguredProductLine();
|
| 623 |
+
if( $this->instockonly ){
|
| 624 |
+
$inventory = $this->catalogInventoryModel->loadByProduct( $UsedProduct );
|
| 625 |
+
$qty = $inventory->getQty();
|
| 626 |
+
$minQty = $inventory->getMinQty();
|
| 627 |
+
if( $this->_DEBUG ) echo "sku=".$UsedProduct->getSku()." qty=".$qty." minQty=".$minQty."
|
| 628 |
+
";
|
| 629 |
+
if( $qty <= $minQty )
|
| 630 |
+
continue;
|
| 631 |
+
}
|
| 632 |
+
if( $this->_DEBUG ) echo "sku=".$UsedProduct->getSku()." prices: Regular=".$UsedProduct->getData('price')." Final=".$UsedProduct->getFinalPrice()." Special=".$UsedProduct->getSpecialPrice()." FromDate=".$UsedProduct->getSpecialFromDate()." ToDate=".$UsedProduct->getSpecialToDate()."
|
| 633 |
";
|
| 634 |
$RPrice = $ProdRPrice;
|
| 635 |
$SPrice = $ProdSPrice;
|
| 636 |
$RPrice0 = $ProdRPrice;
|
| 637 |
$SPrice0 = $ProdSPrice;
|
| 638 |
+
$SFromDate = !empty( $SPrice ) ? $ProdSFromDate : FALSE;
|
| 639 |
+
$SToDate = !empty( $SPrice ) ? $ProdSToDate : FALSE;
|
| 640 |
$SpecGroupPrices = FALSE;
|
| 641 |
$SpecGroupPrices0 = FALSE;
|
| 642 |
if( $ProdSpecGroupPrices ){
|
| 659 |
continue;
|
| 660 |
}
|
| 661 |
$AttributeCode = $configurableProdAttribute->getAttributeCode();
|
| 662 |
+
$AttributeLabel = $attribute->getLabel();
|
| 663 |
+
if( !$AttributeLabel )
|
| 664 |
+
$AttributeLabel = $configurableProdAttribute->getFrontend()->getLabel();
|
| 665 |
$AttribId = $UsedProduct->getData($AttributeCode);
|
| 666 |
$cpLine->optionIds[] = intVal( $AttribId );
|
| 667 |
$AttributeValue = "";
|
| 668 |
+
foreach( $configurableProdAttribute->getSource()->getAllOptions() as $option ){
|
| 669 |
if( $option['value'] == $AttribId ){
|
| 670 |
$AttributeValue = $option['label'];
|
| 671 |
break;
|
| 674 |
if( $this->importoptionsasattributes && trim( $AttributeValue ) ){
|
| 675 |
$usedConfigurableAttributes[ $AttributeLabel ][ $AttributeValue ] = TRUE;
|
| 676 |
}
|
| 677 |
+
if( $this->_DEBUG ) echo "config attr code=".$AttributeCode." label=".$AttributeLabel." id=".$AttribId." value=".$AttributeValue."
|
| 678 |
";
|
| 679 |
if( !empty( $ItemAttributes ) )
|
| 680 |
$ItemAttributes .= "|";
|
| 695 |
if( $SPrice >= 0 )
|
| 696 |
$SPrice += $addedPrice['pricing_value'];
|
| 697 |
if( $SpecGroupPrices ){
|
| 698 |
+
foreach( $SpecGroupPrices0 as $key => $value )
|
| 699 |
$SpecGroupPrices[ $key ] += $addedPrice['pricing_value'];
|
|
|
|
| 700 |
}
|
| 701 |
}
|
| 702 |
}
|
| 711 |
$ItemAttributes .= "|";
|
| 712 |
$ItemAttributes .= "Inventory=".$this->_formatQty( "".$this->catalogInventoryModel->loadByProduct( $UsedProduct )->getQty() );
|
| 713 |
}
|
| 714 |
+
if( $this->_DEBUG ) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$SFromDate." ToDate=".$SToDate."
|
| 715 |
";
|
| 716 |
$RPrice = $this->_formatPrice( $RPrice );
|
| 717 |
if( $this->includespecialprice ){
|
| 745 |
$ItemAttributes .= "price_".$this->customerGroups[ $groupID ]."=".$this->_formatPrice( $price );
|
| 746 |
}
|
| 747 |
}
|
| 748 |
+
if( $this->ignoreassprodimages ) $itemImages = "";
|
| 749 |
else{
|
| 750 |
// echo "config item image: ".$UsedProduct->getImage()."
|
| 751 |
//small image: ".$UsedProduct->getSmallImage()."
|
| 791 |
foreach( $ConfigurableAttributes as $attribute ){
|
| 792 |
$configurableProdAttribute = $attribute->getProductAttribute();
|
| 793 |
$optionIdLine = array();
|
| 794 |
+
foreach( $configurableProdAttribute->getSource()->getAllOptions() as $option )
|
| 795 |
$optionIdLine[] = trim( $option['value'] ) == "" ? 0 : intVal( $option['value'] );
|
| 796 |
$optionIds[] = $optionIdLine;
|
| 797 |
$attrNumberNo++;
|
| 811 |
//";
|
| 812 |
// supplement prod attrs
|
| 813 |
if( $this->importoptionsasattributes ){
|
| 814 |
+
foreach( $usedConfigurableAttributes as $attrName => $attrValues ){
|
| 815 |
if( !empty( $ProductAttributes ) )
|
| 816 |
$ProductAttributes .= "|";
|
| 817 |
$ProductAttributes .= $attrName."=";
|
| 818 |
$valCount = 0;
|
| 819 |
+
foreach( $attrValues as $attrValue => $used ){
|
| 820 |
if( $used ){
|
| 821 |
+
if( $valCount > 0 )
|
| 822 |
$ProductAttributes .= "<br />";
|
|
|
|
| 823 |
$ProductAttributes .= $attrValue;
|
| 824 |
$valCount++;
|
| 825 |
}
|
| 914 |
if( $firstImageFile )
|
| 915 |
$prodImages[] = "MagentoBase#=#".$this->prodmediaurl.$firstImageFile;
|
| 916 |
$prodImageArray = $product->getMediaGallery('images');
|
| 917 |
+
if( is_array( $prodImageArray ) ){
|
| 918 |
foreach( $prodImageArray as $image ){
|
| 919 |
$imageFile = trim( $image['file'] );
|
| 920 |
// echo "gallery image: ".$imageFile." disabled=".$image['disabled']."
|
| 937 |
$ProductAttributes = "";
|
| 938 |
foreach( $attributes as $attribute ){
|
| 939 |
$attribute->setStoreId( $this->StoreId );
|
| 940 |
+
if( $this->_DEBUG && ( $attribute->getFrontendInput() == "select" || $attribute->getFrontendInput() == "multiselect" ) ){
|
| 941 |
$hasData = $product->getData($attribute->getAttributeCode()) ? "YES" : "NO";
|
| 942 |
echo "simple prod attr: ".$attribute->getFrontend()->getLabel()."=".$attribute->getFrontend()->getValue( $product )." input=".$attribute->getFrontendInput()." data=".$product->getData($attribute->getAttributeCode())." hasData=".$hasData." store=".$product->_storeId."
|
| 943 |
";
|
| 964 |
}
|
| 965 |
}
|
| 966 |
}
|
| 967 |
+
if( $this->publishtieredpricing == "1" ){
|
| 968 |
$TierPriceAttributes = $this->_getTierPrices( $product );
|
| 969 |
$sp = ( empty( $ProductAttributes ) || empty( $TierPriceAttributes ) ) ? "" : "|";
|
| 970 |
$ProductAttributes.= $sp.$TierPriceAttributes;
|
| 975 |
$ProdSPrice = $product->getSpecialPrice();
|
| 976 |
$ProdSFromDate = $product->getSpecialFromDate();
|
| 977 |
$ProdSToDate = $product->getSpecialToDate();
|
| 978 |
+
if( $this->instockonly ){
|
| 979 |
+
$inventory = $this->catalogInventoryModel->loadByProduct( $product );
|
| 980 |
+
$qty = $inventory->getQty();
|
| 981 |
+
$minQty = $inventory->getMinQty();
|
| 982 |
+
if( $this->_DEBUG ) echo "sku=".$product->getSku()." qty=".$qty." minQty=".$minQty."
|
| 983 |
+
";
|
| 984 |
+
if( $qty <= $minQty )
|
| 985 |
+
return;
|
| 986 |
+
}
|
| 987 |
+
if( $this->_DEBUG ) echo "sku=".$product->getSku()." prices: Regular=".$ProdRPrice." Special=".$ProdSPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
| 988 |
";
|
| 989 |
$ProdGroupPrices = FALSE;
|
| 990 |
$mageVersionArray = Mage::getVersionInfo();
|
| 1020 |
foreach( $options as $option ){
|
| 1021 |
$selection = $option->getDefaultSelection();
|
| 1022 |
$MinSelPrice = 0;
|
| 1023 |
+
if( $selection )
|
| 1024 |
$MinSelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
|
| 1025 |
+
else if( !$selection && $option->_origData["required"] == "1" ){
|
| 1026 |
foreach( $option->getSelections() as $selection ){
|
| 1027 |
$SelPrice = $priceModel->getSelectionPreFinalPrice( $product, $selection, $selection->getSelectionQty() );
|
| 1028 |
if( ( $MinSelPrice == 0 && $SelPrice > 0 ) || ( $MinSelPrice > 0 && $SelPrice > 0 && $SelPrice < $MinSelPrice ) )
|
| 1044 |
$SPrice = $ProdSPrice;
|
| 1045 |
if( $SPrice >= 0 && $this->includetaxes )
|
| 1046 |
$SPrice = $this->taxhelper->getPrice( $product, $SPrice, true );
|
| 1047 |
+
if( $this->_DEBUG ) echo "resulting prices: Regular=".$RPrice." Special=".$SPrice." FromDate=".$ProdSFromDate." ToDate=".$ProdSToDate."
|
| 1048 |
";
|
| 1049 |
$ItemAttributes = "";
|
| 1050 |
if( $this->includeinvqty )
|
| 1156 |
}
|
| 1157 |
|
| 1158 |
private function _formatPrice( $Price ){
|
| 1159 |
+
$v = 0.0;
|
| 1160 |
+
if( is_string( $Price ) ){
|
| 1161 |
+
$rv = str_replace("\n"," ", str_replace("\r"," ", str_replace("\r\n"," ", str_replace("\t"," ", $Price ) ) ) );
|
| 1162 |
+
if( empty( $rv ) || $rv == "0" )
|
| 1163 |
+
return "";
|
| 1164 |
+
$v = floatval( $Price );
|
| 1165 |
+
} else if( is_float( $Price ) ) {
|
| 1166 |
+
$v = $Price;
|
| 1167 |
+
} else {
|
| 1168 |
+
$v = floatval( $Price );
|
| 1169 |
+
}
|
| 1170 |
+
if( $v <= 0 ){
|
| 1171 |
return "";
|
| 1172 |
+
}
|
| 1173 |
+
$v100 = $v * 100;
|
| 1174 |
+
$iv100 = intval( $v100 );
|
| 1175 |
+
if( $v100 - $iv100 >= 0.5 )
|
| 1176 |
+
$iv100 = $iv100 + 1;
|
| 1177 |
+
$rv = strval( floatval( $iv100 ) / 100 );
|
| 1178 |
$tail = strrchr( $rv, "." );
|
| 1179 |
if( !empty( $tail ) && strlen( $tail ) > 3 )
|
| 1180 |
$rv = substr( $rv, 0, strlen( $rv ) - ( strlen( $tail ) - 3 ) );
|
| 1181 |
+
else if( !empty( $tail ) && strlen( $tail ) == 2 )
|
| 1182 |
+
$rv = $rv."0";
|
| 1183 |
+
else if( !empty( $tail ) && strlen( $tail ) == 1 )
|
| 1184 |
+
$rv = $rv."00";
|
| 1185 |
else if( !$tail )
|
| 1186 |
$rv = $rv.".00";
|
| 1187 |
return $rv;
|
| 1239 |
->addAttributeToSort('position', 'asc');
|
| 1240 |
$i = 1;
|
| 1241 |
$count = count( $categories );
|
| 1242 |
+
if( $this->_DEBUG ) echo "StoreId: ".$this->StoreId." Top categories: ".$count."
|
| 1243 |
";
|
| 1244 |
echo "sec_Project\tsec_Sequence\tsec_HierarchyPath\tsec_Flag\n";
|
| 1245 |
if( $count > 0 ){
|
| 1246 |
+
if( $this->ignoretopcategory ){
|
| 1247 |
foreach( $categories as $topcategory ){
|
| 1248 |
$children = $topcategory->getCollection();
|
| 1249 |
$children->setStoreId( $this->StoreId )
|
| 1252 |
->addAttributeToSort('position', 'asc')
|
| 1253 |
->addIdFilter($topcategory->getChildren())
|
| 1254 |
->load();
|
| 1255 |
+
foreach( $children as $category ){
|
| 1256 |
$name = $category->getName();
|
| 1257 |
$id = $category->getId();
|
| 1258 |
echo $this->_drawCategory( $category, 1, $name, $i );
|
| 1298 |
$htmlChildren = "";
|
| 1299 |
if( count( $children ) ){
|
| 1300 |
$j = 1;
|
| 1301 |
+
foreach( $children as $cat ){
|
| 1302 |
$htmlChildren .= $this->_drawCategory( $cat, $level + 1, $hpath, $i, $j, $path );
|
| 1303 |
$j++;
|
| 1304 |
}
|
| 1318 |
->addAttributeToFilter('is_active', array('eq' => 1))
|
| 1319 |
->addAttributeToSort('position', 'asc');
|
| 1320 |
$count = count( $categories );
|
| 1321 |
+
if( $this->_DEBUG ) echo "StoreId: ".$this->StoreId." Top categories: ".$count."
|
| 1322 |
";
|
| 1323 |
if( $count > 0 ){
|
| 1324 |
$hpath = "";
|
| 1325 |
+
if( $this->ignoretopcategory ){
|
| 1326 |
foreach( $categories as $topcategory ){
|
| 1327 |
$children = $topcategory->getCollection();
|
| 1328 |
$children->setStoreId( $this->StoreId )
|
| 1331 |
->addAttributeToSort('position', 'asc')
|
| 1332 |
->addIdFilter($topcategory->getChildren())
|
| 1333 |
->load();
|
| 1334 |
+
foreach( $children as $category ){
|
| 1335 |
$this->catmap[ $category->getId() ] = $category;
|
| 1336 |
$this->_processCategory( $category, 1, $hpath );
|
| 1337 |
}
|
| 1350 |
$products->addAttributeToFilter('status', 1);//enabled
|
| 1351 |
$products->addAttributeToFilter('visibility', 4);//catalog, search
|
| 1352 |
$prodIds = $this->_DEBUG ? $products->getAllIds(1000,0) : $products->getAllIds();
|
| 1353 |
+
if( $this->_DEBUG ) echo "StoreId: ".$this->StoreId."
|
| 1354 |
Products: ".count( $prodIds )."
|
| 1355 |
";
|
| 1356 |
$count = 0;
|
| 1371 |
$product = Mage::getModel('catalog/product')->setStoreId( $this->StoreId )->load( $productId );
|
| 1372 |
echo $product->isConfigurable() ? $this->CatalogProjectStringConfigurable( $product ) : $this->CatalogProjectStringSimple( $product );
|
| 1373 |
unset( $product );
|
| 1374 |
+
if( $this->_DEBUG ) echo "#".$count.": memory_get_usage ".memory_get_usage()." / ".memory_get_usage(TRUE)."
|
| 1375 |
";
|
| 1376 |
$count++;
|
| 1377 |
}
|
| 1381 |
private function _processCategory( &$category, $level=0, $hpath='', $path='' ){
|
| 1382 |
$hpath = $level != 1 ? $hpath.'#$#'.$category->getName() : $hpath = $category->getName();
|
| 1383 |
$this->catpathmap[ $category->getId() ] = $hpath;
|
| 1384 |
+
if( $this->_DEBUG ) echo "Category: ".$category->getId()." path=".$hpath."
|
| 1385 |
";
|
| 1386 |
$children = $category->getCollection();
|
| 1387 |
$children->setStoreId( $this->StoreId )
|
| 1391 |
->addIdFilter($category->getChildren())
|
| 1392 |
->load();
|
| 1393 |
$htmlChildren = "";
|
| 1394 |
+
if( count( $children ) ) foreach( $children as $childcategory ){
|
| 1395 |
$this->catmap[ $childcategory->getId() ] = $childcategory;
|
| 1396 |
$htmlChildren .= $this->_processCategory( $childcategory, $level + 1, $hpath, $path );
|
| 1397 |
}
|
| 1404 |
if( $categoryIds ){
|
| 1405 |
foreach( $categoryIds as $k => $category_id ){
|
| 1406 |
if( !isset( $this->catmap[ $category_id ] ) ){
|
| 1407 |
+
if( $this->_DEBUG ) echo "No category: ".$category_id."
|
| 1408 |
";
|
| 1409 |
continue;
|
| 1410 |
}
|
| 1451 |
if( $categoryIds ){
|
| 1452 |
foreach( $categoryIds as $k => $category_id ){
|
| 1453 |
if( !isset( $this->catmap[ $category_id ] ) ){
|
| 1454 |
+
if( $this->_DEBUG ) echo "No category: ".$category_id."
|
| 1455 |
";
|
| 1456 |
continue;
|
| 1457 |
}
|
app/code/community/Mage/CodiScript/controllers/IndexController.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
define("__VERSION__","2014-
|
| 3 |
define("__SCRIPTNAME__",basename(__FILE__));
|
| 4 |
|
| 5 |
class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
|
|
@@ -30,7 +30,7 @@ function myErrorHandler($errno,$errstr,$errfile,$errline){
|
|
| 30 |
}
|
| 31 |
// Set an error handler for warnings and notices.
|
| 32 |
set_error_handler('myErrorHandler');
|
| 33 |
-
if($_DEBUG || $_INFO){
|
| 34 |
$started_time = time();
|
| 35 |
echo "PHP version: ".phpversion()."
|
| 36 |
Magento version: ".Mage::getVersion()."
|
|
@@ -38,7 +38,7 @@ Script version: ".__VERSION__."
|
|
| 38 |
--------------------------------------------------------------------------------
|
| 39 |
";
|
| 40 |
}
|
| 41 |
-
if($_DEBUG)
|
| 42 |
Password=".$Password."
|
| 43 |
";
|
| 44 |
$codiScriptPassword = Mage::helper('codiscript')->getCodiPassword();
|
|
@@ -77,10 +77,11 @@ if( $Class=="DataFile" ){
|
|
| 77 |
$includecustomfields[ strtolower( $part ) ] = TRUE;
|
| 78 |
}
|
| 79 |
}
|
| 80 |
-
$importoptionsasattributes = ( isset($_REQUEST["importoptionsasattributes"]) && $_REQUEST["importoptionsasattributes"] == "1" );
|
| 81 |
-
$
|
| 82 |
-
$
|
| 83 |
-
|
|
|
|
| 84 |
ignoretopcategory=".$ignoretopcategory."
|
| 85 |
includeshortdescription=".$includeshortdescription."
|
| 86 |
includelongdescription=".$includelongdescription."
|
|
@@ -98,18 +99,23 @@ ignoreexcludedimages=".$ignoreexcludedimages."
|
|
| 98 |
ignoreassprodimages=".$ignoreassprodimages."
|
| 99 |
includecustomfields=".( $includecustomfields ? implode( ",", array_keys( $includecustomfields ) ) : $includecustomfields )."
|
| 100 |
importoptionsasattributes=".$importoptionsasattributes."
|
|
|
|
| 101 |
start=".$start."
|
| 102 |
pageSize=".$pageSize."
|
| 103 |
";
|
| 104 |
-
}else if( $Class=="CatalogSection" ){
|
| 105 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
| 106 |
if($_DEBUG) echo "ignoretopcategory=".$ignoretopcategory."
|
| 107 |
";
|
| 108 |
-
}else if( $Class=="CatalogProject" ){
|
| 109 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
|
|
|
| 110 |
$start = isset($_REQUEST["start"]) ? intval( $_REQUEST["start"] ) : 0;
|
| 111 |
$pageSize = isset($_REQUEST["pageSize"]) ? intval( $_REQUEST["pageSize"] ) : 1000000000;
|
| 112 |
if($_DEBUG) echo "ignoretopcategory=".$ignoretopcategory."
|
|
|
|
|
|
|
|
|
|
| 113 |
";
|
| 114 |
}
|
| 115 |
// Increase memory limit to 1024M
|
|
@@ -159,7 +165,7 @@ else if( !empty( $StoreCode ) ){
|
|
| 159 |
die( "ERROR: No active stores.");
|
| 160 |
}
|
| 161 |
$cfModel = Mage::getModel('codiscript/files');
|
| 162 |
-
if($Class=="DataFile"){
|
| 163 |
$cfModel->enablereviews = $enablereviews;
|
| 164 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
| 165 |
$cfModel->includeshortdescription = $includeshortdescription;
|
|
@@ -178,24 +184,26 @@ if($Class=="DataFile"){
|
|
| 178 |
$cfModel->ignoreassprodimages = $ignoreassprodimages;
|
| 179 |
$cfModel->includecustomfields = $includecustomfields;
|
| 180 |
$cfModel->importoptionsasattributes = $importoptionsasattributes;
|
|
|
|
| 181 |
$cfModel->start = $start;
|
| 182 |
$cfModel->pageSize = $pageSize;
|
| 183 |
if($cfModel->includetaxes)
|
| 184 |
$cfModel->taxhelper=Mage::helper('tax');
|
| 185 |
-
}else if( $Class=="CatalogSection" ){
|
| 186 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
| 187 |
-
}else if( $Class=="CatalogProject" ){
|
| 188 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
|
|
|
| 189 |
$cfModel->start = $start;
|
| 190 |
$cfModel->pageSize = $pageSize;
|
| 191 |
}
|
| 192 |
$cfModel->_DEBUG = $_DEBUG;
|
| 193 |
$cfModel->StoreId = $StoreId;
|
| 194 |
$cfModel->Store = $Store;
|
| 195 |
-
if($Class=="DataFile") $cfModel->renderDataFile();
|
| 196 |
-
else if($Class=="CatalogSection") $cfModel->renderCatalogSection();
|
| 197 |
-
else if($Class=="CatalogProject") $cfModel->renderCatalogProject();
|
| 198 |
-
else if($_DEBUG){
|
| 199 |
foreach ( Mage::app()->getStores() as $store ){
|
| 200 |
echo "store: ".$store->getId()." code=".$store->getCode()." name=".$store->getName()." isActive=".$store->getIsActive()."
|
| 201 |
website=".$store->getWebsite()."
|
|
@@ -217,11 +225,23 @@ memory_limit=".ini_get("memory_limit")."
|
|
| 217 |
} else {
|
| 218 |
echo "==EOF==";
|
| 219 |
}
|
| 220 |
-
if($_DEBUG) echo "
|
| 221 |
executed in ".( time() - $started_time )." sec.
|
| 222 |
";
|
| 223 |
die();
|
| 224 |
/* RELEASE NOTES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
* 2014-08-06
|
| 226 |
* 1. Added importoptionsasattributes option / processing
|
| 227 |
*
|
| 1 |
<?php
|
| 2 |
+
define("__VERSION__","2014-11-10");
|
| 3 |
define("__SCRIPTNAME__",basename(__FILE__));
|
| 4 |
|
| 5 |
class Mage_CodiScript_IndexController extends Mage_Core_Controller_Front_Action{
|
| 30 |
}
|
| 31 |
// Set an error handler for warnings and notices.
|
| 32 |
set_error_handler('myErrorHandler');
|
| 33 |
+
if( $_DEBUG || $_INFO ){
|
| 34 |
$started_time = time();
|
| 35 |
echo "PHP version: ".phpversion()."
|
| 36 |
Magento version: ".Mage::getVersion()."
|
| 38 |
--------------------------------------------------------------------------------
|
| 39 |
";
|
| 40 |
}
|
| 41 |
+
if( $_DEBUG ) echo "Class=".$Class."
|
| 42 |
Password=".$Password."
|
| 43 |
";
|
| 44 |
$codiScriptPassword = Mage::helper('codiscript')->getCodiPassword();
|
| 77 |
$includecustomfields[ strtolower( $part ) ] = TRUE;
|
| 78 |
}
|
| 79 |
}
|
| 80 |
+
$importoptionsasattributes = ( isset( $_REQUEST["importoptionsasattributes"] ) && $_REQUEST["importoptionsasattributes"] == "1" );
|
| 81 |
+
$instockonly = isset($_REQUEST["instockonly"])? trim( $_REQUEST["instockonly"] ) : FALSE;
|
| 82 |
+
$start = isset( $_REQUEST["start"] ) ? intval( $_REQUEST["start"] ) : 0;
|
| 83 |
+
$pageSize = isset( $_REQUEST["pageSize"] ) ? intval( $_REQUEST["pageSize"] ) : 1000000000;
|
| 84 |
+
if( $_DEBUG ) echo "enablereviews=".$enablereviews."
|
| 85 |
ignoretopcategory=".$ignoretopcategory."
|
| 86 |
includeshortdescription=".$includeshortdescription."
|
| 87 |
includelongdescription=".$includelongdescription."
|
| 99 |
ignoreassprodimages=".$ignoreassprodimages."
|
| 100 |
includecustomfields=".( $includecustomfields ? implode( ",", array_keys( $includecustomfields ) ) : $includecustomfields )."
|
| 101 |
importoptionsasattributes=".$importoptionsasattributes."
|
| 102 |
+
instockonly=".$instockonly."
|
| 103 |
start=".$start."
|
| 104 |
pageSize=".$pageSize."
|
| 105 |
";
|
| 106 |
+
} else if( $Class=="CatalogSection" ){
|
| 107 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
| 108 |
if($_DEBUG) echo "ignoretopcategory=".$ignoretopcategory."
|
| 109 |
";
|
| 110 |
+
} else if( $Class=="CatalogProject" ){
|
| 111 |
$ignoretopcategory = ( isset($_REQUEST["ignoretopcategory"]) && $_REQUEST["ignoretopcategory"] == "1" );
|
| 112 |
+
$instockonly = isset($_REQUEST["instockonly"])? trim( $_REQUEST["instockonly"] ) : FALSE;
|
| 113 |
$start = isset($_REQUEST["start"]) ? intval( $_REQUEST["start"] ) : 0;
|
| 114 |
$pageSize = isset($_REQUEST["pageSize"]) ? intval( $_REQUEST["pageSize"] ) : 1000000000;
|
| 115 |
if($_DEBUG) echo "ignoretopcategory=".$ignoretopcategory."
|
| 116 |
+
instockonly=".$instockonly."
|
| 117 |
+
start=".$start."
|
| 118 |
+
pageSize=".$pageSize."
|
| 119 |
";
|
| 120 |
}
|
| 121 |
// Increase memory limit to 1024M
|
| 165 |
die( "ERROR: No active stores.");
|
| 166 |
}
|
| 167 |
$cfModel = Mage::getModel('codiscript/files');
|
| 168 |
+
if( $Class=="DataFile" ){
|
| 169 |
$cfModel->enablereviews = $enablereviews;
|
| 170 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
| 171 |
$cfModel->includeshortdescription = $includeshortdescription;
|
| 184 |
$cfModel->ignoreassprodimages = $ignoreassprodimages;
|
| 185 |
$cfModel->includecustomfields = $includecustomfields;
|
| 186 |
$cfModel->importoptionsasattributes = $importoptionsasattributes;
|
| 187 |
+
$cfModel->instockonly = $instockonly;
|
| 188 |
$cfModel->start = $start;
|
| 189 |
$cfModel->pageSize = $pageSize;
|
| 190 |
if($cfModel->includetaxes)
|
| 191 |
$cfModel->taxhelper=Mage::helper('tax');
|
| 192 |
+
} else if( $Class=="CatalogSection" ){
|
| 193 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
| 194 |
+
} else if( $Class=="CatalogProject" ){
|
| 195 |
$cfModel->ignoretopcategory = $ignoretopcategory;
|
| 196 |
+
$cfModel->instockonly = $instockonly;
|
| 197 |
$cfModel->start = $start;
|
| 198 |
$cfModel->pageSize = $pageSize;
|
| 199 |
}
|
| 200 |
$cfModel->_DEBUG = $_DEBUG;
|
| 201 |
$cfModel->StoreId = $StoreId;
|
| 202 |
$cfModel->Store = $Store;
|
| 203 |
+
if( $Class=="DataFile" ) $cfModel->renderDataFile();
|
| 204 |
+
else if( $Class=="CatalogSection" ) $cfModel->renderCatalogSection();
|
| 205 |
+
else if( $Class=="CatalogProject" ) $cfModel->renderCatalogProject();
|
| 206 |
+
else if( $_DEBUG ){
|
| 207 |
foreach ( Mage::app()->getStores() as $store ){
|
| 208 |
echo "store: ".$store->getId()." code=".$store->getCode()." name=".$store->getName()." isActive=".$store->getIsActive()."
|
| 209 |
website=".$store->getWebsite()."
|
| 225 |
} else {
|
| 226 |
echo "==EOF==";
|
| 227 |
}
|
| 228 |
+
if( $_DEBUG ) echo "
|
| 229 |
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 |
+
*
|
| 236 |
+
* 2014-10-17
|
| 237 |
+
* 1. Improved configurable product item attribute export
|
| 238 |
+
*
|
| 239 |
+
* 2014-10-12
|
| 240 |
+
* 1. Improved price formatting (added proper "rounding half up")
|
| 241 |
+
*
|
| 242 |
+
* 2014-08-22
|
| 243 |
+
* 1. publishtieredpricing causes retrieval of tier prices for individual products within a group product
|
| 244 |
+
*
|
| 245 |
* 2014-08-06
|
| 246 |
* 1. Added importoptionsasattributes option / processing
|
| 247 |
*
|
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>2014-
|
| 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.7</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-11-14</date>
|
| 14 |
+
<time>01:20:20</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="e336222b0b90262c55d468ceb39c41a6"/></dir><dir name="controllers"><file name="IndexController.php" hash="c1113301fcef400719e8f9596c94ddf9"/></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>
|
