How can get configurable product with associated products?Adding one associated product to multiple configurable products at onceApply configurable product categories to associated products?How to display status of associated product in configurable productsCreate invoice and shipment in magento via cron based on store view and order ageMagento CE 1.9.1 Configurable Products do not get their simple products 'associated'Multiple Taxes for different simple products associated with a single configurable productHow to redirect a associated product to its configurable productAssociated products with red backgroundHow to change dynamic attributes when simple product is selectedExport Category name in xml feed Magento 1.9.2

Short story about space worker geeks who zone out by 'listening' to radiation from stars

Roman Numeral Treatment of Suspensions

Two monoidal structures and copowering

Sort a list by elements of another list

Why escape if the_content isnt?

How does buying out courses with grant money work?

Pole-zeros of a real-valued causal FIR system

Detecting if an element is found inside a container

Risk of infection at the gym?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

How do we know the LHC results are robust?

Large drywall patch supports

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

Different result between scanning in Epson's "color negative film" mode and scanning in positive -> invert curve in post?

Go Pregnant or Go Home

How to pronounce the slash sign

Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?

Is there a korbon needed for conversion?

Is this apparent Class Action settlement a spam message?

What is paid subscription needed for in Mortal Kombat 11?

Is a stroke of luck acceptable after a series of unfavorable events?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

How do scammers retract money, while you can’t?



How can get configurable product with associated products?


Adding one associated product to multiple configurable products at onceApply configurable product categories to associated products?How to display status of associated product in configurable productsCreate invoice and shipment in magento via cron based on store view and order ageMagento CE 1.9.1 Configurable Products do not get their simple products 'associated'Multiple Taxes for different simple products associated with a single configurable productHow to redirect a associated product to its configurable productAssociated products with red backgroundHow to change dynamic attributes when simple product is selectedExport Category name in xml feed Magento 1.9.2













0















I want to get configurable product with associated my code is below when I try to get 2 0r 3 configuration product with associated not get configuration product related simple product properly suggest me how can possible?



<?php
error_reporting(0);
include("../app/Mage.php");
umask(0);
Mage::app();
$result_array = array();
$result_array_listproduct = array();
// $result_array_associated = array();
$product_collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->load();
foreach ($product_collection as $product)
$ids[] = $product->getId();

// echo "<pre>";
// print_r($ids);
// exit();
for($i=0;$ids[$i];$i++)
$_product = Mage::getModel('catalog/product')->load($ids[$i]);
echo $product_visi=$_product->getVisibility();

if($_product->getTypeId() == "configurable")

$result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
$result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
$result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
$result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
$result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
$result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
$result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
$result_array_listproduct["product_short_description"]=$product_short_description=$_product->getShortDescription(); //product's short description
$result_array_listproduct["product_long_description"]=$product_long_description=htmlentities($_product->getDescription()); // product's long description
$result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
$result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
$result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
$result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();

//print_r($result_array_listproduct);

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product)
$result_array_listproduct["asociated"]["product_id"]= $simple_product->getId();
$result_array_listproduct["asociated"]["product_name"]=$simple_product->getName();
$result_array_listproduct["asociated"]["product_image"]=$simple_product->getImageUrl();
$result_array_listproduct["asociated"]["product_small_image"]=$simple_product->getSmallImageUrl();
$result_array_listproduct["asociated"]["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
$result_array_listproduct["asociated"]["product_regular_price"]=$simple_product->getPrice();
$result_array_listproduct["asociated"]["product_special_price"]=$simple_product->getSpecialPrice();
$result_array_listproduct["asociated"]["sku"]=$simple_product->getSku();
$result_array_listproduct["asociated"]["product_short_description"]=$simple_product->getShortDescription();
$result_array_listproduct["asociated"]["product_long_description"]=htmlentities($simple_product->getDescription());
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getStockItem()->getQty();
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getAttributeText('color');
$result_array_listproduct["asociated"]["product_type"]=$simple_product->getTypeId();
$result_array_listproduct["asociated"]["visibility"]= $simple_product->getVisibility();
//echo "<pre>";
//print_r($result_array_listproduct["asociated"]);

array_push($result_array_listproduct,$result_array_listproduct["asociated"]);




array_push($result_array, $result_array_listproduct);


echo "<pre>";
print_r($result_array);
?>









share|improve this question














bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Great work i have checked your given api :)

    – Vipin Kumar
    Aug 24 '18 at 11:01















0















I want to get configurable product with associated my code is below when I try to get 2 0r 3 configuration product with associated not get configuration product related simple product properly suggest me how can possible?



<?php
error_reporting(0);
include("../app/Mage.php");
umask(0);
Mage::app();
$result_array = array();
$result_array_listproduct = array();
// $result_array_associated = array();
$product_collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->load();
foreach ($product_collection as $product)
$ids[] = $product->getId();

// echo "<pre>";
// print_r($ids);
// exit();
for($i=0;$ids[$i];$i++)
$_product = Mage::getModel('catalog/product')->load($ids[$i]);
echo $product_visi=$_product->getVisibility();

if($_product->getTypeId() == "configurable")

$result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
$result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
$result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
$result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
$result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
$result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
$result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
$result_array_listproduct["product_short_description"]=$product_short_description=$_product->getShortDescription(); //product's short description
$result_array_listproduct["product_long_description"]=$product_long_description=htmlentities($_product->getDescription()); // product's long description
$result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
$result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
$result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
$result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();

//print_r($result_array_listproduct);

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product)
$result_array_listproduct["asociated"]["product_id"]= $simple_product->getId();
$result_array_listproduct["asociated"]["product_name"]=$simple_product->getName();
$result_array_listproduct["asociated"]["product_image"]=$simple_product->getImageUrl();
$result_array_listproduct["asociated"]["product_small_image"]=$simple_product->getSmallImageUrl();
$result_array_listproduct["asociated"]["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
$result_array_listproduct["asociated"]["product_regular_price"]=$simple_product->getPrice();
$result_array_listproduct["asociated"]["product_special_price"]=$simple_product->getSpecialPrice();
$result_array_listproduct["asociated"]["sku"]=$simple_product->getSku();
$result_array_listproduct["asociated"]["product_short_description"]=$simple_product->getShortDescription();
$result_array_listproduct["asociated"]["product_long_description"]=htmlentities($simple_product->getDescription());
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getStockItem()->getQty();
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getAttributeText('color');
$result_array_listproduct["asociated"]["product_type"]=$simple_product->getTypeId();
$result_array_listproduct["asociated"]["visibility"]= $simple_product->getVisibility();
//echo "<pre>";
//print_r($result_array_listproduct["asociated"]);

array_push($result_array_listproduct,$result_array_listproduct["asociated"]);




array_push($result_array, $result_array_listproduct);


echo "<pre>";
print_r($result_array);
?>









share|improve this question














bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Great work i have checked your given api :)

    – Vipin Kumar
    Aug 24 '18 at 11:01













0












0








0








I want to get configurable product with associated my code is below when I try to get 2 0r 3 configuration product with associated not get configuration product related simple product properly suggest me how can possible?



<?php
error_reporting(0);
include("../app/Mage.php");
umask(0);
Mage::app();
$result_array = array();
$result_array_listproduct = array();
// $result_array_associated = array();
$product_collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->load();
foreach ($product_collection as $product)
$ids[] = $product->getId();

// echo "<pre>";
// print_r($ids);
// exit();
for($i=0;$ids[$i];$i++)
$_product = Mage::getModel('catalog/product')->load($ids[$i]);
echo $product_visi=$_product->getVisibility();

if($_product->getTypeId() == "configurable")

$result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
$result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
$result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
$result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
$result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
$result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
$result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
$result_array_listproduct["product_short_description"]=$product_short_description=$_product->getShortDescription(); //product's short description
$result_array_listproduct["product_long_description"]=$product_long_description=htmlentities($_product->getDescription()); // product's long description
$result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
$result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
$result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
$result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();

//print_r($result_array_listproduct);

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product)
$result_array_listproduct["asociated"]["product_id"]= $simple_product->getId();
$result_array_listproduct["asociated"]["product_name"]=$simple_product->getName();
$result_array_listproduct["asociated"]["product_image"]=$simple_product->getImageUrl();
$result_array_listproduct["asociated"]["product_small_image"]=$simple_product->getSmallImageUrl();
$result_array_listproduct["asociated"]["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
$result_array_listproduct["asociated"]["product_regular_price"]=$simple_product->getPrice();
$result_array_listproduct["asociated"]["product_special_price"]=$simple_product->getSpecialPrice();
$result_array_listproduct["asociated"]["sku"]=$simple_product->getSku();
$result_array_listproduct["asociated"]["product_short_description"]=$simple_product->getShortDescription();
$result_array_listproduct["asociated"]["product_long_description"]=htmlentities($simple_product->getDescription());
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getStockItem()->getQty();
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getAttributeText('color');
$result_array_listproduct["asociated"]["product_type"]=$simple_product->getTypeId();
$result_array_listproduct["asociated"]["visibility"]= $simple_product->getVisibility();
//echo "<pre>";
//print_r($result_array_listproduct["asociated"]);

array_push($result_array_listproduct,$result_array_listproduct["asociated"]);




array_push($result_array, $result_array_listproduct);


echo "<pre>";
print_r($result_array);
?>









share|improve this question














I want to get configurable product with associated my code is below when I try to get 2 0r 3 configuration product with associated not get configuration product related simple product properly suggest me how can possible?



<?php
error_reporting(0);
include("../app/Mage.php");
umask(0);
Mage::app();
$result_array = array();
$result_array_listproduct = array();
// $result_array_associated = array();
$product_collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->load();
foreach ($product_collection as $product)
$ids[] = $product->getId();

// echo "<pre>";
// print_r($ids);
// exit();
for($i=0;$ids[$i];$i++)
$_product = Mage::getModel('catalog/product')->load($ids[$i]);
echo $product_visi=$_product->getVisibility();

if($_product->getTypeId() == "configurable")

$result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
$result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
$result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
$result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
$result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
$result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
$result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
$result_array_listproduct["product_short_description"]=$product_short_description=$_product->getShortDescription(); //product's short description
$result_array_listproduct["product_long_description"]=$product_long_description=htmlentities($_product->getDescription()); // product's long description
$result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
$result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
$result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
$result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();

//print_r($result_array_listproduct);

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product)
$result_array_listproduct["asociated"]["product_id"]= $simple_product->getId();
$result_array_listproduct["asociated"]["product_name"]=$simple_product->getName();
$result_array_listproduct["asociated"]["product_image"]=$simple_product->getImageUrl();
$result_array_listproduct["asociated"]["product_small_image"]=$simple_product->getSmallImageUrl();
$result_array_listproduct["asociated"]["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
$result_array_listproduct["asociated"]["product_regular_price"]=$simple_product->getPrice();
$result_array_listproduct["asociated"]["product_special_price"]=$simple_product->getSpecialPrice();
$result_array_listproduct["asociated"]["sku"]=$simple_product->getSku();
$result_array_listproduct["asociated"]["product_short_description"]=$simple_product->getShortDescription();
$result_array_listproduct["asociated"]["product_long_description"]=htmlentities($simple_product->getDescription());
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getStockItem()->getQty();
$result_array_listproduct["asociated"]["product_attribute"]=$simple_product->getAttributeText('color');
$result_array_listproduct["asociated"]["product_type"]=$simple_product->getTypeId();
$result_array_listproduct["asociated"]["visibility"]= $simple_product->getVisibility();
//echo "<pre>";
//print_r($result_array_listproduct["asociated"]);

array_push($result_array_listproduct,$result_array_listproduct["asociated"]);




array_push($result_array, $result_array_listproduct);


echo "<pre>";
print_r($result_array);
?>






magento-1.9 configurable-product associate-products






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 16 '16 at 9:04









Rahul PrajapatiRahul Prajapati

54




54





bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Great work i have checked your given api :)

    – Vipin Kumar
    Aug 24 '18 at 11:01

















  • Great work i have checked your given api :)

    – Vipin Kumar
    Aug 24 '18 at 11:01
















Great work i have checked your given api :)

– Vipin Kumar
Aug 24 '18 at 11:01





Great work i have checked your given api :)

– Vipin Kumar
Aug 24 '18 at 11:01










1 Answer
1






active

oldest

votes


















0














finally I got solution long time searching relate and code is below



error_reporting(0);
include("../app/Mage.php");
umask(0);
Mage::app();
$result_array = array();
$result_array_listproduct = array();
$result_array_associated = array();
$product_collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->load();
foreach ($product_collection as $product)
$ids[] = $product->getId();

// echo "<pre>";
// print_r($ids);
// exit();
for($i=0;$ids[$i];$i++)



$_product = Mage::getModel('catalog/product')->load($ids[$i]);

$product_visi=$_product->getVisibility();

if($product_visi == "4")

$result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
$result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
$result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
$result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
$result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
$result_array_listproduct["product_all_images"]=$product_all_image=array();


//$product = Mage::getModel('catalog/product')->load($_product->getId());
$images='';
foreach ($_product->getMediaGalleryImages() as $image)
$images[]=$image->getUrl();


array_push($result_array_listproduct["product_all_images"],$images);


$result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
$result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
$result_array_listproduct["sku"]=$sku=$_product->getSku();
$result_array_listproduct["product_short_description"]=$product_short_description=htmlentities(preg_replace('/"/',' ',$_product->getShortDescription())); //product's short description
$result_array_listproduct["product_long_description"]=$product_long_description=htmlentities(preg_replace('/"/',' ',$_product->getDescription())); // product's long description
$result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
$result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
$result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
$result_array_listproduct["product_status"]=$product_status=$product->getStatus();
$result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();
$result_array_listproduct["asociated"]= array();
//print_r($result_array_listproduct);

if($product_type=="configurable")
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product)
$result_array_associated["product_id"]= $simple_product->getId();
$result_array_associated["product_name"]=$simple_product->getName();
$result_array_associated["product_image"]=$simple_product->getImageUrl();
$result_array_associated["product_small_image"]=$simple_product->getSmallImageUrl();
$result_array_associated["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
$result_array_associated["product_regular_price"]=$simple_product->getPrice();
$result_array_associated["product_special_price"]=$simple_product->getSpecialPrice();
$result_array_associated["sku"]=$simple_product->getSku();
$result_array_associated["product_short_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getShortDescription()));
$result_array_associated["product_long_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getDescription()));
$result_array_associated["product_qty"]=$simple_product->getStockItem()->getQty();
$result_array_associated["product_attribute"]=$color=$simple_product->getAttributeText('color');
//$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute("color")->getSource()->getOptionId($color);
$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute(92)->getSource()->getOptionId($color);
$result_array_associated["product_type"]=$simple_product->getTypeId();
$result_array_associated["product_status"]=$simple_product->getStatus();
$result_array_associated["visibility"]= $simple_product->getVisibility();

//echo "<pre>";
//print_r($result_array_listproduct["asociated"]);

array_push($result_array_listproduct["asociated"],$result_array_associated);




array_push($result_array, $result_array_listproduct);



echo "<pre>";
print_r($result_array);
//echo json_encode($result_array);





share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f106495%2fhow-can-get-configurable-product-with-associated-products%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    finally I got solution long time searching relate and code is below



    error_reporting(0);
    include("../app/Mage.php");
    umask(0);
    Mage::app();
    $result_array = array();
    $result_array_listproduct = array();
    $result_array_associated = array();
    $product_collection = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect('*')
    ->load();
    foreach ($product_collection as $product)
    $ids[] = $product->getId();

    // echo "<pre>";
    // print_r($ids);
    // exit();
    for($i=0;$ids[$i];$i++)



    $_product = Mage::getModel('catalog/product')->load($ids[$i]);

    $product_visi=$_product->getVisibility();

    if($product_visi == "4")

    $result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
    $result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
    $result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
    $result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
    $result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
    $result_array_listproduct["product_all_images"]=$product_all_image=array();


    //$product = Mage::getModel('catalog/product')->load($_product->getId());
    $images='';
    foreach ($_product->getMediaGalleryImages() as $image)
    $images[]=$image->getUrl();


    array_push($result_array_listproduct["product_all_images"],$images);


    $result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
    $result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
    $result_array_listproduct["sku"]=$sku=$_product->getSku();
    $result_array_listproduct["product_short_description"]=$product_short_description=htmlentities(preg_replace('/"/',' ',$_product->getShortDescription())); //product's short description
    $result_array_listproduct["product_long_description"]=$product_long_description=htmlentities(preg_replace('/"/',' ',$_product->getDescription())); // product's long description
    $result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
    $result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
    $result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
    $result_array_listproduct["product_status"]=$product_status=$product->getStatus();
    $result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();
    $result_array_listproduct["asociated"]= array();
    //print_r($result_array_listproduct);

    if($product_type=="configurable")
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
    foreach($simple_collection as $simple_product)
    $result_array_associated["product_id"]= $simple_product->getId();
    $result_array_associated["product_name"]=$simple_product->getName();
    $result_array_associated["product_image"]=$simple_product->getImageUrl();
    $result_array_associated["product_small_image"]=$simple_product->getSmallImageUrl();
    $result_array_associated["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
    $result_array_associated["product_regular_price"]=$simple_product->getPrice();
    $result_array_associated["product_special_price"]=$simple_product->getSpecialPrice();
    $result_array_associated["sku"]=$simple_product->getSku();
    $result_array_associated["product_short_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getShortDescription()));
    $result_array_associated["product_long_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getDescription()));
    $result_array_associated["product_qty"]=$simple_product->getStockItem()->getQty();
    $result_array_associated["product_attribute"]=$color=$simple_product->getAttributeText('color');
    //$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute("color")->getSource()->getOptionId($color);
    $result_array_associated["option_id"]= $simple_product->getResource()->getAttribute(92)->getSource()->getOptionId($color);
    $result_array_associated["product_type"]=$simple_product->getTypeId();
    $result_array_associated["product_status"]=$simple_product->getStatus();
    $result_array_associated["visibility"]= $simple_product->getVisibility();

    //echo "<pre>";
    //print_r($result_array_listproduct["asociated"]);

    array_push($result_array_listproduct["asociated"],$result_array_associated);




    array_push($result_array, $result_array_listproduct);



    echo "<pre>";
    print_r($result_array);
    //echo json_encode($result_array);





    share|improve this answer



























      0














      finally I got solution long time searching relate and code is below



      error_reporting(0);
      include("../app/Mage.php");
      umask(0);
      Mage::app();
      $result_array = array();
      $result_array_listproduct = array();
      $result_array_associated = array();
      $product_collection = Mage::getResourceModel('catalog/product_collection')
      ->addAttributeToSelect('*')
      ->load();
      foreach ($product_collection as $product)
      $ids[] = $product->getId();

      // echo "<pre>";
      // print_r($ids);
      // exit();
      for($i=0;$ids[$i];$i++)



      $_product = Mage::getModel('catalog/product')->load($ids[$i]);

      $product_visi=$_product->getVisibility();

      if($product_visi == "4")

      $result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
      $result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
      $result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
      $result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
      $result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
      $result_array_listproduct["product_all_images"]=$product_all_image=array();


      //$product = Mage::getModel('catalog/product')->load($_product->getId());
      $images='';
      foreach ($_product->getMediaGalleryImages() as $image)
      $images[]=$image->getUrl();


      array_push($result_array_listproduct["product_all_images"],$images);


      $result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
      $result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
      $result_array_listproduct["sku"]=$sku=$_product->getSku();
      $result_array_listproduct["product_short_description"]=$product_short_description=htmlentities(preg_replace('/"/',' ',$_product->getShortDescription())); //product's short description
      $result_array_listproduct["product_long_description"]=$product_long_description=htmlentities(preg_replace('/"/',' ',$_product->getDescription())); // product's long description
      $result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
      $result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
      $result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
      $result_array_listproduct["product_status"]=$product_status=$product->getStatus();
      $result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();
      $result_array_listproduct["asociated"]= array();
      //print_r($result_array_listproduct);

      if($product_type=="configurable")
      $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
      $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
      foreach($simple_collection as $simple_product)
      $result_array_associated["product_id"]= $simple_product->getId();
      $result_array_associated["product_name"]=$simple_product->getName();
      $result_array_associated["product_image"]=$simple_product->getImageUrl();
      $result_array_associated["product_small_image"]=$simple_product->getSmallImageUrl();
      $result_array_associated["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
      $result_array_associated["product_regular_price"]=$simple_product->getPrice();
      $result_array_associated["product_special_price"]=$simple_product->getSpecialPrice();
      $result_array_associated["sku"]=$simple_product->getSku();
      $result_array_associated["product_short_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getShortDescription()));
      $result_array_associated["product_long_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getDescription()));
      $result_array_associated["product_qty"]=$simple_product->getStockItem()->getQty();
      $result_array_associated["product_attribute"]=$color=$simple_product->getAttributeText('color');
      //$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute("color")->getSource()->getOptionId($color);
      $result_array_associated["option_id"]= $simple_product->getResource()->getAttribute(92)->getSource()->getOptionId($color);
      $result_array_associated["product_type"]=$simple_product->getTypeId();
      $result_array_associated["product_status"]=$simple_product->getStatus();
      $result_array_associated["visibility"]= $simple_product->getVisibility();

      //echo "<pre>";
      //print_r($result_array_listproduct["asociated"]);

      array_push($result_array_listproduct["asociated"],$result_array_associated);




      array_push($result_array, $result_array_listproduct);



      echo "<pre>";
      print_r($result_array);
      //echo json_encode($result_array);





      share|improve this answer

























        0












        0








        0







        finally I got solution long time searching relate and code is below



        error_reporting(0);
        include("../app/Mage.php");
        umask(0);
        Mage::app();
        $result_array = array();
        $result_array_listproduct = array();
        $result_array_associated = array();
        $product_collection = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect('*')
        ->load();
        foreach ($product_collection as $product)
        $ids[] = $product->getId();

        // echo "<pre>";
        // print_r($ids);
        // exit();
        for($i=0;$ids[$i];$i++)



        $_product = Mage::getModel('catalog/product')->load($ids[$i]);

        $product_visi=$_product->getVisibility();

        if($product_visi == "4")

        $result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
        $result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
        $result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
        $result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
        $result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
        $result_array_listproduct["product_all_images"]=$product_all_image=array();


        //$product = Mage::getModel('catalog/product')->load($_product->getId());
        $images='';
        foreach ($_product->getMediaGalleryImages() as $image)
        $images[]=$image->getUrl();


        array_push($result_array_listproduct["product_all_images"],$images);


        $result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
        $result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
        $result_array_listproduct["sku"]=$sku=$_product->getSku();
        $result_array_listproduct["product_short_description"]=$product_short_description=htmlentities(preg_replace('/"/',' ',$_product->getShortDescription())); //product's short description
        $result_array_listproduct["product_long_description"]=$product_long_description=htmlentities(preg_replace('/"/',' ',$_product->getDescription())); // product's long description
        $result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
        $result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
        $result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
        $result_array_listproduct["product_status"]=$product_status=$product->getStatus();
        $result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();
        $result_array_listproduct["asociated"]= array();
        //print_r($result_array_listproduct);

        if($product_type=="configurable")
        $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
        $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
        foreach($simple_collection as $simple_product)
        $result_array_associated["product_id"]= $simple_product->getId();
        $result_array_associated["product_name"]=$simple_product->getName();
        $result_array_associated["product_image"]=$simple_product->getImageUrl();
        $result_array_associated["product_small_image"]=$simple_product->getSmallImageUrl();
        $result_array_associated["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
        $result_array_associated["product_regular_price"]=$simple_product->getPrice();
        $result_array_associated["product_special_price"]=$simple_product->getSpecialPrice();
        $result_array_associated["sku"]=$simple_product->getSku();
        $result_array_associated["product_short_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getShortDescription()));
        $result_array_associated["product_long_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getDescription()));
        $result_array_associated["product_qty"]=$simple_product->getStockItem()->getQty();
        $result_array_associated["product_attribute"]=$color=$simple_product->getAttributeText('color');
        //$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute("color")->getSource()->getOptionId($color);
        $result_array_associated["option_id"]= $simple_product->getResource()->getAttribute(92)->getSource()->getOptionId($color);
        $result_array_associated["product_type"]=$simple_product->getTypeId();
        $result_array_associated["product_status"]=$simple_product->getStatus();
        $result_array_associated["visibility"]= $simple_product->getVisibility();

        //echo "<pre>";
        //print_r($result_array_listproduct["asociated"]);

        array_push($result_array_listproduct["asociated"],$result_array_associated);




        array_push($result_array, $result_array_listproduct);



        echo "<pre>";
        print_r($result_array);
        //echo json_encode($result_array);





        share|improve this answer













        finally I got solution long time searching relate and code is below



        error_reporting(0);
        include("../app/Mage.php");
        umask(0);
        Mage::app();
        $result_array = array();
        $result_array_listproduct = array();
        $result_array_associated = array();
        $product_collection = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect('*')
        ->load();
        foreach ($product_collection as $product)
        $ids[] = $product->getId();

        // echo "<pre>";
        // print_r($ids);
        // exit();
        for($i=0;$ids[$i];$i++)



        $_product = Mage::getModel('catalog/product')->load($ids[$i]);

        $product_visi=$_product->getVisibility();

        if($product_visi == "4")

        $result_array_listproduct["product_id"]=$product_id=$_product->getId(); // product id
        $result_array_listproduct["product_name"]=$product_name=$_product->getName(); //product name
        $result_array_listproduct["product_image"]=$product_image=$_product->getImageUrl(); //product's image url
        $result_array_listproduct["product_small_image"]=$product_small_image=$_product->getSmallImageUrl(); //product's small image url
        $result_array_listproduct["product_thumbnail_image"]=$product_thumbnail_image=$_product->getThumbnailUrl(); //product's thumbnail image url
        $result_array_listproduct["product_all_images"]=$product_all_image=array();


        //$product = Mage::getModel('catalog/product')->load($_product->getId());
        $images='';
        foreach ($_product->getMediaGalleryImages() as $image)
        $images[]=$image->getUrl();


        array_push($result_array_listproduct["product_all_images"],$images);


        $result_array_listproduct["product_regular_price"]=$product_regular_price=$_product->getPrice(); //product's regular Price
        $result_array_listproduct["product_special_price"]=$product_special_price=$_product->getSpecialPrice();
        $result_array_listproduct["sku"]=$sku=$_product->getSku();
        $result_array_listproduct["product_short_description"]=$product_short_description=htmlentities(preg_replace('/"/',' ',$_product->getShortDescription())); //product's short description
        $result_array_listproduct["product_long_description"]=$product_long_description=htmlentities(preg_replace('/"/',' ',$_product->getDescription())); // product's long description
        $result_array_listproduct["product_qty"]=$product_qty=$_product->getStockItem()->getQty();// get product Qty
        $result_array_listproduct["product_attribute"]=$product_attribute=$_product->getAttributeText('color'); // get product attribute color
        $result_array_listproduct["product_type"]=$product_type=$_product->getTypeId();
        $result_array_listproduct["product_status"]=$product_status=$product->getStatus();
        $result_array_listproduct["product_visi"]=$product_visi=$_product->getVisibility();
        $result_array_listproduct["asociated"]= array();
        //print_r($result_array_listproduct);

        if($product_type=="configurable")
        $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
        $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
        foreach($simple_collection as $simple_product)
        $result_array_associated["product_id"]= $simple_product->getId();
        $result_array_associated["product_name"]=$simple_product->getName();
        $result_array_associated["product_image"]=$simple_product->getImageUrl();
        $result_array_associated["product_small_image"]=$simple_product->getSmallImageUrl();
        $result_array_associated["product_thumbnail_image"]=$simple_product->getThumbnailUrl();
        $result_array_associated["product_regular_price"]=$simple_product->getPrice();
        $result_array_associated["product_special_price"]=$simple_product->getSpecialPrice();
        $result_array_associated["sku"]=$simple_product->getSku();
        $result_array_associated["product_short_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getShortDescription()));
        $result_array_associated["product_long_description"]=htmlentities(preg_replace('/"/',' ',$simple_product->getDescription()));
        $result_array_associated["product_qty"]=$simple_product->getStockItem()->getQty();
        $result_array_associated["product_attribute"]=$color=$simple_product->getAttributeText('color');
        //$result_array_associated["option_id"]= $simple_product->getResource()->getAttribute("color")->getSource()->getOptionId($color);
        $result_array_associated["option_id"]= $simple_product->getResource()->getAttribute(92)->getSource()->getOptionId($color);
        $result_array_associated["product_type"]=$simple_product->getTypeId();
        $result_array_associated["product_status"]=$simple_product->getStatus();
        $result_array_associated["visibility"]= $simple_product->getVisibility();

        //echo "<pre>";
        //print_r($result_array_listproduct["asociated"]);

        array_push($result_array_listproduct["asociated"],$result_array_associated);




        array_push($result_array, $result_array_listproduct);



        echo "<pre>";
        print_r($result_array);
        //echo json_encode($result_array);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 '16 at 10:33









        Rahul PrajapatiRahul Prajapati

        54




        54



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f106495%2fhow-can-get-configurable-product-with-associated-products%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Лель (журнал) Зміст Історія | Редакція | Автори і рубрики | Інтерв'ю, статті, рецензії | Див. також | Посилання | Навігаційне менюперевірена1 змінаСергій Чирков: «Плейбой» і «Пентхауз» у кіосках з'явилися вже після того, як зник «Лель»«Лель», підшивка 10 номерів (1992, 1993)Ніч з «Другом Читача»: казки на ніч для дорослихІнформація про журнал на сервері журналістів у ВР УкраїниНаталія Патрікєєва. Лель. Перший український еротичний журналр

            Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»

            Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?