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. – Prasanta Hatui Feb 17 '17 at 9:18
$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 '17 at 9:58

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.