Custom attribute custom_attribute to quote & order table save from controllerCreate invoice and shipment in magento via cron based on store view and order ageAdd custom field to IWD One page Checkout ExtensionMagento: Adding block from observer programmaticallyShopping cart is empty after cancel the payment in magento-1.9.1.1M1 CE, paypal exception “PayPal NVP gateway errors”SOLVED Magento 1.9 cannot place order “Some transactions have not been committed or rolled back”Magento2 Quote Table to Order items table?Get Shipment Id while creating Shipment in Magento 1.9could not locate setShippingMethod function in magento 1.9Magento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updating

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Why did Rep. Omar conclude her criticism of US troops with the phrase "NotTodaySatan"?

Multiple options vs single option UI

Multiple fireplaces in an apartment building?

Was Dennis Ritchie being too modest in this quote about C and Pascal?

Cayley's Matrix Notation

My bank got bought out, am I now going to have to start filing tax returns in a different state?

Why do distances seem to matter in the Foundation world?

How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?

A faster way to compute the largest prime factor

Restricting the options of a lookup field, based on the value of another lookup field?

Apply a different color ramp to subset of categorized symbols in QGIS?

Why do real positive eigenvalues result in an unstable system? What about eigenvalues between 0 and 1? or 1?

How do I reattach a shelf to the wall when it ripped out of the wall?

Will I lose my paid in full property

How to keep bees out of canned beverages?

A Paper Record is What I Hamper

As an international instructor, should I openly talk about my accent?

How to not starve gigantic beasts

Extracting Dirichlet series coefficients

Can a stored procedure reference the database in which it is stored?

How long after the last departure shall the airport stay open for an emergency return?

Creating a chemical industry from a medieval tech level without petroleum

Injection into a proper class and choice without regularity



Custom attribute custom_attribute to quote & order table save from controller


Create invoice and shipment in magento via cron based on store view and order ageAdd custom field to IWD One page Checkout ExtensionMagento: Adding block from observer programmaticallyShopping cart is empty after cancel the payment in magento-1.9.1.1M1 CE, paypal exception “PayPal NVP gateway errors”SOLVED Magento 1.9 cannot place order “Some transactions have not been committed or rolled back”Magento2 Quote Table to Order items table?Get Shipment Id while creating Shipment in Magento 1.9could not locate setShippingMethod function in magento 1.9Magento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updating






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








0















I have added one Custom attribute custom_attribute to quote & order table I am sending a response to my controller I want to save the response in my custom_attribute to sales_flat_quote & sales_flat_order table
can someone please help me how to achieve this



 $response = $this->getRequest()->getParam('data'); // i am getting response here in my controller 

$quoteModelInstance = Mage::getSingleton('checkout/session')->getQuote();
$customerModelInstance = Mage::getSingleton('customer/session');

$order = Mage::getModel('sales/order');
$order->setQuote($quoteModelInstance);
$order->setCustomAttribute($response);
try
$order->save();

catch (Exception $e)

Mage::logException($e);










share|improve this question
















bumped to the homepage by Community 12 mins ago


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















  • can you please add your code for addition clarification?

    – Vino
    Jul 20 '17 at 5:30











  • @vino Updated s

    – magento12345
    Jul 20 '17 at 5:34











  • you missed $ for response variable.

    – Vino
    Jul 20 '17 at 5:37











  • Did you try $order->setData( 'custom_attribute',$response );

    – Vino
    Jul 20 '17 at 5:42











  • Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

    – Nagaraju Kasa
    Jul 20 '17 at 6:02

















0















I have added one Custom attribute custom_attribute to quote & order table I am sending a response to my controller I want to save the response in my custom_attribute to sales_flat_quote & sales_flat_order table
can someone please help me how to achieve this



 $response = $this->getRequest()->getParam('data'); // i am getting response here in my controller 

$quoteModelInstance = Mage::getSingleton('checkout/session')->getQuote();
$customerModelInstance = Mage::getSingleton('customer/session');

$order = Mage::getModel('sales/order');
$order->setQuote($quoteModelInstance);
$order->setCustomAttribute($response);
try
$order->save();

catch (Exception $e)

Mage::logException($e);










share|improve this question
















bumped to the homepage by Community 12 mins ago


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















  • can you please add your code for addition clarification?

    – Vino
    Jul 20 '17 at 5:30











  • @vino Updated s

    – magento12345
    Jul 20 '17 at 5:34











  • you missed $ for response variable.

    – Vino
    Jul 20 '17 at 5:37











  • Did you try $order->setData( 'custom_attribute',$response );

    – Vino
    Jul 20 '17 at 5:42











  • Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

    – Nagaraju Kasa
    Jul 20 '17 at 6:02













0












0








0








I have added one Custom attribute custom_attribute to quote & order table I am sending a response to my controller I want to save the response in my custom_attribute to sales_flat_quote & sales_flat_order table
can someone please help me how to achieve this



 $response = $this->getRequest()->getParam('data'); // i am getting response here in my controller 

$quoteModelInstance = Mage::getSingleton('checkout/session')->getQuote();
$customerModelInstance = Mage::getSingleton('customer/session');

$order = Mage::getModel('sales/order');
$order->setQuote($quoteModelInstance);
$order->setCustomAttribute($response);
try
$order->save();

catch (Exception $e)

Mage::logException($e);










share|improve this question
















I have added one Custom attribute custom_attribute to quote & order table I am sending a response to my controller I want to save the response in my custom_attribute to sales_flat_quote & sales_flat_order table
can someone please help me how to achieve this



 $response = $this->getRequest()->getParam('data'); // i am getting response here in my controller 

$quoteModelInstance = Mage::getSingleton('checkout/session')->getQuote();
$customerModelInstance = Mage::getSingleton('customer/session');

$order = Mage::getModel('sales/order');
$order->setQuote($quoteModelInstance);
$order->setCustomAttribute($response);
try
$order->save();

catch (Exception $e)

Mage::logException($e);







magento-1.9






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 20 '17 at 5:34







magento12345

















asked Jul 20 '17 at 5:07









magento12345magento12345

171217




171217





bumped to the homepage by Community 12 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 12 mins ago


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














  • can you please add your code for addition clarification?

    – Vino
    Jul 20 '17 at 5:30











  • @vino Updated s

    – magento12345
    Jul 20 '17 at 5:34











  • you missed $ for response variable.

    – Vino
    Jul 20 '17 at 5:37











  • Did you try $order->setData( 'custom_attribute',$response );

    – Vino
    Jul 20 '17 at 5:42











  • Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

    – Nagaraju Kasa
    Jul 20 '17 at 6:02

















  • can you please add your code for addition clarification?

    – Vino
    Jul 20 '17 at 5:30











  • @vino Updated s

    – magento12345
    Jul 20 '17 at 5:34











  • you missed $ for response variable.

    – Vino
    Jul 20 '17 at 5:37











  • Did you try $order->setData( 'custom_attribute',$response );

    – Vino
    Jul 20 '17 at 5:42











  • Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

    – Nagaraju Kasa
    Jul 20 '17 at 6:02
















can you please add your code for addition clarification?

– Vino
Jul 20 '17 at 5:30





can you please add your code for addition clarification?

– Vino
Jul 20 '17 at 5:30













@vino Updated s

– magento12345
Jul 20 '17 at 5:34





@vino Updated s

– magento12345
Jul 20 '17 at 5:34













you missed $ for response variable.

– Vino
Jul 20 '17 at 5:37





you missed $ for response variable.

– Vino
Jul 20 '17 at 5:37













Did you try $order->setData( 'custom_attribute',$response );

– Vino
Jul 20 '17 at 5:42





Did you try $order->setData( 'custom_attribute',$response );

– Vino
Jul 20 '17 at 5:42













Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

– Nagaraju Kasa
Jul 20 '17 at 6:02





Please confirm the table names sales_flat_quote (or) sales_flat_quote_item ?

– Nagaraju Kasa
Jul 20 '17 at 6:02










2 Answers
2






active

oldest

votes


















0














Here I am showing you how to save the values in the sales_flat_order table using checkout_submit_all_after event and observer concept.



Step-1: From your custom controller set the value into session as shown below




/app/code/local/Namespace/ModuleName/controllers/IndexController.php




public function customAction()

$productPayDetails=$this->getRequest()->getPost();//get post values
//write your code here
.
.


$myValue = 2;
Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

(or)

Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();
.
.
$testValue = 10; //Ex: Your attribute value
Mage::getSingleton('core/session')->setCustomerPaymentTotal($testValue);
Mage::getSingleton('core/session')->setCustomerPendingTotal($testValue);



Screen shot: http://prntscr.com/fxz7eu



Step 2: Now Configure an event in config.xml from your custom module




/app/code/local/Namespace/ModuleName/et/config.xml




 <frontend>
<events>
<checkout_submit_all_after>
<observers>
<checkout_submit_all_after>
<class>intermediatepage/observer</class>
<method>checkout_submit_all_after</method>
</checkout_submit_all_after>
</observers>
</checkout_submit_all_after>
</events>
</frontend>


Note: Here i am taking an example with intermediatepage class name



Step 3: Now Create a column in the sales_flat_order for example as shown in the
screenshot http://prntscr.com/fxxqgt



Step 4: create an observer file




/app/code/local/Namespace/ModuleName/Model/Observer.php




<?php

class Namespace_ModuleName_Model_Observer

public function checkout_submit_all_after(Varien_Event_Observer $observer)

$order = $observer->getEvent()->getOrder();
$pendingtotal=Mage::getSingleton('core/session')->getCustomerPendingTotal();
$paymenttotal=Mage::getSingleton('core/session')->getCustomerPaymentTotal();
$order->setOrderPendingPayment($pendingtotal);
$order->setOrderPaymentNow($paymenttotal);
$order->save();

//unset the session values
Mage::getSingleton('core/session')->getCustomerPendingTotal('');
Mage::getSingleton('core/session')->getCustomerPendingTotal('');






Step 5: after done the changes in xml please remove cache and session and please try this in default magento from your custom module in locally.






share|improve this answer

























  • where you are getting the current quote Order ?

    – magento12345
    Jul 20 '17 at 7:17











  • Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

    – Nagaraju Kasa
    Jul 20 '17 at 7:34











  • hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

    – Nagaraju Kasa
    Jul 20 '17 at 8:49


















0














I found another very easy solution for this please follow the steps below:



Step 1:
in your controller action please save the custom attribute value as shown below



Note:- You should create a column for saving the value in sales_flat_quote table
Ex: custom_attribute is the name of the column i have created



public function customAction()

$productPayDetails=$this->getRequest()->getPost();//get post values

$myValue = 2;

Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

(or)

Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();




Step 2: Create a column in the name of custom_attribute in sales_flat_order table



Step 3: now keep the below code in between global tag from config.xml from your custom module



<global> 
<fieldsets>
<sales_convert_quote>
<custom_attribute>
<to_order>*</to_order>
</custom_attribute>
</sales_convert_quote>
<sales_convert_order>
<custom_attribute>
<to_quote>*</to_quote>
</custom_attribute>
</sales_convert_order>
</fieldsets>
</global>


clear cache and session and create an order and check the database.






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%2f184582%2fcustom-attribute-custom-attribute-to-quote-order-table-save-from-controller%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Here I am showing you how to save the values in the sales_flat_order table using checkout_submit_all_after event and observer concept.



    Step-1: From your custom controller set the value into session as shown below




    /app/code/local/Namespace/ModuleName/controllers/IndexController.php




    public function customAction()

    $productPayDetails=$this->getRequest()->getPost();//get post values
    //write your code here
    .
    .


    $myValue = 2;
    Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

    (or)

    Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();
    .
    .
    $testValue = 10; //Ex: Your attribute value
    Mage::getSingleton('core/session')->setCustomerPaymentTotal($testValue);
    Mage::getSingleton('core/session')->setCustomerPendingTotal($testValue);



    Screen shot: http://prntscr.com/fxz7eu



    Step 2: Now Configure an event in config.xml from your custom module




    /app/code/local/Namespace/ModuleName/et/config.xml




     <frontend>
    <events>
    <checkout_submit_all_after>
    <observers>
    <checkout_submit_all_after>
    <class>intermediatepage/observer</class>
    <method>checkout_submit_all_after</method>
    </checkout_submit_all_after>
    </observers>
    </checkout_submit_all_after>
    </events>
    </frontend>


    Note: Here i am taking an example with intermediatepage class name



    Step 3: Now Create a column in the sales_flat_order for example as shown in the
    screenshot http://prntscr.com/fxxqgt



    Step 4: create an observer file




    /app/code/local/Namespace/ModuleName/Model/Observer.php




    <?php

    class Namespace_ModuleName_Model_Observer

    public function checkout_submit_all_after(Varien_Event_Observer $observer)

    $order = $observer->getEvent()->getOrder();
    $pendingtotal=Mage::getSingleton('core/session')->getCustomerPendingTotal();
    $paymenttotal=Mage::getSingleton('core/session')->getCustomerPaymentTotal();
    $order->setOrderPendingPayment($pendingtotal);
    $order->setOrderPaymentNow($paymenttotal);
    $order->save();

    //unset the session values
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');






    Step 5: after done the changes in xml please remove cache and session and please try this in default magento from your custom module in locally.






    share|improve this answer

























    • where you are getting the current quote Order ?

      – magento12345
      Jul 20 '17 at 7:17











    • Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

      – Nagaraju Kasa
      Jul 20 '17 at 7:34











    • hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

      – Nagaraju Kasa
      Jul 20 '17 at 8:49















    0














    Here I am showing you how to save the values in the sales_flat_order table using checkout_submit_all_after event and observer concept.



    Step-1: From your custom controller set the value into session as shown below




    /app/code/local/Namespace/ModuleName/controllers/IndexController.php




    public function customAction()

    $productPayDetails=$this->getRequest()->getPost();//get post values
    //write your code here
    .
    .


    $myValue = 2;
    Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

    (or)

    Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();
    .
    .
    $testValue = 10; //Ex: Your attribute value
    Mage::getSingleton('core/session')->setCustomerPaymentTotal($testValue);
    Mage::getSingleton('core/session')->setCustomerPendingTotal($testValue);



    Screen shot: http://prntscr.com/fxz7eu



    Step 2: Now Configure an event in config.xml from your custom module




    /app/code/local/Namespace/ModuleName/et/config.xml




     <frontend>
    <events>
    <checkout_submit_all_after>
    <observers>
    <checkout_submit_all_after>
    <class>intermediatepage/observer</class>
    <method>checkout_submit_all_after</method>
    </checkout_submit_all_after>
    </observers>
    </checkout_submit_all_after>
    </events>
    </frontend>


    Note: Here i am taking an example with intermediatepage class name



    Step 3: Now Create a column in the sales_flat_order for example as shown in the
    screenshot http://prntscr.com/fxxqgt



    Step 4: create an observer file




    /app/code/local/Namespace/ModuleName/Model/Observer.php




    <?php

    class Namespace_ModuleName_Model_Observer

    public function checkout_submit_all_after(Varien_Event_Observer $observer)

    $order = $observer->getEvent()->getOrder();
    $pendingtotal=Mage::getSingleton('core/session')->getCustomerPendingTotal();
    $paymenttotal=Mage::getSingleton('core/session')->getCustomerPaymentTotal();
    $order->setOrderPendingPayment($pendingtotal);
    $order->setOrderPaymentNow($paymenttotal);
    $order->save();

    //unset the session values
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');






    Step 5: after done the changes in xml please remove cache and session and please try this in default magento from your custom module in locally.






    share|improve this answer

























    • where you are getting the current quote Order ?

      – magento12345
      Jul 20 '17 at 7:17











    • Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

      – Nagaraju Kasa
      Jul 20 '17 at 7:34











    • hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

      – Nagaraju Kasa
      Jul 20 '17 at 8:49













    0












    0








    0







    Here I am showing you how to save the values in the sales_flat_order table using checkout_submit_all_after event and observer concept.



    Step-1: From your custom controller set the value into session as shown below




    /app/code/local/Namespace/ModuleName/controllers/IndexController.php




    public function customAction()

    $productPayDetails=$this->getRequest()->getPost();//get post values
    //write your code here
    .
    .


    $myValue = 2;
    Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

    (or)

    Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();
    .
    .
    $testValue = 10; //Ex: Your attribute value
    Mage::getSingleton('core/session')->setCustomerPaymentTotal($testValue);
    Mage::getSingleton('core/session')->setCustomerPendingTotal($testValue);



    Screen shot: http://prntscr.com/fxz7eu



    Step 2: Now Configure an event in config.xml from your custom module




    /app/code/local/Namespace/ModuleName/et/config.xml




     <frontend>
    <events>
    <checkout_submit_all_after>
    <observers>
    <checkout_submit_all_after>
    <class>intermediatepage/observer</class>
    <method>checkout_submit_all_after</method>
    </checkout_submit_all_after>
    </observers>
    </checkout_submit_all_after>
    </events>
    </frontend>


    Note: Here i am taking an example with intermediatepage class name



    Step 3: Now Create a column in the sales_flat_order for example as shown in the
    screenshot http://prntscr.com/fxxqgt



    Step 4: create an observer file




    /app/code/local/Namespace/ModuleName/Model/Observer.php




    <?php

    class Namespace_ModuleName_Model_Observer

    public function checkout_submit_all_after(Varien_Event_Observer $observer)

    $order = $observer->getEvent()->getOrder();
    $pendingtotal=Mage::getSingleton('core/session')->getCustomerPendingTotal();
    $paymenttotal=Mage::getSingleton('core/session')->getCustomerPaymentTotal();
    $order->setOrderPendingPayment($pendingtotal);
    $order->setOrderPaymentNow($paymenttotal);
    $order->save();

    //unset the session values
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');






    Step 5: after done the changes in xml please remove cache and session and please try this in default magento from your custom module in locally.






    share|improve this answer















    Here I am showing you how to save the values in the sales_flat_order table using checkout_submit_all_after event and observer concept.



    Step-1: From your custom controller set the value into session as shown below




    /app/code/local/Namespace/ModuleName/controllers/IndexController.php




    public function customAction()

    $productPayDetails=$this->getRequest()->getPost();//get post values
    //write your code here
    .
    .


    $myValue = 2;
    Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

    (or)

    Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();
    .
    .
    $testValue = 10; //Ex: Your attribute value
    Mage::getSingleton('core/session')->setCustomerPaymentTotal($testValue);
    Mage::getSingleton('core/session')->setCustomerPendingTotal($testValue);



    Screen shot: http://prntscr.com/fxz7eu



    Step 2: Now Configure an event in config.xml from your custom module




    /app/code/local/Namespace/ModuleName/et/config.xml




     <frontend>
    <events>
    <checkout_submit_all_after>
    <observers>
    <checkout_submit_all_after>
    <class>intermediatepage/observer</class>
    <method>checkout_submit_all_after</method>
    </checkout_submit_all_after>
    </observers>
    </checkout_submit_all_after>
    </events>
    </frontend>


    Note: Here i am taking an example with intermediatepage class name



    Step 3: Now Create a column in the sales_flat_order for example as shown in the
    screenshot http://prntscr.com/fxxqgt



    Step 4: create an observer file




    /app/code/local/Namespace/ModuleName/Model/Observer.php




    <?php

    class Namespace_ModuleName_Model_Observer

    public function checkout_submit_all_after(Varien_Event_Observer $observer)

    $order = $observer->getEvent()->getOrder();
    $pendingtotal=Mage::getSingleton('core/session')->getCustomerPendingTotal();
    $paymenttotal=Mage::getSingleton('core/session')->getCustomerPaymentTotal();
    $order->setOrderPendingPayment($pendingtotal);
    $order->setOrderPaymentNow($paymenttotal);
    $order->save();

    //unset the session values
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');
    Mage::getSingleton('core/session')->getCustomerPendingTotal('');






    Step 5: after done the changes in xml please remove cache and session and please try this in default magento from your custom module in locally.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 20 '17 at 8:52

























    answered Jul 20 '17 at 6:40









    Nagaraju KasaNagaraju Kasa

    2,80621742




    2,80621742












    • where you are getting the current quote Order ?

      – magento12345
      Jul 20 '17 at 7:17











    • Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

      – Nagaraju Kasa
      Jul 20 '17 at 7:34











    • hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

      – Nagaraju Kasa
      Jul 20 '17 at 8:49

















    • where you are getting the current quote Order ?

      – magento12345
      Jul 20 '17 at 7:17











    • Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

      – Nagaraju Kasa
      Jul 20 '17 at 7:34











    • hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

      – Nagaraju Kasa
      Jul 20 '17 at 8:49
















    where you are getting the current quote Order ?

    – magento12345
    Jul 20 '17 at 7:17





    where you are getting the current quote Order ?

    – magento12345
    Jul 20 '17 at 7:17













    Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

    – Nagaraju Kasa
    Jul 20 '17 at 7:34





    Actually i have explained u point no 2 , this is for saving the custom value in the order table just try this and get back with u r doubts thanks

    – Nagaraju Kasa
    Jul 20 '17 at 7:34













    hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

    – Nagaraju Kasa
    Jul 20 '17 at 8:49





    hi@ magento12345 please check now i have updated the code now please check now u can save the data into sales_flat_quote & sales_flat_order tables

    – Nagaraju Kasa
    Jul 20 '17 at 8:49













    0














    I found another very easy solution for this please follow the steps below:



    Step 1:
    in your controller action please save the custom attribute value as shown below



    Note:- You should create a column for saving the value in sales_flat_quote table
    Ex: custom_attribute is the name of the column i have created



    public function customAction()

    $productPayDetails=$this->getRequest()->getPost();//get post values

    $myValue = 2;

    Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

    (or)

    Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();




    Step 2: Create a column in the name of custom_attribute in sales_flat_order table



    Step 3: now keep the below code in between global tag from config.xml from your custom module



    <global> 
    <fieldsets>
    <sales_convert_quote>
    <custom_attribute>
    <to_order>*</to_order>
    </custom_attribute>
    </sales_convert_quote>
    <sales_convert_order>
    <custom_attribute>
    <to_quote>*</to_quote>
    </custom_attribute>
    </sales_convert_order>
    </fieldsets>
    </global>


    clear cache and session and create an order and check the database.






    share|improve this answer





























      0














      I found another very easy solution for this please follow the steps below:



      Step 1:
      in your controller action please save the custom attribute value as shown below



      Note:- You should create a column for saving the value in sales_flat_quote table
      Ex: custom_attribute is the name of the column i have created



      public function customAction()

      $productPayDetails=$this->getRequest()->getPost();//get post values

      $myValue = 2;

      Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

      (or)

      Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();




      Step 2: Create a column in the name of custom_attribute in sales_flat_order table



      Step 3: now keep the below code in between global tag from config.xml from your custom module



      <global> 
      <fieldsets>
      <sales_convert_quote>
      <custom_attribute>
      <to_order>*</to_order>
      </custom_attribute>
      </sales_convert_quote>
      <sales_convert_order>
      <custom_attribute>
      <to_quote>*</to_quote>
      </custom_attribute>
      </sales_convert_order>
      </fieldsets>
      </global>


      clear cache and session and create an order and check the database.






      share|improve this answer



























        0












        0








        0







        I found another very easy solution for this please follow the steps below:



        Step 1:
        in your controller action please save the custom attribute value as shown below



        Note:- You should create a column for saving the value in sales_flat_quote table
        Ex: custom_attribute is the name of the column i have created



        public function customAction()

        $productPayDetails=$this->getRequest()->getPost();//get post values

        $myValue = 2;

        Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

        (or)

        Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();




        Step 2: Create a column in the name of custom_attribute in sales_flat_order table



        Step 3: now keep the below code in between global tag from config.xml from your custom module



        <global> 
        <fieldsets>
        <sales_convert_quote>
        <custom_attribute>
        <to_order>*</to_order>
        </custom_attribute>
        </sales_convert_quote>
        <sales_convert_order>
        <custom_attribute>
        <to_quote>*</to_quote>
        </custom_attribute>
        </sales_convert_order>
        </fieldsets>
        </global>


        clear cache and session and create an order and check the database.






        share|improve this answer















        I found another very easy solution for this please follow the steps below:



        Step 1:
        in your controller action please save the custom attribute value as shown below



        Note:- You should create a column for saving the value in sales_flat_quote table
        Ex: custom_attribute is the name of the column i have created



        public function customAction()

        $productPayDetails=$this->getRequest()->getPost();//get post values

        $myValue = 2;

        Mage::getSingleton("checkout/cart")->getQuote()->setCustomAttribute($myValue)->save();

        (or)

        Mage::getSingleton("checkout/session")->getQuote()->setCustomAttribute($myValue)->save();




        Step 2: Create a column in the name of custom_attribute in sales_flat_order table



        Step 3: now keep the below code in between global tag from config.xml from your custom module



        <global> 
        <fieldsets>
        <sales_convert_quote>
        <custom_attribute>
        <to_order>*</to_order>
        </custom_attribute>
        </sales_convert_quote>
        <sales_convert_order>
        <custom_attribute>
        <to_quote>*</to_quote>
        </custom_attribute>
        </sales_convert_order>
        </fieldsets>
        </global>


        clear cache and session and create an order and check the database.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jul 20 '17 at 9:58

























        answered Jul 20 '17 at 9:32









        Nagaraju KasaNagaraju Kasa

        2,80621742




        2,80621742



























            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%2f184582%2fcustom-attribute-custom-attribute-to-quote-order-table-save-from-controller%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