1

I want to get items that added to checkout car and show that/those in other page in a specific div.

Items that I want to show like below image:

enter image description here

I just want the box that show product with price and I don't need to show Total.

I also test this code but it doesn't work:

$cart = Mage::getModel('checkout/cart')->getQuote();
foreach ($cart->getAllItems() as $item) {
$productName = $item->getProduct()->getName();
$productPrice = $item->getProduct()->getPrice();
}

How can I do this?

UPDATED:

And also Ii want when I remove a product from this div it is remove from checkout cart too.

Thanks For Helping me.

1

This should work

    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $cartItems = $quote->getAllVisibleItems();
    foreach ($cartItems as $item)
    {
        $productName = $item->getProduct()->getName();
        $productPrice = $item->getProduct()->getPrice();

    }
  • Nothing happen!! – Elham Gdz Aug 22 '15 at 12:33
  • The above code is to get the names and price of the products in cart.. Nothing will happen until you create a div and assign the values of $productName and $productPrice to HTML elements – Raks Aug 22 '15 at 12:35
  • I want to show like image that I added in my question, your code just show product name and price, also the price that is show is not true, product that I added in checkout cart has a different price!!! – Elham Gdz Aug 22 '15 at 12:56
  • Your answer just show name and price but I need image of product too, and also if remove product from this page, product will remove from checkout cart too.Do you have any idea? – Elham Gdz Aug 22 '15 at 13:18
  • I would recommend to try writing your HTML code, show us where you are stuck. So we can point if there's any mistake in it. Otherwise you're kind of asking us to write your code for you. Stack Overflow is not a code writing service. I hope u understand :) – Raks Aug 24 '15 at 12:51

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.