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
Cayley's Matrix Notation
Drawing a german abacus as in the books of Adam Ries
Can I criticise the more senior developers around me for not writing clean code?
Is there metaphorical meaning of "aus der Haft entlassen"?
What does "function" actually mean in music?
As an international instructor, should I openly talk about my accent?
Trouble removing package using Yum on CentOS7
All ASCII characters with a given bit count
Multiple fireplaces in an apartment building?
Does a large simulator bay have standard public address announcements?
What is the most expensive material in the world that could be used to create Pun-Pun's lute?
Is it acceptable to use working hours to read general interest books?
"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"
A Paper Record is What I Hamper
Apply a different color ramp to subset of categorized symbols in QGIS?
Contradiction proof for inequality of P and NP?
Find the identical rows in a matrix
Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?
Injection into a proper class and choice without regularity
What is this word supposed to be?
Work requires me to come in early to start computer but wont let me clock in to get paid for it
Can someone publish a story that happened to you?
Was Dennis Ritchie being too modest in this quote about C and Pascal?
Why do distances seem to matter in the Foundation world?
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;
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
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
|
show 3 more comments
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
bumped to the homepage by Community♦ 3 hours 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
|
show 3 more comments
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
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
magento-1.9
edited Jul 20 '17 at 5:34
magento12345
asked Jul 20 '17 at 5:07
magento12345magento12345
171217
171217
bumped to the homepage by Community♦ 3 hours 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♦ 3 hours 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
|
show 3 more comments
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
|
show 3 more comments
2 Answers
2
active
oldest
votes
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.
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
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Jul 20 '17 at 9:58
answered Jul 20 '17 at 9:32
Nagaraju KasaNagaraju Kasa
2,80621742
2,80621742
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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