Get Configurable Parent from simple product in quote when simple product has multiple parents Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Setting additional options for configurable product in Quote Item [Solved]How to show only one record in order grid for the same Order ID for parent configurable product and child simple product?Need to get Simple Products with Configurable Option from Configurable Productconfigurable product name changes to simple product name when attributes (color/size) are selectedChanges configurable product main image to associated simple product image when option selectedMagento configurable product from multiple productsMagento 2 - Configurable product - Get parent product ID from child product IDmagento-configurable-auto-pricing at backendGet product parent name from child productHow to get child simple Product Obj from configurable Sales Order Items

Can a Wizard take the Magic Initiate feat and select spells from the Wizard list?

How to mute a string and play another at the same time

Proving inequality for positive definite matrix

Lights are flickering on and off after accidentally bumping into light switch

Can I ask an author to send me his ebook?

Etymology of 見舞い

Who's this lady in the war room?

How to produce a PS1 prompt in bash or ksh93 similar to tcsh

How to create a command for the "strange m" symbol in latex?

Suing a Police Officer Instead of the Police Department

Can I take recommendation from someone I met at a conference?

Why do C and C++ allow the expression (int) + 4*5?

What were wait-states, and why was it only an issue for PCs?

Pointing to problems without suggesting solutions

What is the definining line between a helicopter and a drone a person can ride in?

Providing direct feedback to a product salesperson

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

When speaking, how do you change your mind mid-sentence?

Why does BitLocker not use RSA?

Knights and Knaves question

Assertions In A Mock Callout Test

What could prevent concentrated local exploration?

What is the evidence that custom checks in Northern Ireland are going to result in violence?



Get Configurable Parent from simple product in quote when simple product has multiple parents



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Setting additional options for configurable product in Quote Item [Solved]How to show only one record in order grid for the same Order ID for parent configurable product and child simple product?Need to get Simple Products with Configurable Option from Configurable Productconfigurable product name changes to simple product name when attributes (color/size) are selectedChanges configurable product main image to associated simple product image when option selectedMagento configurable product from multiple productsMagento 2 - Configurable product - Get parent product ID from child product IDmagento-configurable-auto-pricing at backendGet product parent name from child productHow to get child simple Product Obj from configurable Sales Order Items



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple products]. They have then taken the 3 simple products and assigned each of them to the 14 configurable products so that the logo from the configurable products gets the base color simple product selected.



In their setup the configurable products house the images for these products. However, since you can only purchase the simple product the image that is being select is ALWAYS coming over as the image from product 1 of 20 (lowest product_id), no matter which selection is chosen.



The code im going to be trying to update is in a custom block that is being used on the checkout_onepage_index reference.



My question is:




From the sales/quote_item Model, how can I determine exactly which parent the
child item was selected from?




or




From the checkout/cart Model, can something be achieved?








Things I have already seen but are not really helpful.



Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())

result

Array
(
[0] => 45207
[1] => 45209
[2] => 45210
[3] => 45211
[4] => 45212
[5] => 45213
[6] => 45214
[7] => 45215
[8] => 45216
[9] => 45217
[10] => 45218
[11] => 45219
[12] => 45220
[13] => 45222
)


  • This just returns an array of all parentIds for the child item. Which is great, but there is no indication of which Parent Product this simple product was selected from.









share|improve this question














bumped to the homepage by Community 9 mins ago


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





















    0















    So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple products]. They have then taken the 3 simple products and assigned each of them to the 14 configurable products so that the logo from the configurable products gets the base color simple product selected.



    In their setup the configurable products house the images for these products. However, since you can only purchase the simple product the image that is being select is ALWAYS coming over as the image from product 1 of 20 (lowest product_id), no matter which selection is chosen.



    The code im going to be trying to update is in a custom block that is being used on the checkout_onepage_index reference.



    My question is:




    From the sales/quote_item Model, how can I determine exactly which parent the
    child item was selected from?




    or




    From the checkout/cart Model, can something be achieved?








    Things I have already seen but are not really helpful.



    Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())

    result

    Array
    (
    [0] => 45207
    [1] => 45209
    [2] => 45210
    [3] => 45211
    [4] => 45212
    [5] => 45213
    [6] => 45214
    [7] => 45215
    [8] => 45216
    [9] => 45217
    [10] => 45218
    [11] => 45219
    [12] => 45220
    [13] => 45222
    )


    • This just returns an array of all parentIds for the child item. Which is great, but there is no indication of which Parent Product this simple product was selected from.









    share|improve this question














    bumped to the homepage by Community 9 mins ago


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

















      0












      0








      0








      So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple products]. They have then taken the 3 simple products and assigned each of them to the 14 configurable products so that the logo from the configurable products gets the base color simple product selected.



      In their setup the configurable products house the images for these products. However, since you can only purchase the simple product the image that is being select is ALWAYS coming over as the image from product 1 of 20 (lowest product_id), no matter which selection is chosen.



      The code im going to be trying to update is in a custom block that is being used on the checkout_onepage_index reference.



      My question is:




      From the sales/quote_item Model, how can I determine exactly which parent the
      child item was selected from?




      or




      From the checkout/cart Model, can something be achieved?








      Things I have already seen but are not really helpful.



      Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())

      result

      Array
      (
      [0] => 45207
      [1] => 45209
      [2] => 45210
      [3] => 45211
      [4] => 45212
      [5] => 45213
      [6] => 45214
      [7] => 45215
      [8] => 45216
      [9] => 45217
      [10] => 45218
      [11] => 45219
      [12] => 45220
      [13] => 45222
      )


      • This just returns an array of all parentIds for the child item. Which is great, but there is no indication of which Parent Product this simple product was selected from.









      share|improve this question














      So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple products]. They have then taken the 3 simple products and assigned each of them to the 14 configurable products so that the logo from the configurable products gets the base color simple product selected.



      In their setup the configurable products house the images for these products. However, since you can only purchase the simple product the image that is being select is ALWAYS coming over as the image from product 1 of 20 (lowest product_id), no matter which selection is chosen.



      The code im going to be trying to update is in a custom block that is being used on the checkout_onepage_index reference.



      My question is:




      From the sales/quote_item Model, how can I determine exactly which parent the
      child item was selected from?




      or




      From the checkout/cart Model, can something be achieved?








      Things I have already seen but are not really helpful.



      Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())

      result

      Array
      (
      [0] => 45207
      [1] => 45209
      [2] => 45210
      [3] => 45211
      [4] => 45212
      [5] => 45213
      [6] => 45214
      [7] => 45215
      [8] => 45216
      [9] => 45217
      [10] => 45218
      [11] => 45219
      [12] => 45220
      [13] => 45222
      )


      • This just returns an array of all parentIds for the child item. Which is great, but there is no indication of which Parent Product this simple product was selected from.






      magento-1.9 configurable-product cart blocks quoteitem






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 20 '17 at 17:29









      OuchyOuchy

      13




      13





      bumped to the homepage by Community 9 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 9 mins ago


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






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You Can set parent id in info buy request when you add an item to cart. Which is saved in sales_flat_quote_item_options. Below is the code which you use to add additional info to your item:



          $params = array(
          'parent_id'=> (int)$parent_id
          );
          $request = new Varien_Object();
          $request->setData($params);

          $result = $quote->addProduct($product, $request);


          To retrieve this information you can use the below code:



          $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
          print_r($options['info_buyRequest']['parent_id']);





          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%2f155760%2fget-configurable-parent-from-simple-product-in-quote-when-simple-product-has-mul%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














            You Can set parent id in info buy request when you add an item to cart. Which is saved in sales_flat_quote_item_options. Below is the code which you use to add additional info to your item:



            $params = array(
            'parent_id'=> (int)$parent_id
            );
            $request = new Varien_Object();
            $request->setData($params);

            $result = $quote->addProduct($product, $request);


            To retrieve this information you can use the below code:



            $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
            print_r($options['info_buyRequest']['parent_id']);





            share|improve this answer



























              0














              You Can set parent id in info buy request when you add an item to cart. Which is saved in sales_flat_quote_item_options. Below is the code which you use to add additional info to your item:



              $params = array(
              'parent_id'=> (int)$parent_id
              );
              $request = new Varien_Object();
              $request->setData($params);

              $result = $quote->addProduct($product, $request);


              To retrieve this information you can use the below code:



              $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
              print_r($options['info_buyRequest']['parent_id']);





              share|improve this answer

























                0












                0








                0







                You Can set parent id in info buy request when you add an item to cart. Which is saved in sales_flat_quote_item_options. Below is the code which you use to add additional info to your item:



                $params = array(
                'parent_id'=> (int)$parent_id
                );
                $request = new Varien_Object();
                $request->setData($params);

                $result = $quote->addProduct($product, $request);


                To retrieve this information you can use the below code:



                $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
                print_r($options['info_buyRequest']['parent_id']);





                share|improve this answer













                You Can set parent id in info buy request when you add an item to cart. Which is saved in sales_flat_quote_item_options. Below is the code which you use to add additional info to your item:



                $params = array(
                'parent_id'=> (int)$parent_id
                );
                $request = new Varien_Object();
                $request->setData($params);

                $result = $quote->addProduct($product, $request);


                To retrieve this information you can use the below code:



                $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
                print_r($options['info_buyRequest']['parent_id']);






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 20 '18 at 21:01









                EllisonEllison

                11




                11



























                    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%2f155760%2fget-configurable-parent-from-simple-product-in-quote-when-simple-product-has-mul%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

                    Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2