Magento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updatingObserver on sales_order_invoice_save_afterMagento 1.9 cart not updatingMagento get Seller SKU In invoiceMagento Add value in custom column of sales_flat_order tablesales_flat_order_grid VS sales_flat_order?Magento model not fetching dataSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoMagento 1.9 Where is original price saved in order tables?Order status out of sync between sales_flat_order and sales_flat_order_gridbackend sales order view filter are not working in magento 2?Orders are not inserted in the sales_flat_order and sales_flat_invoice tables Magento 1.9
How can I repair scratches on a painted French door?
Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?
Alphabet completion rate
Counting occurrence of words in table is slow
Calculating the partial sum of a expl3 sequence
In the Marvel universe, can a human have a baby with any non-human?
Fitting a mixture of two normal distributions for a data set?
Was touching your nose a greeting in second millenium Mesopotamia?
First-year PhD giving a talk among well-established researchers in the field
Links to webpages in books
Architecture of networked game engine
What would Earth look like at night in medieval times?
Pull-up sequence accumulator counter
Are Finite Automata Turing Complete?
Cascading Repair Costs following Blown Head Gasket on a 2004 Subaru Outback
A player is constantly pestering me about rules, what do I do as a DM?
Why is C++ initial allocation so much larger than C's?
Singing along to guitar chords (harmony)
Do equal angles necessarily mean a polygon is regular?
Analog is Obtuse!
Find smallest index that is identical to the value in an array
Should I include salary information on my CV?
How can I convince my reader that I will not use a certain trope?
How often can a PC check with passive perception during a combat turn?
Magento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updating
Observer on sales_order_invoice_save_afterMagento 1.9 cart not updatingMagento get Seller SKU In invoiceMagento Add value in custom column of sales_flat_order tablesales_flat_order_grid VS sales_flat_order?Magento model not fetching dataSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoMagento 1.9 Where is original price saved in order tables?Order status out of sync between sales_flat_order and sales_flat_order_gridbackend sales order view filter are not working in magento 2?Orders are not inserted in the sales_flat_order and sales_flat_invoice tables Magento 1.9
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
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
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
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 Jun 17 at 5:17
Aasim Goriya
3,2371 gold badge11 silver badges43 bronze badges
3,2371 gold badge11 silver badges43 bronze badges
asked Feb 14 '18 at 12:56
Nagaraj JuroNagaraj Juro
2981 silver badge15 bronze badges
2981 silver badge15 bronze badges
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
11012 bronze badges
11012 bronze badges
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 bronze badges
1033 bronze badges
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