I have the following code. Where I pass a device id which is stored as a custom column in sales_quote and get all the quote ids to that device id.
By trying the below code I am able to get only first occurrence of quote id.

Can anyone please help.

    $quote = Mage::getModel('sales/quote')->load($deviceId,'device_id');//here device_id is feild in database
    $cartItems = $quote->getAllVisibleItems();
    foreach ($cartItems as $item) {
    $pid = $item->getQuoteId();
  • 1
    Using load() will return one model object. Try to get collection. Feb 17, 2017 at 9:18

1 Answer 1

$quote = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('device_id',$deviceId);
foreach ($quote as $item) {
    $pid[] = $item->getQuoteId();
  • Please explain what your code is doing and how this solves the OP's question
    – 7ochem
    Feb 17, 2017 at 9:58

Your Answer

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

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