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

What is purpose of DB Browser(dbbrowser.aspx) under admin tool?

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

How to keep bees out of canned beverages?

Drawing a german abacus as in the books of Adam Ries

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

How to have a sharp product image?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

Crossed out red box fitting tightly around image

Why must Chinese maps be obfuscated?

Nails holding drywall

Will I lose my paid in full property

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

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

"The cow" OR "a cow" OR "cows" in this context

How bug prioritization works in agile projects vs non agile

Can I criticise the more senior developers around me for not writing clean code?

SFDX - Create Objects with Custom Properties

What does "function" actually mean in music?

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

How do I check if a string is entirely made of the same substring?

Retract an already submitted recommendation letter (written for an undergrad student)

Where was the County of Thurn und Taxis located?

Why do games have consumables?

Is Diceware more secure than a long passphrase?



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

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

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

            Aasi (pallopeli) Navigointivalikko