Get Configurable Product Price from Simple Product in Magento OrderConfigurable product tax class from simple productFilter simple products by priceMagento Configurable Product Price Overriding Simple Product PriceIs there any way to determine Simple products that are not associated with a configurable?Ways of keeping Configurable product pricing consistent with Simple product pricingPlacing an order with configurable product weird issuemagento “erasing” simple products from configurable associationConfigurable product creates simple product as out of stock even if quantity givenhow to display configurable product price of default selected in product list instead of Zero?Magento use associated simple product image for configurable product

Should I be concerned about student access to a test bank?

Is it possible to stack the damage done by the Absorb Elements spell?

Asserting that Atheism and Theism are both faith based positions

Print a physical multiplication table

Unfrosted light bulb

If "dar" means "to give", what does "daros" mean?

Hausdorff dimension of the boundary of fibres of Lipschitz maps

Inhabiting Mars versus going straight for a Dyson swarm

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

In what cases must I use 了 and in what cases not?

Using Past-Perfect interchangeably with the Past Continuous

When did antialiasing start being available?

What can I do if I am asked to learn different programming languages very frequently?

Comment Box for Substitution Method of Integrals

What exactly term 'companion plants' means?

Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?

How to generate binary array whose elements with values 1 are randomly drawn

Should I use acronyms in dialogues before telling the readers what it stands for in fiction?

Do native speakers use "ultima" and "proxima" frequently in spoken English?

World War I as a war of liberals against authoritarians?

What are substitutions for coconut in curry?

Is there a term for accumulated dirt on the outside of your hands and feet?

Bash - pair each line of file

Probably overheated black color SMD pads



Get Configurable Product Price from Simple Product in Magento Order


Configurable product tax class from simple productFilter simple products by priceMagento Configurable Product Price Overriding Simple Product PriceIs there any way to determine Simple products that are not associated with a configurable?Ways of keeping Configurable product pricing consistent with Simple product pricingPlacing an order with configurable product weird issuemagento “erasing” simple products from configurable associationConfigurable product creates simple product as out of stock even if quantity givenhow to display configurable product price of default selected in product list instead of Zero?Magento use associated simple product image for configurable product













1















We are writing synchronization of Magento and MAS90 ERP system. We are transferring Orders from Magento to ERP system. We have added observer for order_save_after.



Each of Magento Simple product has UPC code that needed to add item in ERP system.
Simple products are automatically added to Magento Order based on configurable item, but problem is that simple product's real price, quantity, tax amount...are stored in configurable product, but UPC is stored in simple product.
For resolving this problem, we decide to get simple products from Magento Order ( to get right UPC ).



Our question is, how to get RIGHT price, quantity, tax amount of automatically added simple product. ( How in Magento order are linked configurable product and automatically added simple product. )



Here is snippet of Code that is getting products.



 foreach ($order->getAllItems() as $orderItem)
$tmpMAS90OrderItem = NULL;
if($orderItem->getProductType() == 'simple')
$tmpMAS90OrderItem = $orderItem -> getUpc();

if($tmpMAS90OrderItem != NULL)
$setChildValuesArray = array(
'ItemCode' => $tmpMAS90OrderItem,
'UnitPrice' => $orderItem -> getPrice(), // THIS IS WRONG PRICE, right price is in configurable item
'QuantityOrdered' => $orderItem -> getQtyToInvoice()
);
$querySO->setChildFieldValues($setChildValuesArray,$childSequence); //child sequence ( line sequence )
$childSequence++;
$linesTaxAmountSum += $orderItem->getTaxAmount(); // THIS IS WRONG TAX AMOUNT, right amount is in configurable item











share|improve this question




























    1















    We are writing synchronization of Magento and MAS90 ERP system. We are transferring Orders from Magento to ERP system. We have added observer for order_save_after.



    Each of Magento Simple product has UPC code that needed to add item in ERP system.
    Simple products are automatically added to Magento Order based on configurable item, but problem is that simple product's real price, quantity, tax amount...are stored in configurable product, but UPC is stored in simple product.
    For resolving this problem, we decide to get simple products from Magento Order ( to get right UPC ).



    Our question is, how to get RIGHT price, quantity, tax amount of automatically added simple product. ( How in Magento order are linked configurable product and automatically added simple product. )



    Here is snippet of Code that is getting products.



     foreach ($order->getAllItems() as $orderItem)
    $tmpMAS90OrderItem = NULL;
    if($orderItem->getProductType() == 'simple')
    $tmpMAS90OrderItem = $orderItem -> getUpc();

    if($tmpMAS90OrderItem != NULL)
    $setChildValuesArray = array(
    'ItemCode' => $tmpMAS90OrderItem,
    'UnitPrice' => $orderItem -> getPrice(), // THIS IS WRONG PRICE, right price is in configurable item
    'QuantityOrdered' => $orderItem -> getQtyToInvoice()
    );
    $querySO->setChildFieldValues($setChildValuesArray,$childSequence); //child sequence ( line sequence )
    $childSequence++;
    $linesTaxAmountSum += $orderItem->getTaxAmount(); // THIS IS WRONG TAX AMOUNT, right amount is in configurable item











    share|improve this question


























      1












      1








      1








      We are writing synchronization of Magento and MAS90 ERP system. We are transferring Orders from Magento to ERP system. We have added observer for order_save_after.



      Each of Magento Simple product has UPC code that needed to add item in ERP system.
      Simple products are automatically added to Magento Order based on configurable item, but problem is that simple product's real price, quantity, tax amount...are stored in configurable product, but UPC is stored in simple product.
      For resolving this problem, we decide to get simple products from Magento Order ( to get right UPC ).



      Our question is, how to get RIGHT price, quantity, tax amount of automatically added simple product. ( How in Magento order are linked configurable product and automatically added simple product. )



      Here is snippet of Code that is getting products.



       foreach ($order->getAllItems() as $orderItem)
      $tmpMAS90OrderItem = NULL;
      if($orderItem->getProductType() == 'simple')
      $tmpMAS90OrderItem = $orderItem -> getUpc();

      if($tmpMAS90OrderItem != NULL)
      $setChildValuesArray = array(
      'ItemCode' => $tmpMAS90OrderItem,
      'UnitPrice' => $orderItem -> getPrice(), // THIS IS WRONG PRICE, right price is in configurable item
      'QuantityOrdered' => $orderItem -> getQtyToInvoice()
      );
      $querySO->setChildFieldValues($setChildValuesArray,$childSequence); //child sequence ( line sequence )
      $childSequence++;
      $linesTaxAmountSum += $orderItem->getTaxAmount(); // THIS IS WRONG TAX AMOUNT, right amount is in configurable item











      share|improve this question
















      We are writing synchronization of Magento and MAS90 ERP system. We are transferring Orders from Magento to ERP system. We have added observer for order_save_after.



      Each of Magento Simple product has UPC code that needed to add item in ERP system.
      Simple products are automatically added to Magento Order based on configurable item, but problem is that simple product's real price, quantity, tax amount...are stored in configurable product, but UPC is stored in simple product.
      For resolving this problem, we decide to get simple products from Magento Order ( to get right UPC ).



      Our question is, how to get RIGHT price, quantity, tax amount of automatically added simple product. ( How in Magento order are linked configurable product and automatically added simple product. )



      Here is snippet of Code that is getting products.



       foreach ($order->getAllItems() as $orderItem)
      $tmpMAS90OrderItem = NULL;
      if($orderItem->getProductType() == 'simple')
      $tmpMAS90OrderItem = $orderItem -> getUpc();

      if($tmpMAS90OrderItem != NULL)
      $setChildValuesArray = array(
      'ItemCode' => $tmpMAS90OrderItem,
      'UnitPrice' => $orderItem -> getPrice(), // THIS IS WRONG PRICE, right price is in configurable item
      'QuantityOrdered' => $orderItem -> getQtyToInvoice()
      );
      $querySO->setChildFieldValues($setChildValuesArray,$childSequence); //child sequence ( line sequence )
      $childSequence++;
      $linesTaxAmountSum += $orderItem->getTaxAmount(); // THIS IS WRONG TAX AMOUNT, right amount is in configurable item








      configurable-product event-observer simple-product






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 11 mins ago









      Teja Bhagavan Kollepara

      3,00641949




      3,00641949










      asked May 7 '15 at 7:27









      Aram KocharyanAram Kocharyan

      1086




      1086




















          1 Answer
          1






          active

          oldest

          votes


















          1














          In this case you need to use call parent item's row().As per magento when a configurable product is ordered,then there are two rows has been saved at sales_flat_order_item.One is configurable product data product_id and order item prices and another is simple products details.So need data fetch data from Configurable products.



          So need to change



          'UnitPrice'=> $orderItem->getParentItem()?$orderItem->getParentItem()-> getPrice():$orderItem-> getPrice(),


          From



          UnitPrice' => $orderItem -> getPrice(),


          Also To:



          $linesTaxAmountSum += $orderItem->getParentItem()?$orderItem->getParentItem()->getTaxAmount():$orderItem->getTaxAmount();


          From:



          $linesTaxAmountSum += $orderItem->getTaxAmount(); 





          share|improve this answer

























          • Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

            – Aram Kocharyan
            May 7 '15 at 7:42











          • may use getAllVisibleItems() instead getAllItems() better idea

            – Amit Bera
            May 7 '15 at 7:49










          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%2f66982%2fget-configurable-product-price-from-simple-product-in-magento-order%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









          1














          In this case you need to use call parent item's row().As per magento when a configurable product is ordered,then there are two rows has been saved at sales_flat_order_item.One is configurable product data product_id and order item prices and another is simple products details.So need data fetch data from Configurable products.



          So need to change



          'UnitPrice'=> $orderItem->getParentItem()?$orderItem->getParentItem()-> getPrice():$orderItem-> getPrice(),


          From



          UnitPrice' => $orderItem -> getPrice(),


          Also To:



          $linesTaxAmountSum += $orderItem->getParentItem()?$orderItem->getParentItem()->getTaxAmount():$orderItem->getTaxAmount();


          From:



          $linesTaxAmountSum += $orderItem->getTaxAmount(); 





          share|improve this answer

























          • Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

            – Aram Kocharyan
            May 7 '15 at 7:42











          • may use getAllVisibleItems() instead getAllItems() better idea

            – Amit Bera
            May 7 '15 at 7:49















          1














          In this case you need to use call parent item's row().As per magento when a configurable product is ordered,then there are two rows has been saved at sales_flat_order_item.One is configurable product data product_id and order item prices and another is simple products details.So need data fetch data from Configurable products.



          So need to change



          'UnitPrice'=> $orderItem->getParentItem()?$orderItem->getParentItem()-> getPrice():$orderItem-> getPrice(),


          From



          UnitPrice' => $orderItem -> getPrice(),


          Also To:



          $linesTaxAmountSum += $orderItem->getParentItem()?$orderItem->getParentItem()->getTaxAmount():$orderItem->getTaxAmount();


          From:



          $linesTaxAmountSum += $orderItem->getTaxAmount(); 





          share|improve this answer

























          • Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

            – Aram Kocharyan
            May 7 '15 at 7:42











          • may use getAllVisibleItems() instead getAllItems() better idea

            – Amit Bera
            May 7 '15 at 7:49













          1












          1








          1







          In this case you need to use call parent item's row().As per magento when a configurable product is ordered,then there are two rows has been saved at sales_flat_order_item.One is configurable product data product_id and order item prices and another is simple products details.So need data fetch data from Configurable products.



          So need to change



          'UnitPrice'=> $orderItem->getParentItem()?$orderItem->getParentItem()-> getPrice():$orderItem-> getPrice(),


          From



          UnitPrice' => $orderItem -> getPrice(),


          Also To:



          $linesTaxAmountSum += $orderItem->getParentItem()?$orderItem->getParentItem()->getTaxAmount():$orderItem->getTaxAmount();


          From:



          $linesTaxAmountSum += $orderItem->getTaxAmount(); 





          share|improve this answer















          In this case you need to use call parent item's row().As per magento when a configurable product is ordered,then there are two rows has been saved at sales_flat_order_item.One is configurable product data product_id and order item prices and another is simple products details.So need data fetch data from Configurable products.



          So need to change



          'UnitPrice'=> $orderItem->getParentItem()?$orderItem->getParentItem()-> getPrice():$orderItem-> getPrice(),


          From



          UnitPrice' => $orderItem -> getPrice(),


          Also To:



          $linesTaxAmountSum += $orderItem->getParentItem()?$orderItem->getParentItem()->getTaxAmount():$orderItem->getTaxAmount();


          From:



          $linesTaxAmountSum += $orderItem->getTaxAmount(); 






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 7 '15 at 7:44

























          answered May 7 '15 at 7:37









          Amit BeraAmit Bera

          59.2k1575176




          59.2k1575176












          • Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

            – Aram Kocharyan
            May 7 '15 at 7:42











          • may use getAllVisibleItems() instead getAllItems() better idea

            – Amit Bera
            May 7 '15 at 7:49

















          • Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

            – Aram Kocharyan
            May 7 '15 at 7:42











          • may use getAllVisibleItems() instead getAllItems() better idea

            – Amit Bera
            May 7 '15 at 7:49
















          Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

          – Aram Kocharyan
          May 7 '15 at 7:42





          Thank you for answer. It mean that each parent(up) row of simple product is configurable item ? ( In case that we ordered configurable product ) First I need to get product data from configurable item, and put it in next row? ( Is there any way that when a configurable product will be ordered no second row will be added ? )

          – Aram Kocharyan
          May 7 '15 at 7:42













          may use getAllVisibleItems() instead getAllItems() better idea

          – Amit Bera
          May 7 '15 at 7:49





          may use getAllVisibleItems() instead getAllItems() better idea

          – Amit Bera
          May 7 '15 at 7:49

















          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%2f66982%2fget-configurable-product-price-from-simple-product-in-magento-order%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

          Disable / Remove link to Product Items in Cart 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?How can I limit products that can be bought / added to cart?Remove item from cartHide “Add to Cart” button if specific products are already in cart“Prettifying” the custom options in cart pageCreate link in cart sidebar to view all added items After limit reachedLink products together in checkout/cartHow to Get product from cart and add it againHide action-edit on cart page if simple productRemoving Cart items - ObserverRemove wishlist items when added to cart

          Helsingin valtaus Sisällysluettelo Taustaa | Yleistä sotatoimista | Osapuolet | Taistelut Helsingin ympäristössä | Punaisten antautumissuunnitelma | Taistelujen kulku Helsingissä | Valtauksen jälkeen | Tappiot | Muistaminen | Kirjallisuutta | Lähteet | Aiheesta muualla | NavigointivalikkoTeoksen verkkoversioTeoksen verkkoversioGoogle BooksSisällissota Helsingissä päättyi tasan 95 vuotta sittenSaksalaisten ylivoima jyräsi punaisen HelsinginSuomalaiset kuvaavat sotien jälkiä kaupungeissa – katso kuvat ja tarinat tutuilta kulmiltaHelsingin valtaus 90 vuotta sittenSaksalaiset valtasivat HelsinginHyökkäys HelsinkiinHelsingin valtaus 12.–13.4. 1918Saksalaiset käyttivät ihmiskilpiä Helsingin valtauksessa 1918Teoksen verkkoversioTeoksen verkkoversioSaksalaiset hyökkäävät Etelä-SuomeenTaistelut LeppävaarassaSotilaat ja taistelutLeppävaara 1918 huhtikuussa. KapinatarinaHelsingin taistelut 1918Saksalaisten voitonparaati HelsingissäHelsingin valtausta juhlittiinSaksalaisten Helsinki vuonna 1918Helsingin taistelussa kaatuneet valkokaartilaisetHelsinkiin haudatut taisteluissa kaatuneet punaiset12.4.1918 Helsingin valtauksessa saksalaiset apujoukot vapauttavat kaupunginVapaussodan muistomerkkejä Helsingissä ja pääkaupunkiseudullaCrescendo / Vuoden 1918 Kansalaissodan uhrien muistomerkkim

          Adjektiivitarina Tarinan tekeminen | Esimerkki: ennen | Esimerkki: jälkeen | Navigointivalikko