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

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Is there a verb for listening stealthily?

What is the numbering system used for the DSN dishes?

Is there a way to fake a method response using Mock or Stubs?

Why do people think Winterfell crypts is the safest place for women, children & old people?

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

France's Public Holidays' Puzzle

Will I be more secure with my own router behind my ISP's router?

Why did Israel vote against lifting the American embargo on Cuba?

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

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

Why is water being consumed when my shutoff valve is closed?

How do I deal with an erroneously large refund?

What's the difference between using dependency injection with a container and using a service locator?

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

SQL Server placement of master database files vs resource database files

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

What's parked in Mil Moscow helicopter plant?

Determinant of a matrix with 2 equal rows

RIP Packet Format

Is there an efficient way for synchronising audio events real-time with LEDs using an MCU?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

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

What happened to Viserion in Season 7?



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 10 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 10 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 10 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 10 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

                              منجزی محتویات تیره‌های طایفه منجزی[ویرایش] مشاهیر طایفه منجزی[ویرایش] محل سکونت[ویرایش] پانویس[ویرایش] منابع[ویرایش] منوی ناوبری«نمودار اجتماعی طوایف بختیاری»«BakhtyārBAḴTĪĀRĪ TRIBE»«اسامی طوایف و شعب ایل بختیاری»ووگسترش آن

                              What does the writing on Poe's helmet say? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Favorite questions and answers from first quarter of 2019 Latest Blog Post: Avengers: Endgame PredictionsWhat is the purpose of the blast shield helmet?Why was the Stormtrooper helmet designed this way?What does Kylo Ren place his helmet on?What does the writing on Poe Dameron's flight vest say?Is this Poe Damerons dad? (Kes Dameron)Is Poe Dameron Force-Sensitive?Why is Poe Dameron so shocked in the First Order star destroyer hangar?What does the code breaker's hat say?In “The Last Jedi” was it actually Poe's fault that so much of the resistance died?Did Poe Dameron make custom modifications to his black X-Wing?

                              How to implement Time Range Picker in Magento 2 Admin system.xml? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Date field system.xmlMagento 2 - time picker on backend (xml form)How to overwrite System.xml?Magento 2 Pattern Library — Date & Time SelectorsHTTP 500 Error in System ConfigurationMagento 2 - time picker on backend (xml form)Magento 2 Add Datetime picker in system.xmlDate Time picker and time zone woesHow to implement Single Date and Time Picker in Magento 2Custom Module for Custom Column using Plugin Yes/No optionMagento 2 DateTime picker - Limit time selection rangeMagento2 UI Component admin Grid / Listing stuck loading