0

When I select the product options of configurable product on my website I get a pop-up with the added product. I want to show the selected options on the pop-up. I already got the following code which shows the label, but i can't seem the selected options to show in the pop-up.

Can someone tell me how to get the selected options on the pop-up.

For example:

I want 'Product A' with options: Color: black and size: 16. I add this product to cart and want to see the pop-up with both Color: black and Size: 16

<h4 class="product-name"></h4>
                <div class="options-wrapper">
                    <!-- Options: -->
                    <table class="options">
                        <?php

                        foreach ($_product->getTypeInstance()->getConfigurableAttributes() as $attribute) {


                            echo '<td><td>' . $attribute->getLabel() . '</td><td>'. $attribute->getValue($_product).'</td></tr>';

                        }
                        ?>

                    </table>
                </div>
  • You can use the last added item and selected options from quote. – Sukumar Gorai Jun 14 '18 at 9:28
  • Sure. And do you have any idea how to get that? – Jasper1187 Jun 14 '18 at 9:31
  • Please check my answer from there you can get an idea how do you get the last added item. – Sukumar Gorai Jun 14 '18 at 9:33
0

You can manage it through following code:

$collection = Mage::getModel('checkout/cart')->getQuote()->getAllItems();

$lastItem = $collection->getLastItem();

For options you can use the following code:

$options = Mage::getResourceModel('sales/quote_item_option_collection');
$options->addItemFilter($lastItem->getId());
|improve this answer|||||
  • Yes i understand this. But how can i get the values of the selected options when the latest added product is loaded? – Jasper1187 Jun 14 '18 at 9:41
  • Please check the updated answer. – Sukumar Gorai Jun 14 '18 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.