I'm creating an abstract class that is extending Mage_Payment_Model_Method_Abstract.

When I run

$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();

foreach ($cartItems as $item) {

I get nothing in the logs about this. How can I get access to the items?


Thanks to Amit's answer below I was able to find out how to get the sku for the order

$orders = Mage::getModel('sales/order_collection');

foreach($orders as $order){
    $items = $order->getAllVisibleItems();
    foreach($items as $item){
        $sku = $item->getSku();

1 Answer 1


As Mage::getSingleton('checkout/session')->getQuote() using it working

on frontend

but it does not work on backend.

For backend magento use different model


Better solution is below:

$paymentInfo = $this->getInfoInstance();

if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
        // used  for order object
     } else {
         $Quote = $paymentInfo->getQuote();
    // put your code  here  
        $Quote = $quote->getAllVisibleItems();
        foreach ($cartItems as $item) {
  • Thanks. So in the conditional where you put 'used for order object', how would I be able to access the order item, like sku?
    – MW Millar
    Jul 14, 2015 at 11:26
  • Ok I've seen your edit. My problem now is that $paymentInfo is instanceof Mage_Sales_Model_Order_Payment, so it goes into the 'used for order object' part.
    – MW Millar
    Jul 14, 2015 at 11:30
  • let me check...
    – Amit Bera
    Jul 14, 2015 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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