How to get quote Id using sales_quote_collect_totals_after events Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Get just the SIMPLE products ordered from a quote when Configurable Products are purchasedCustom cron causing one page checkout deadlocksConvert Order to Quote and Load to Current CartDifference Between Sales Quote and Sales Quote AddressGet quote items from admin quote sessionM1 CE, paypal exception “PayPal NVP gateway errors”Magento 2: After login how to get current quote id?How to remove items from quote using observer whenever quote is loaded?Using events vs overriding? Why events are better?Get Quote from Order Success Observer

How to keep bees out of canned beverages?

Protagonist's race is hidden - should I reveal it?

All ASCII characters with a given bit count

Raising a bilingual kid. When should we introduce the majority language?

How would you suggest I follow up with coworkers about our deadline that's today?

Determinant of a matrix with 2 equal rows

Is a self contained air-bullet cartridge feasible?

Co-worker works way more than he should

What were wait-states, and why was it only an issue for PCs?

How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?

Will temporary Dex penalties prevent you from getting the benefits of the "Two Weapon Fighting" feat if your Dex score falls below the prerequisite?

What is the numbering system used for the DSN dishes?

Preserving file and folder permissions with rsync

When I export an AI 300x60 art board it saves with bigger dimensions

Why doesn't the university give past final exams' answers?

Philosophers who were composers?

Why did Europeans not widely domesticate foxes?

Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?

/bin/ls sorts differently than just ls

What *exactly* is electrical current, voltage, and resistance?

What is the purpose of the side handle on a hand ("eggbeater") drill?

Is it accepted to use working hours to read general interest books?

Variable does not exist: sObjectType (Task.sObjectType)

Why isn't everyone flabbergasted about Bran's "gift"?



How to get quote Id using sales_quote_collect_totals_after events



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Get just the SIMPLE products ordered from a quote when Configurable Products are purchasedCustom cron causing one page checkout deadlocksConvert Order to Quote and Load to Current CartDifference Between Sales Quote and Sales Quote AddressGet quote items from admin quote sessionM1 CE, paypal exception “PayPal NVP gateway errors”Magento 2: After login how to get current quote id?How to remove items from quote using observer whenever quote is loaded?Using events vs overriding? Why events are better?Get Quote from Order Success Observer



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have create a programmatically order. But when submit order sales_quote_collect_totals_after events fire before save collect totals.

Here is my code :



$storeId = Mage::app()->getStore()->getStoreId();
try
$customer_id = $this->getRequest()->getParam('customer_id');
$selected_product_details = $this->getRequest()->getParam('selected_product_details');
$firstname = $this->getRequest()->getParam('firstname');
$lastname = $this->getRequest()->getParam('lastname');
$email = $this->getRequest()->getParam('email');
$street = $this->getRequest()->getParam('street');
$mobile = $this->getRequest()->getParam('mobile');

if ($customer_id == '')
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId($websiteId)
->setStore($store)
->setFirstname($firstname)
->setLastname($lastname)
->setEmail($email)
->setPassword('123456');
$customer->save();
$customer_id = $customer->getCustomerId();
else
$customer = Mage::getModel('customer/customer')->load($customer_id);

$product_details = json_decode($selected_product_details, true);
$websiteId = Mage::app()->getWebsite()->getId();
// Start New Sales Order Quote
$quote = Mage::getModel('sales/quote')
->setStoreId($storeId);
// Set Sales Order Quote Currency
$quote->setCurrency($order->AdjustmentAmount->currencyID);
// Assign Customer To Sales Order Quote
$quote->assignCustomer($customer);
// Configure Notification
$quote->setSendCconfirmation(1);
foreach ($product_details as $_products)
$productId = $_products['productId'];
$qty = $_products['qty'];
$product = Mage::getModel('catalog/product')->load($productId);
$quote->addProduct($product, new Varien_Object(array('qty' => $qty)));

// Set Sales Order Billing Address
$billingAddress = $quote->getBillingAddress()->addData(array(
'customer_address_id' => '',
'prefix' => '',
'firstname' => $firstname,
'middlename' => '',
'lastname' => $lastname,
'suffix' => '',
'company' => '',
'street' => $street,
'telephone' => $mobile,
'vat_id' => '',
'save_in_address_book' => 1
));
// Set Sales Order Shipping Address
$shippingAddress = $quote->getShippingAddress()->addData(array(
'customer_address_id' => '',
'prefix' => '',
'firstname' => $firstname,
'middlename' => '',
'lastname' => $lastname,
'suffix' => '',
'company' => '',
'street' => $street,
'telephone' => $mobile,
'vat_id' => '',
'save_in_address_book' => 1
));

if ($shippingPrice == 0)
$shippingAddress->setCollectShippingRates(true)
->collectShippingRates()
->setShippingMethod('freeshipping_freeshipping')
->setPaymentMethod('cashondelivery');
else
$shippingAddress->setCollectShippingRates(true)
->collectShippingRates()
->setShippingMethod('flatrate_flatrate')
->setPaymentMethod('cashondelivery');


//Fire event sales_quote_collect_totals_after Before ->collectTotals->save();

$quote->getPayment()->importData(array('method' => 'cashondelivery'));
$quote->collectTotals->save();

// Create Order From Quote
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$orderId = $service->getOrder()->getRealOrderId();
// Resource Clean-Up
$quote = $customer = $service = null;
$this->createOrderInvoice($orderId);

$message = $this->__('Ordered Created Successfully');
$success = 1;

//send mail when placing order
$order_mail = new Mage_Sales_Model_Order();
$order_mail->loadByIncrementId($orderId);
$order_mail->sendNewOrderEmail();

$result = array("success" => $success, "message" => $message, "order_id" => $orderId);
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

catch (Exception $ex)
$message = $this->__('Something went wrong. Please try again.');
$success = 0;
$result = array("success" => $success, "message" => $message);
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

return false;



Here is config.xml :



<modules> 
<Assel_StoreOwners>
<version>0.1.0</version>
</Assel_StoreOwners>
</modules>

<global>
<blocks>
<storeowners>
<class>Assel_StoreOwners_Block</class>
</storeowners>
</blocks>

<helpers>
<storeowners>
<class>Assel_StoreOwners_Helper</class>
</storeowners>
</helpers>

<events>
<sales_quote_collect_totals_after>
<observers>
<set_custom_discount>
<type>singleton</type>
<class>Assel_StoreOwners_Model_Observer</class>
<method>setDiscount</method>
</set_custom_discount>
</observers>
</sales_quote_collect_totals_after>
</events>
</global>




I have create a setDiscount function in observer.php
But When fire this events i have didn't get quote_id.



Here is observer.php code :



 function setDiscount($observer) 
$quote=$observer->getEvent()->getQuote();
$quoteid=$quote->getId();
$customer_id = $quote->getCustomerId();



when call this observer I have didn't get quote_id. But I have getting customer_id.



Please anyone help me.










share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    1















    I have create a programmatically order. But when submit order sales_quote_collect_totals_after events fire before save collect totals.

    Here is my code :



    $storeId = Mage::app()->getStore()->getStoreId();
    try
    $customer_id = $this->getRequest()->getParam('customer_id');
    $selected_product_details = $this->getRequest()->getParam('selected_product_details');
    $firstname = $this->getRequest()->getParam('firstname');
    $lastname = $this->getRequest()->getParam('lastname');
    $email = $this->getRequest()->getParam('email');
    $street = $this->getRequest()->getParam('street');
    $mobile = $this->getRequest()->getParam('mobile');

    if ($customer_id == '')
    $store = Mage::app()->getStore();
    $customer = Mage::getModel("customer/customer");
    $customer->setWebsiteId($websiteId)
    ->setStore($store)
    ->setFirstname($firstname)
    ->setLastname($lastname)
    ->setEmail($email)
    ->setPassword('123456');
    $customer->save();
    $customer_id = $customer->getCustomerId();
    else
    $customer = Mage::getModel('customer/customer')->load($customer_id);

    $product_details = json_decode($selected_product_details, true);
    $websiteId = Mage::app()->getWebsite()->getId();
    // Start New Sales Order Quote
    $quote = Mage::getModel('sales/quote')
    ->setStoreId($storeId);
    // Set Sales Order Quote Currency
    $quote->setCurrency($order->AdjustmentAmount->currencyID);
    // Assign Customer To Sales Order Quote
    $quote->assignCustomer($customer);
    // Configure Notification
    $quote->setSendCconfirmation(1);
    foreach ($product_details as $_products)
    $productId = $_products['productId'];
    $qty = $_products['qty'];
    $product = Mage::getModel('catalog/product')->load($productId);
    $quote->addProduct($product, new Varien_Object(array('qty' => $qty)));

    // Set Sales Order Billing Address
    $billingAddress = $quote->getBillingAddress()->addData(array(
    'customer_address_id' => '',
    'prefix' => '',
    'firstname' => $firstname,
    'middlename' => '',
    'lastname' => $lastname,
    'suffix' => '',
    'company' => '',
    'street' => $street,
    'telephone' => $mobile,
    'vat_id' => '',
    'save_in_address_book' => 1
    ));
    // Set Sales Order Shipping Address
    $shippingAddress = $quote->getShippingAddress()->addData(array(
    'customer_address_id' => '',
    'prefix' => '',
    'firstname' => $firstname,
    'middlename' => '',
    'lastname' => $lastname,
    'suffix' => '',
    'company' => '',
    'street' => $street,
    'telephone' => $mobile,
    'vat_id' => '',
    'save_in_address_book' => 1
    ));

    if ($shippingPrice == 0)
    $shippingAddress->setCollectShippingRates(true)
    ->collectShippingRates()
    ->setShippingMethod('freeshipping_freeshipping')
    ->setPaymentMethod('cashondelivery');
    else
    $shippingAddress->setCollectShippingRates(true)
    ->collectShippingRates()
    ->setShippingMethod('flatrate_flatrate')
    ->setPaymentMethod('cashondelivery');


    //Fire event sales_quote_collect_totals_after Before ->collectTotals->save();

    $quote->getPayment()->importData(array('method' => 'cashondelivery'));
    $quote->collectTotals->save();

    // Create Order From Quote
    $service = Mage::getModel('sales/service_quote', $quote);
    $service->submitAll();
    $orderId = $service->getOrder()->getRealOrderId();
    // Resource Clean-Up
    $quote = $customer = $service = null;
    $this->createOrderInvoice($orderId);

    $message = $this->__('Ordered Created Successfully');
    $success = 1;

    //send mail when placing order
    $order_mail = new Mage_Sales_Model_Order();
    $order_mail->loadByIncrementId($orderId);
    $order_mail->sendNewOrderEmail();

    $result = array("success" => $success, "message" => $message, "order_id" => $orderId);
    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

    catch (Exception $ex)
    $message = $this->__('Something went wrong. Please try again.');
    $success = 0;
    $result = array("success" => $success, "message" => $message);
    $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

    return false;



    Here is config.xml :



    <modules> 
    <Assel_StoreOwners>
    <version>0.1.0</version>
    </Assel_StoreOwners>
    </modules>

    <global>
    <blocks>
    <storeowners>
    <class>Assel_StoreOwners_Block</class>
    </storeowners>
    </blocks>

    <helpers>
    <storeowners>
    <class>Assel_StoreOwners_Helper</class>
    </storeowners>
    </helpers>

    <events>
    <sales_quote_collect_totals_after>
    <observers>
    <set_custom_discount>
    <type>singleton</type>
    <class>Assel_StoreOwners_Model_Observer</class>
    <method>setDiscount</method>
    </set_custom_discount>
    </observers>
    </sales_quote_collect_totals_after>
    </events>
    </global>




    I have create a setDiscount function in observer.php
    But When fire this events i have didn't get quote_id.



    Here is observer.php code :



     function setDiscount($observer) 
    $quote=$observer->getEvent()->getQuote();
    $quoteid=$quote->getId();
    $customer_id = $quote->getCustomerId();



    when call this observer I have didn't get quote_id. But I have getting customer_id.



    Please anyone help me.










    share|improve this question
















    bumped to the homepage by Community 6 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      1












      1








      1








      I have create a programmatically order. But when submit order sales_quote_collect_totals_after events fire before save collect totals.

      Here is my code :



      $storeId = Mage::app()->getStore()->getStoreId();
      try
      $customer_id = $this->getRequest()->getParam('customer_id');
      $selected_product_details = $this->getRequest()->getParam('selected_product_details');
      $firstname = $this->getRequest()->getParam('firstname');
      $lastname = $this->getRequest()->getParam('lastname');
      $email = $this->getRequest()->getParam('email');
      $street = $this->getRequest()->getParam('street');
      $mobile = $this->getRequest()->getParam('mobile');

      if ($customer_id == '')
      $store = Mage::app()->getStore();
      $customer = Mage::getModel("customer/customer");
      $customer->setWebsiteId($websiteId)
      ->setStore($store)
      ->setFirstname($firstname)
      ->setLastname($lastname)
      ->setEmail($email)
      ->setPassword('123456');
      $customer->save();
      $customer_id = $customer->getCustomerId();
      else
      $customer = Mage::getModel('customer/customer')->load($customer_id);

      $product_details = json_decode($selected_product_details, true);
      $websiteId = Mage::app()->getWebsite()->getId();
      // Start New Sales Order Quote
      $quote = Mage::getModel('sales/quote')
      ->setStoreId($storeId);
      // Set Sales Order Quote Currency
      $quote->setCurrency($order->AdjustmentAmount->currencyID);
      // Assign Customer To Sales Order Quote
      $quote->assignCustomer($customer);
      // Configure Notification
      $quote->setSendCconfirmation(1);
      foreach ($product_details as $_products)
      $productId = $_products['productId'];
      $qty = $_products['qty'];
      $product = Mage::getModel('catalog/product')->load($productId);
      $quote->addProduct($product, new Varien_Object(array('qty' => $qty)));

      // Set Sales Order Billing Address
      $billingAddress = $quote->getBillingAddress()->addData(array(
      'customer_address_id' => '',
      'prefix' => '',
      'firstname' => $firstname,
      'middlename' => '',
      'lastname' => $lastname,
      'suffix' => '',
      'company' => '',
      'street' => $street,
      'telephone' => $mobile,
      'vat_id' => '',
      'save_in_address_book' => 1
      ));
      // Set Sales Order Shipping Address
      $shippingAddress = $quote->getShippingAddress()->addData(array(
      'customer_address_id' => '',
      'prefix' => '',
      'firstname' => $firstname,
      'middlename' => '',
      'lastname' => $lastname,
      'suffix' => '',
      'company' => '',
      'street' => $street,
      'telephone' => $mobile,
      'vat_id' => '',
      'save_in_address_book' => 1
      ));

      if ($shippingPrice == 0)
      $shippingAddress->setCollectShippingRates(true)
      ->collectShippingRates()
      ->setShippingMethod('freeshipping_freeshipping')
      ->setPaymentMethod('cashondelivery');
      else
      $shippingAddress->setCollectShippingRates(true)
      ->collectShippingRates()
      ->setShippingMethod('flatrate_flatrate')
      ->setPaymentMethod('cashondelivery');


      //Fire event sales_quote_collect_totals_after Before ->collectTotals->save();

      $quote->getPayment()->importData(array('method' => 'cashondelivery'));
      $quote->collectTotals->save();

      // Create Order From Quote
      $service = Mage::getModel('sales/service_quote', $quote);
      $service->submitAll();
      $orderId = $service->getOrder()->getRealOrderId();
      // Resource Clean-Up
      $quote = $customer = $service = null;
      $this->createOrderInvoice($orderId);

      $message = $this->__('Ordered Created Successfully');
      $success = 1;

      //send mail when placing order
      $order_mail = new Mage_Sales_Model_Order();
      $order_mail->loadByIncrementId($orderId);
      $order_mail->sendNewOrderEmail();

      $result = array("success" => $success, "message" => $message, "order_id" => $orderId);
      $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

      catch (Exception $ex)
      $message = $this->__('Something went wrong. Please try again.');
      $success = 0;
      $result = array("success" => $success, "message" => $message);
      $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

      return false;



      Here is config.xml :



      <modules> 
      <Assel_StoreOwners>
      <version>0.1.0</version>
      </Assel_StoreOwners>
      </modules>

      <global>
      <blocks>
      <storeowners>
      <class>Assel_StoreOwners_Block</class>
      </storeowners>
      </blocks>

      <helpers>
      <storeowners>
      <class>Assel_StoreOwners_Helper</class>
      </storeowners>
      </helpers>

      <events>
      <sales_quote_collect_totals_after>
      <observers>
      <set_custom_discount>
      <type>singleton</type>
      <class>Assel_StoreOwners_Model_Observer</class>
      <method>setDiscount</method>
      </set_custom_discount>
      </observers>
      </sales_quote_collect_totals_after>
      </events>
      </global>




      I have create a setDiscount function in observer.php
      But When fire this events i have didn't get quote_id.



      Here is observer.php code :



       function setDiscount($observer) 
      $quote=$observer->getEvent()->getQuote();
      $quoteid=$quote->getId();
      $customer_id = $quote->getCustomerId();



      when call this observer I have didn't get quote_id. But I have getting customer_id.



      Please anyone help me.










      share|improve this question
















      I have create a programmatically order. But when submit order sales_quote_collect_totals_after events fire before save collect totals.

      Here is my code :



      $storeId = Mage::app()->getStore()->getStoreId();
      try
      $customer_id = $this->getRequest()->getParam('customer_id');
      $selected_product_details = $this->getRequest()->getParam('selected_product_details');
      $firstname = $this->getRequest()->getParam('firstname');
      $lastname = $this->getRequest()->getParam('lastname');
      $email = $this->getRequest()->getParam('email');
      $street = $this->getRequest()->getParam('street');
      $mobile = $this->getRequest()->getParam('mobile');

      if ($customer_id == '')
      $store = Mage::app()->getStore();
      $customer = Mage::getModel("customer/customer");
      $customer->setWebsiteId($websiteId)
      ->setStore($store)
      ->setFirstname($firstname)
      ->setLastname($lastname)
      ->setEmail($email)
      ->setPassword('123456');
      $customer->save();
      $customer_id = $customer->getCustomerId();
      else
      $customer = Mage::getModel('customer/customer')->load($customer_id);

      $product_details = json_decode($selected_product_details, true);
      $websiteId = Mage::app()->getWebsite()->getId();
      // Start New Sales Order Quote
      $quote = Mage::getModel('sales/quote')
      ->setStoreId($storeId);
      // Set Sales Order Quote Currency
      $quote->setCurrency($order->AdjustmentAmount->currencyID);
      // Assign Customer To Sales Order Quote
      $quote->assignCustomer($customer);
      // Configure Notification
      $quote->setSendCconfirmation(1);
      foreach ($product_details as $_products)
      $productId = $_products['productId'];
      $qty = $_products['qty'];
      $product = Mage::getModel('catalog/product')->load($productId);
      $quote->addProduct($product, new Varien_Object(array('qty' => $qty)));

      // Set Sales Order Billing Address
      $billingAddress = $quote->getBillingAddress()->addData(array(
      'customer_address_id' => '',
      'prefix' => '',
      'firstname' => $firstname,
      'middlename' => '',
      'lastname' => $lastname,
      'suffix' => '',
      'company' => '',
      'street' => $street,
      'telephone' => $mobile,
      'vat_id' => '',
      'save_in_address_book' => 1
      ));
      // Set Sales Order Shipping Address
      $shippingAddress = $quote->getShippingAddress()->addData(array(
      'customer_address_id' => '',
      'prefix' => '',
      'firstname' => $firstname,
      'middlename' => '',
      'lastname' => $lastname,
      'suffix' => '',
      'company' => '',
      'street' => $street,
      'telephone' => $mobile,
      'vat_id' => '',
      'save_in_address_book' => 1
      ));

      if ($shippingPrice == 0)
      $shippingAddress->setCollectShippingRates(true)
      ->collectShippingRates()
      ->setShippingMethod('freeshipping_freeshipping')
      ->setPaymentMethod('cashondelivery');
      else
      $shippingAddress->setCollectShippingRates(true)
      ->collectShippingRates()
      ->setShippingMethod('flatrate_flatrate')
      ->setPaymentMethod('cashondelivery');


      //Fire event sales_quote_collect_totals_after Before ->collectTotals->save();

      $quote->getPayment()->importData(array('method' => 'cashondelivery'));
      $quote->collectTotals->save();

      // Create Order From Quote
      $service = Mage::getModel('sales/service_quote', $quote);
      $service->submitAll();
      $orderId = $service->getOrder()->getRealOrderId();
      // Resource Clean-Up
      $quote = $customer = $service = null;
      $this->createOrderInvoice($orderId);

      $message = $this->__('Ordered Created Successfully');
      $success = 1;

      //send mail when placing order
      $order_mail = new Mage_Sales_Model_Order();
      $order_mail->loadByIncrementId($orderId);
      $order_mail->sendNewOrderEmail();

      $result = array("success" => $success, "message" => $message, "order_id" => $orderId);
      $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

      catch (Exception $ex)
      $message = $this->__('Something went wrong. Please try again.');
      $success = 0;
      $result = array("success" => $success, "message" => $message);
      $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

      return false;



      Here is config.xml :



      <modules> 
      <Assel_StoreOwners>
      <version>0.1.0</version>
      </Assel_StoreOwners>
      </modules>

      <global>
      <blocks>
      <storeowners>
      <class>Assel_StoreOwners_Block</class>
      </storeowners>
      </blocks>

      <helpers>
      <storeowners>
      <class>Assel_StoreOwners_Helper</class>
      </storeowners>
      </helpers>

      <events>
      <sales_quote_collect_totals_after>
      <observers>
      <set_custom_discount>
      <type>singleton</type>
      <class>Assel_StoreOwners_Model_Observer</class>
      <method>setDiscount</method>
      </set_custom_discount>
      </observers>
      </sales_quote_collect_totals_after>
      </events>
      </global>




      I have create a setDiscount function in observer.php
      But When fire this events i have didn't get quote_id.



      Here is observer.php code :



       function setDiscount($observer) 
      $quote=$observer->getEvent()->getQuote();
      $quoteid=$quote->getId();
      $customer_id = $quote->getCustomerId();



      when call this observer I have didn't get quote_id. But I have getting customer_id.



      Please anyone help me.







      magento-1.9 orders event-observer quote sales






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 '17 at 13:36









      Dinesh Yadav

      4,0931937




      4,0931937










      asked Mar 29 '17 at 13:20









      Rakesh PatidarRakesh Patidar

      132217




      132217





      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 6 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          3 Answers
          3






          active

          oldest

          votes


















          0














          You can use $quote->getEntityId() to get the quote_id






          share|improve this answer

























          • Yes, I have tried $quote->getEntityId() but not success.

            – Rakesh Patidar
            Mar 30 '17 at 4:18











          • Does the order and quote are saved on the database?

            – manumotate
            Mar 31 '17 at 14:08


















          0














          As per my understanding with your code,you are creating order programatically by adding and loading products,customer hence quote id is not generating.Since quote id is generated when a product is added to cart thats why you are not getting quote id.






          share|improve this answer






























            0














            $quote = Mage::getModel('checkout/session')->getQuote();


            $quote->getEntityId(); or $quote->getId();



             $quote = Mage::getModel('checkout/session')->getQuote();
            $grandTotal = 0;
            foreach ($quote->getAllItems() as $item)
            //get all data here






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166764%2fhow-to-get-quote-id-using-sales-quote-collect-totals-after-events%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              You can use $quote->getEntityId() to get the quote_id






              share|improve this answer

























              • Yes, I have tried $quote->getEntityId() but not success.

                – Rakesh Patidar
                Mar 30 '17 at 4:18











              • Does the order and quote are saved on the database?

                – manumotate
                Mar 31 '17 at 14:08















              0














              You can use $quote->getEntityId() to get the quote_id






              share|improve this answer

























              • Yes, I have tried $quote->getEntityId() but not success.

                – Rakesh Patidar
                Mar 30 '17 at 4:18











              • Does the order and quote are saved on the database?

                – manumotate
                Mar 31 '17 at 14:08













              0












              0








              0







              You can use $quote->getEntityId() to get the quote_id






              share|improve this answer















              You can use $quote->getEntityId() to get the quote_id







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Mar 29 '17 at 18:58

























              answered Mar 29 '17 at 14:46









              manumotatemanumotate

              163




              163












              • Yes, I have tried $quote->getEntityId() but not success.

                – Rakesh Patidar
                Mar 30 '17 at 4:18











              • Does the order and quote are saved on the database?

                – manumotate
                Mar 31 '17 at 14:08

















              • Yes, I have tried $quote->getEntityId() but not success.

                – Rakesh Patidar
                Mar 30 '17 at 4:18











              • Does the order and quote are saved on the database?

                – manumotate
                Mar 31 '17 at 14:08
















              Yes, I have tried $quote->getEntityId() but not success.

              – Rakesh Patidar
              Mar 30 '17 at 4:18





              Yes, I have tried $quote->getEntityId() but not success.

              – Rakesh Patidar
              Mar 30 '17 at 4:18













              Does the order and quote are saved on the database?

              – manumotate
              Mar 31 '17 at 14:08





              Does the order and quote are saved on the database?

              – manumotate
              Mar 31 '17 at 14:08













              0














              As per my understanding with your code,you are creating order programatically by adding and loading products,customer hence quote id is not generating.Since quote id is generated when a product is added to cart thats why you are not getting quote id.






              share|improve this answer



























                0














                As per my understanding with your code,you are creating order programatically by adding and loading products,customer hence quote id is not generating.Since quote id is generated when a product is added to cart thats why you are not getting quote id.






                share|improve this answer

























                  0












                  0








                  0







                  As per my understanding with your code,you are creating order programatically by adding and loading products,customer hence quote id is not generating.Since quote id is generated when a product is added to cart thats why you are not getting quote id.






                  share|improve this answer













                  As per my understanding with your code,you are creating order programatically by adding and loading products,customer hence quote id is not generating.Since quote id is generated when a product is added to cart thats why you are not getting quote id.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 25 '17 at 9:59









                  akgolaakgola

                  1,462520




                  1,462520





















                      0














                      $quote = Mage::getModel('checkout/session')->getQuote();


                      $quote->getEntityId(); or $quote->getId();



                       $quote = Mage::getModel('checkout/session')->getQuote();
                      $grandTotal = 0;
                      foreach ($quote->getAllItems() as $item)
                      //get all data here






                      share|improve this answer



























                        0














                        $quote = Mage::getModel('checkout/session')->getQuote();


                        $quote->getEntityId(); or $quote->getId();



                         $quote = Mage::getModel('checkout/session')->getQuote();
                        $grandTotal = 0;
                        foreach ($quote->getAllItems() as $item)
                        //get all data here






                        share|improve this answer

























                          0












                          0








                          0







                          $quote = Mage::getModel('checkout/session')->getQuote();


                          $quote->getEntityId(); or $quote->getId();



                           $quote = Mage::getModel('checkout/session')->getQuote();
                          $grandTotal = 0;
                          foreach ($quote->getAllItems() as $item)
                          //get all data here






                          share|improve this answer













                          $quote = Mage::getModel('checkout/session')->getQuote();


                          $quote->getEntityId(); or $quote->getId();



                           $quote = Mage::getModel('checkout/session')->getQuote();
                          $grandTotal = 0;
                          foreach ($quote->getAllItems() as $item)
                          //get all data here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 18 '18 at 13:37









                          satishsatish

                          18413




                          18413



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166764%2fhow-to-get-quote-id-using-sales-quote-collect-totals-after-events%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                              Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

                              Aasi (pallopeli) Navigointivalikko