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

Was Objective-C really a hindrance to Apple software development?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Is there a verb for listening stealthily?

In search of the origins of term censor, I hit a dead end stuck with the greek term, to censor, λογοκρίνω

Philosophers who were composers?

Does Prince Arnaud cause someone holding the Princess to lose?

Can gravitational waves pass through a black hole?

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

How to compute a Jacobian using polar coordinates?

"Working on a knee"

How to translate "red flag" into Spanish?

Suing a Police Officer Instead of the Police Department

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

RIP Packet Format

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

Has a Nobel Peace laureate ever been accused of war crimes?

What happened to Viserion in Season 7?

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

Could a cockatrice have parasitic embryos?

How was Lagrange appointed professor of mathematics so early?

What is ls Largest Number Formed by only moving two sticks in 508?

Is there a possibility to generate a list dynamically in Latex?

Why does Java have support for time zone offsets with seconds precision?

Why aren't road bicycle wheels tiny?



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

                              Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                              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

                              How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2