Magento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updating
I used many update methods for update values in sales_flat_order and sales_flat_order_grid tables.but no method didn't work.
I don't know why the update is not done.
Method 1:-
$coreResource = Mage::getSingleton('core/resource');
$write = $coreResource->getConnection('core_write');
$_field_flat_order =array();
$_field_flat_order['grand_total'] = $order_gt;
$_field_flat_order['base_grand_total'] = $order_gt;
$_field_flat_order['discount_amount'] = $order_discount;
$_field_flat_order['base_discount_amount'] = $order_discount;
$_field_flat_order['discount_description'] = "1%";
$write->update($coreResource->getTableName('sales_flat_order'),$_field_flat_order,array('entity_id = ?' => $order_id,));
Method 2:-
$order_data=Mage::getModel('sales/order')->loadByIncrementId($increment_id);
$order_data->setGrandTotal($order_gt);
$order_data->setBaseGrandTotal($order_gt);
$order_data->setBaseDiscountAmount($order_discount);
$order_data->setDiscountAmount($order_discount);
$order_data->setDiscountDescription("1%");
$order_data->save();
Method 3 :-
$sql_order = "UPDATE sales_flat_order SET grand_total='".$order_gt."',base_grand_total='".$order_gt."',discount_amount='".$order_discount."',base_discount_amount='".$order_discount."',discount_description='1%' WHERE entity_id ='".$order_id."'";
$write->query($sql_order);
No method didn't work, but all other tables are updating perfectly.
Anyone know the reason.?
magento-1.9 sales-order sales-order-grid
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I used many update methods for update values in sales_flat_order and sales_flat_order_grid tables.but no method didn't work.
I don't know why the update is not done.
Method 1:-
$coreResource = Mage::getSingleton('core/resource');
$write = $coreResource->getConnection('core_write');
$_field_flat_order =array();
$_field_flat_order['grand_total'] = $order_gt;
$_field_flat_order['base_grand_total'] = $order_gt;
$_field_flat_order['discount_amount'] = $order_discount;
$_field_flat_order['base_discount_amount'] = $order_discount;
$_field_flat_order['discount_description'] = "1%";
$write->update($coreResource->getTableName('sales_flat_order'),$_field_flat_order,array('entity_id = ?' => $order_id,));
Method 2:-
$order_data=Mage::getModel('sales/order')->loadByIncrementId($increment_id);
$order_data->setGrandTotal($order_gt);
$order_data->setBaseGrandTotal($order_gt);
$order_data->setBaseDiscountAmount($order_discount);
$order_data->setDiscountAmount($order_discount);
$order_data->setDiscountDescription("1%");
$order_data->save();
Method 3 :-
$sql_order = "UPDATE sales_flat_order SET grand_total='".$order_gt."',base_grand_total='".$order_gt."',discount_amount='".$order_discount."',base_discount_amount='".$order_discount."',discount_description='1%' WHERE entity_id ='".$order_id."'";
$write->query($sql_order);
No method didn't work, but all other tables are updating perfectly.
Anyone know the reason.?
magento-1.9 sales-order sales-order-grid
bumped to the homepage by Community♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I used many update methods for update values in sales_flat_order and sales_flat_order_grid tables.but no method didn't work.
I don't know why the update is not done.
Method 1:-
$coreResource = Mage::getSingleton('core/resource');
$write = $coreResource->getConnection('core_write');
$_field_flat_order =array();
$_field_flat_order['grand_total'] = $order_gt;
$_field_flat_order['base_grand_total'] = $order_gt;
$_field_flat_order['discount_amount'] = $order_discount;
$_field_flat_order['base_discount_amount'] = $order_discount;
$_field_flat_order['discount_description'] = "1%";
$write->update($coreResource->getTableName('sales_flat_order'),$_field_flat_order,array('entity_id = ?' => $order_id,));
Method 2:-
$order_data=Mage::getModel('sales/order')->loadByIncrementId($increment_id);
$order_data->setGrandTotal($order_gt);
$order_data->setBaseGrandTotal($order_gt);
$order_data->setBaseDiscountAmount($order_discount);
$order_data->setDiscountAmount($order_discount);
$order_data->setDiscountDescription("1%");
$order_data->save();
Method 3 :-
$sql_order = "UPDATE sales_flat_order SET grand_total='".$order_gt."',base_grand_total='".$order_gt."',discount_amount='".$order_discount."',base_discount_amount='".$order_discount."',discount_description='1%' WHERE entity_id ='".$order_id."'";
$write->query($sql_order);
No method didn't work, but all other tables are updating perfectly.
Anyone know the reason.?
magento-1.9 sales-order sales-order-grid
I used many update methods for update values in sales_flat_order and sales_flat_order_grid tables.but no method didn't work.
I don't know why the update is not done.
Method 1:-
$coreResource = Mage::getSingleton('core/resource');
$write = $coreResource->getConnection('core_write');
$_field_flat_order =array();
$_field_flat_order['grand_total'] = $order_gt;
$_field_flat_order['base_grand_total'] = $order_gt;
$_field_flat_order['discount_amount'] = $order_discount;
$_field_flat_order['base_discount_amount'] = $order_discount;
$_field_flat_order['discount_description'] = "1%";
$write->update($coreResource->getTableName('sales_flat_order'),$_field_flat_order,array('entity_id = ?' => $order_id,));
Method 2:-
$order_data=Mage::getModel('sales/order')->loadByIncrementId($increment_id);
$order_data->setGrandTotal($order_gt);
$order_data->setBaseGrandTotal($order_gt);
$order_data->setBaseDiscountAmount($order_discount);
$order_data->setDiscountAmount($order_discount);
$order_data->setDiscountDescription("1%");
$order_data->save();
Method 3 :-
$sql_order = "UPDATE sales_flat_order SET grand_total='".$order_gt."',base_grand_total='".$order_gt."',discount_amount='".$order_discount."',base_discount_amount='".$order_discount."',discount_description='1%' WHERE entity_id ='".$order_id."'";
$write->query($sql_order);
No method didn't work, but all other tables are updating perfectly.
Anyone know the reason.?
magento-1.9 sales-order sales-order-grid
magento-1.9 sales-order sales-order-grid
edited Feb 14 '18 at 13:03
Navin Bhudiya
7361024
7361024
asked Feb 14 '18 at 12:56
Nagaraj JuroNagaraj Juro
285114
285114
bumped to the homepage by Community♦ 4 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♦ 4 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try:
<?php $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
And:
<?php
$write->query("UPDATE sales_flat_order SET grand_total = '$order_gt', base_grand_total = '$order_gt', discount_amount = '$order_discount', base_discount_amount = '$order_discount', discount_description ='1%' WHERE entity_id = '$order_id'");
?>
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
add a comment |
Having in mind that "While creating invoice to particular order, We can't update sales order tables for that particular order.", you can update that order getting it from the observer Example:
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<unique_identifier>
<type>singleton</type>
<class>Module_SalesOrder_Model_Observer</class>
<method>updateDeliveryDate</method>
</unique_identifier>
</observers>
</sales_order_invoice_save_after>
</events>
...
Observer
class Module_SalesOrder_Model_Observer
{
public function updateDeliveryDate(Varien_Event_Observer $observer) {
$_event = $observer->getEvent();
$_invoice = $_event->getInvoice();
$_order = $_invoice->getOrder();
$_order->setDeliveryAt('2018-03-26 00:00:00');
$_order->save();
}
}
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%2f213499%2fmagento-1-9-sales-flat-order-and-sales-flat-order-grid-tables-are-not-updating%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
Try:
<?php $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
And:
<?php
$write->query("UPDATE sales_flat_order SET grand_total = '$order_gt', base_grand_total = '$order_gt', discount_amount = '$order_discount', base_discount_amount = '$order_discount', discount_description ='1%' WHERE entity_id = '$order_id'");
?>
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
add a comment |
Try:
<?php $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
And:
<?php
$write->query("UPDATE sales_flat_order SET grand_total = '$order_gt', base_grand_total = '$order_gt', discount_amount = '$order_discount', base_discount_amount = '$order_discount', discount_description ='1%' WHERE entity_id = '$order_id'");
?>
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
add a comment |
Try:
<?php $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
And:
<?php
$write->query("UPDATE sales_flat_order SET grand_total = '$order_gt', base_grand_total = '$order_gt', discount_amount = '$order_discount', base_discount_amount = '$order_discount', discount_description ='1%' WHERE entity_id = '$order_id'");
?>
Try:
<?php $write = Mage::getSingleton('core/resource')->getConnection('core_write'); ?>
And:
<?php
$write->query("UPDATE sales_flat_order SET grand_total = '$order_gt', base_grand_total = '$order_gt', discount_amount = '$order_discount', base_discount_amount = '$order_discount', discount_description ='1%' WHERE entity_id = '$order_id'");
?>
edited Feb 15 '18 at 7:21
answered Feb 14 '18 at 14:33
MarcelMarcel
10512
10512
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
add a comment |
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
This is also not working @Marcel,I think there is a connection problem. But thank you.
– Nagaraj Juro
Feb 15 '18 at 9:19
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
Connection problem to Database? In which file you placed the Code? Have you tried the Update... direct in the database (with changed variables in orginal values) to test the query?
– Marcel
Feb 15 '18 at 10:50
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
I am using update query in observer(sales_order_invoice_save_after) file.
– Nagaraj Juro
Feb 15 '18 at 11:25
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
If execute query directly in phpmyadmin,update is working.
– Nagaraj Juro
Feb 15 '18 at 11:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
Maybe this could help you: magento.stackexchange.com/questions/60288/…
– Marcel
Feb 16 '18 at 13:26
add a comment |
Having in mind that "While creating invoice to particular order, We can't update sales order tables for that particular order.", you can update that order getting it from the observer Example:
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<unique_identifier>
<type>singleton</type>
<class>Module_SalesOrder_Model_Observer</class>
<method>updateDeliveryDate</method>
</unique_identifier>
</observers>
</sales_order_invoice_save_after>
</events>
...
Observer
class Module_SalesOrder_Model_Observer
{
public function updateDeliveryDate(Varien_Event_Observer $observer) {
$_event = $observer->getEvent();
$_invoice = $_event->getInvoice();
$_order = $_invoice->getOrder();
$_order->setDeliveryAt('2018-03-26 00:00:00');
$_order->save();
}
}
add a comment |
Having in mind that "While creating invoice to particular order, We can't update sales order tables for that particular order.", you can update that order getting it from the observer Example:
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<unique_identifier>
<type>singleton</type>
<class>Module_SalesOrder_Model_Observer</class>
<method>updateDeliveryDate</method>
</unique_identifier>
</observers>
</sales_order_invoice_save_after>
</events>
...
Observer
class Module_SalesOrder_Model_Observer
{
public function updateDeliveryDate(Varien_Event_Observer $observer) {
$_event = $observer->getEvent();
$_invoice = $_event->getInvoice();
$_order = $_invoice->getOrder();
$_order->setDeliveryAt('2018-03-26 00:00:00');
$_order->save();
}
}
add a comment |
Having in mind that "While creating invoice to particular order, We can't update sales order tables for that particular order.", you can update that order getting it from the observer Example:
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<unique_identifier>
<type>singleton</type>
<class>Module_SalesOrder_Model_Observer</class>
<method>updateDeliveryDate</method>
</unique_identifier>
</observers>
</sales_order_invoice_save_after>
</events>
...
Observer
class Module_SalesOrder_Model_Observer
{
public function updateDeliveryDate(Varien_Event_Observer $observer) {
$_event = $observer->getEvent();
$_invoice = $_event->getInvoice();
$_order = $_invoice->getOrder();
$_order->setDeliveryAt('2018-03-26 00:00:00');
$_order->save();
}
}
Having in mind that "While creating invoice to particular order, We can't update sales order tables for that particular order.", you can update that order getting it from the observer Example:
config.xml
...
<events>
<sales_order_invoice_save_after>
<observers>
<unique_identifier>
<type>singleton</type>
<class>Module_SalesOrder_Model_Observer</class>
<method>updateDeliveryDate</method>
</unique_identifier>
</observers>
</sales_order_invoice_save_after>
</events>
...
Observer
class Module_SalesOrder_Model_Observer
{
public function updateDeliveryDate(Varien_Event_Observer $observer) {
$_event = $observer->getEvent();
$_invoice = $_event->getInvoice();
$_order = $_invoice->getOrder();
$_order->setDeliveryAt('2018-03-26 00:00:00');
$_order->save();
}
}
answered Mar 26 '18 at 22:45
ChristianDChristianD
1033
1033
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%2f213499%2fmagento-1-9-sales-flat-order-and-sales-flat-order-grid-tables-are-not-updating%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