Magento Get All Visible Items From Quote


Magento Get All Visible Items From Quote : You can get the all visible items from the quote simply using $quote->getAllVisibleItems() which will give you all visible items of quote. Here in this example we are going to explain how to get visible items of quote on magento admin & front end. We will explain with different example.


Magento Get All Visible Items From Quote

You Can get Quote visible items as –

Magento get all visible items From Cart Quote

If you are working with front end checkout then you can get quote’s visible items as below-

Magento Get All Visible Items From Quote:

$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
    $productId = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($productId);
	$name = $product->getName();
	$sku = $product->getSku();
}

The above example will give you all visible items of cart on front end.

Magento get all visible items From Admin Quote

If you are working with admin quote then you can get quote’s visible items as below-

Magento Get All Visible Items From Quote:

$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
    $productId = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($productId);
	$name = $product->getName();
	$sku = $product->getSku();
}

The above example will give you the all visible items from admin quote.


Advertisements

Add Comment

📖 Read More