How to save custom value in sales_flat_order_grid on order placement?Magento 1.7 Redirect on review_product_view PageEditing existing column in orders gridobserver method sales_order_place_after not executinghow to get value of custom attribute of customer in sales_orde_ place_afterHow magento stores date in created_at fieldHow to save custom attribute in Magento moduleCan't get order object in sales_order_place_after observer method in multi-shippingSimple Observer not firing on eventMagento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updatingEvents when the order is placed is not firing
Is it OK to use personal email ID for faculty job applications or should we use (current) institute's ID
Why isn't aluminium involved in biological processes?
Why don't commercial aircraft adopt a slightly more seaplane-like design to allow safer ditching in case of emergency?
Is there a standard way of referencing line numbers in a draft?
Did Voldemort kill his father before finding out about Horcruxes?
Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"
Why did Steve Rogers choose this character in Endgame?
Can a pizza stone be fixed after soap has been used to clean it?
Why do so many pure math PhD students drop out or leave academia, compared to applied mathematics PhDs?
What happens if there is no space for entry stamp in the passport for US visa?
What "fuel more powerful than anything the West (had) in stock" put Laika in orbit aboard Sputnik 2?
What made Windows ME so crash-prone?
What is the word for "event executor"?
What are "full piece" and "half piece" in chess?
Is this artwork (used in a video game) real?
Why are road bikes (not time trial bikes) used in many triathlons?
Will a contempt of congress lawsuit actually reach the merits?
Manually select/unselect lines before forwarding to stdout
What details should I consider before agreeing for part of my salary to be 'retained' by employer?
Did 007 exist before James Bond?
Can you perfectly wrap a cube with this blocky shape?
Why should I cook the flour first when making bechamel sauce?
Why is my calculation for added length of coax for a double cross antenna different to everyone else's?
Finding the package which provides a given command
How to save custom value in sales_flat_order_grid on order placement?
Magento 1.7 Redirect on review_product_view PageEditing existing column in orders gridobserver method sales_order_place_after not executinghow to get value of custom attribute of customer in sales_orde_ place_afterHow magento stores date in created_at fieldHow to save custom attribute in Magento moduleCan't get order object in sales_order_place_after observer method in multi-shippingSimple Observer not firing on eventMagento 1.9 : sales_flat_order and sales_flat_order_grid tables are not updatingEvents when the order is placed is not firing
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have to save the stock of each product when an order is placed.
The custom module is Tbb_StockRegistrar
. It creates a column called order_stock_message
in sales_flat_order
and sales_flat_order_grid
tables. This is OK.
Then, the observer should save the value in those tables (Not working):
config.xml
<events>
<sales_order_place_after>
<observers>
<checkout_submit_all_after_handler>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</checkout_submit_all_after_handler>
</observers>
</sales_order_place_after>
</events>
Observer.php
<?php
class Tbb_StockRegistrar_Model_Observer
public function save($observer)
$order = $observer->getEvent()->getOrder();
$stocks = $this->saveComment($order);
$this->saveOrderGridColumn($order, $stocks);
protected function saveComment($order)
# Save the stocks as an order comment (Working)
protected function saveOrderGridColumn($order, $stocks)
$stockMessage = ... // It populates the message to be saved
$orderModel = Mage::getModel('sales/order')->load($order->getId());
$orderModel->setOrderStockMessage($stockMessage);
$orderModel->save();
The method setOrderStockMessage
is not saving anything. Why?
Plus, how can I store the same value in sales_flat_order_grid
table on sales_order_place_after
observer?
magento-1.9 php event-observer sales-order
add a comment |
I have to save the stock of each product when an order is placed.
The custom module is Tbb_StockRegistrar
. It creates a column called order_stock_message
in sales_flat_order
and sales_flat_order_grid
tables. This is OK.
Then, the observer should save the value in those tables (Not working):
config.xml
<events>
<sales_order_place_after>
<observers>
<checkout_submit_all_after_handler>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</checkout_submit_all_after_handler>
</observers>
</sales_order_place_after>
</events>
Observer.php
<?php
class Tbb_StockRegistrar_Model_Observer
public function save($observer)
$order = $observer->getEvent()->getOrder();
$stocks = $this->saveComment($order);
$this->saveOrderGridColumn($order, $stocks);
protected function saveComment($order)
# Save the stocks as an order comment (Working)
protected function saveOrderGridColumn($order, $stocks)
$stockMessage = ... // It populates the message to be saved
$orderModel = Mage::getModel('sales/order')->load($order->getId());
$orderModel->setOrderStockMessage($stockMessage);
$orderModel->save();
The method setOrderStockMessage
is not saving anything. Why?
Plus, how can I store the same value in sales_flat_order_grid
table on sales_order_place_after
observer?
magento-1.9 php event-observer sales-order
add a comment |
I have to save the stock of each product when an order is placed.
The custom module is Tbb_StockRegistrar
. It creates a column called order_stock_message
in sales_flat_order
and sales_flat_order_grid
tables. This is OK.
Then, the observer should save the value in those tables (Not working):
config.xml
<events>
<sales_order_place_after>
<observers>
<checkout_submit_all_after_handler>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</checkout_submit_all_after_handler>
</observers>
</sales_order_place_after>
</events>
Observer.php
<?php
class Tbb_StockRegistrar_Model_Observer
public function save($observer)
$order = $observer->getEvent()->getOrder();
$stocks = $this->saveComment($order);
$this->saveOrderGridColumn($order, $stocks);
protected function saveComment($order)
# Save the stocks as an order comment (Working)
protected function saveOrderGridColumn($order, $stocks)
$stockMessage = ... // It populates the message to be saved
$orderModel = Mage::getModel('sales/order')->load($order->getId());
$orderModel->setOrderStockMessage($stockMessage);
$orderModel->save();
The method setOrderStockMessage
is not saving anything. Why?
Plus, how can I store the same value in sales_flat_order_grid
table on sales_order_place_after
observer?
magento-1.9 php event-observer sales-order
I have to save the stock of each product when an order is placed.
The custom module is Tbb_StockRegistrar
. It creates a column called order_stock_message
in sales_flat_order
and sales_flat_order_grid
tables. This is OK.
Then, the observer should save the value in those tables (Not working):
config.xml
<events>
<sales_order_place_after>
<observers>
<checkout_submit_all_after_handler>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</checkout_submit_all_after_handler>
</observers>
</sales_order_place_after>
</events>
Observer.php
<?php
class Tbb_StockRegistrar_Model_Observer
public function save($observer)
$order = $observer->getEvent()->getOrder();
$stocks = $this->saveComment($order);
$this->saveOrderGridColumn($order, $stocks);
protected function saveComment($order)
# Save the stocks as an order comment (Working)
protected function saveOrderGridColumn($order, $stocks)
$stockMessage = ... // It populates the message to be saved
$orderModel = Mage::getModel('sales/order')->load($order->getId());
$orderModel->setOrderStockMessage($stockMessage);
$orderModel->save();
The method setOrderStockMessage
is not saving anything. Why?
Plus, how can I store the same value in sales_flat_order_grid
table on sales_order_place_after
observer?
magento-1.9 php event-observer sales-order
magento-1.9 php event-observer sales-order
edited Jul 8 at 14:19
Abdul Pathan
3507 bronze badges
3507 bronze badges
asked Jul 8 at 13:35
Alejandro AraujoAlejandro Araujo
83 bronze badges
83 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Need to change as per below code config.xml
<events>
<sales_order_place_after>
<observers>
<Tbb_StockRegistrar_Model_Observer>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</Tbb_StockRegistrar_Model_Observer>
</observers>
</sales_order_place_after>
</events>
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
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%2f281225%2fhow-to-save-custom-value-in-sales-flat-order-grid-on-order-placement%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Need to change as per below code config.xml
<events>
<sales_order_place_after>
<observers>
<Tbb_StockRegistrar_Model_Observer>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</Tbb_StockRegistrar_Model_Observer>
</observers>
</sales_order_place_after>
</events>
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
add a comment |
Need to change as per below code config.xml
<events>
<sales_order_place_after>
<observers>
<Tbb_StockRegistrar_Model_Observer>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</Tbb_StockRegistrar_Model_Observer>
</observers>
</sales_order_place_after>
</events>
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
add a comment |
Need to change as per below code config.xml
<events>
<sales_order_place_after>
<observers>
<Tbb_StockRegistrar_Model_Observer>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</Tbb_StockRegistrar_Model_Observer>
</observers>
</sales_order_place_after>
</events>
Need to change as per below code config.xml
<events>
<sales_order_place_after>
<observers>
<Tbb_StockRegistrar_Model_Observer>
<type>model</type>
<class>Tbb_StockRegistrar_Model_Observer</class>
<method>save</method>
</Tbb_StockRegistrar_Model_Observer>
</observers>
</sales_order_place_after>
</events>
edited Jul 9 at 7:08
answered Jul 8 at 15:22
MSAMSA
1,4023 silver badges17 bronze badges
1,4023 silver badges17 bronze badges
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
add a comment |
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
Worked! TYVM!!!
– Alejandro Araujo
Jul 8 at 15:53
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%2f281225%2fhow-to-save-custom-value-in-sales-flat-order-grid-on-order-placement%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