add block in observer magento 1.9Strategy for rewriting classesNeed to know whole Magento Design PatternsAdd block with observer eventMagento add custom options to cartMagento: Adding block from observer programmaticallyChanging value of Block function from observerMagento 1: use of observers and missing native core setter?Simple Observer not firing on eventAdd a block to a page with event observerobserver cms block
Is there a general effective method to solve Smullyan style Knights and Knaves problems? Is the truth table method the most appropriate one?
Is there a way to make it so the cursor is included when I prtscr key?
How can I get exact maximal value of this expression?
Can a wire having 610-670 THz (frequency of blue light) A.C frequency supply, generate blue light?
Does linking adjectives allow you to talk about multiple variations of something?
Would Brexit have gone ahead by now if Gina Miller had not forced the Government to involve Parliament?
Integrating an absolute function using Mathematica
Under what law can the U.S. arrest International Criminal Court (ICC) judges over war crimes probe?
Four-in-a-line Puzzle
How to prevent bad sectors?
Is there a public standard for 8 and 10 character grid locators?
How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?
Is it ok to put a subplot to a story that is never meant to contribute to the development of the main plot?
What is the 中 in ダウンロード中?
If a person had control of every single cell of their body, would they be able to transform into another creature?
Identify this in soil?
How does an ARM MCU run faster than the external crystal?
How many chess players are over 2500 Elo?
Plot twist where the antagonist wins
Why do airplanes use an axial flow jet engine instead of a more compact centrifugal jet engine?
Show differential operator is not bounded using definition of bounded operators
Riley Rebuses that Share a Common Theme
Is the first derivative operation on a signal a causal system?
Full backup on database creation
add block in observer magento 1.9
Strategy for rewriting classesNeed to know whole Magento Design PatternsAdd block with observer eventMagento add custom options to cartMagento: Adding block from observer programmaticallyChanging value of Block function from observerMagento 1: use of observers and missing native core setter?Simple Observer not firing on eventAdd a block to a page with event observerobserver cms block
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to show labels(BACK ON STOCK) on product when they back to stock,
for this I have added a observer
<global>
<events>
<catalog_product_save_commit_after>
<observers>
<Name_StockLabel_Model_Observer>
<type>singleton</type>
<class>Name_StockLabel_Model_Observer</class>
<method>backInStock</method>
</Name_StockLabel_Model_Observer>
</observers>
</catalog_product_save_commit_after>
</events>
</global>
and in observer am adding trying to add block
public function backInStock(Varien_Event_Observer $observer)
$product = $observer->getEvent()->getProduct();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
$stockItem = $product->getStockItem();
if ($stockItem->getCanBackInStock() && $stockItem->getQty() > $stockItem->getMinQty() && $stockItem->getIsInStock())
WANT TO ADD BLOCK HERE THAT WILL DISPLAY ON PRODUCT IN FRONTEND
Can anyone here advise me how can I add I block here
magento-1.9 magento-1.8 event-observer blocks
add a comment |
I need to show labels(BACK ON STOCK) on product when they back to stock,
for this I have added a observer
<global>
<events>
<catalog_product_save_commit_after>
<observers>
<Name_StockLabel_Model_Observer>
<type>singleton</type>
<class>Name_StockLabel_Model_Observer</class>
<method>backInStock</method>
</Name_StockLabel_Model_Observer>
</observers>
</catalog_product_save_commit_after>
</events>
</global>
and in observer am adding trying to add block
public function backInStock(Varien_Event_Observer $observer)
$product = $observer->getEvent()->getProduct();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
$stockItem = $product->getStockItem();
if ($stockItem->getCanBackInStock() && $stockItem->getQty() > $stockItem->getMinQty() && $stockItem->getIsInStock())
WANT TO ADD BLOCK HERE THAT WILL DISPLAY ON PRODUCT IN FRONTEND
Can anyone here advise me how can I add I block here
magento-1.9 magento-1.8 event-observer blocks
add a comment |
I need to show labels(BACK ON STOCK) on product when they back to stock,
for this I have added a observer
<global>
<events>
<catalog_product_save_commit_after>
<observers>
<Name_StockLabel_Model_Observer>
<type>singleton</type>
<class>Name_StockLabel_Model_Observer</class>
<method>backInStock</method>
</Name_StockLabel_Model_Observer>
</observers>
</catalog_product_save_commit_after>
</events>
</global>
and in observer am adding trying to add block
public function backInStock(Varien_Event_Observer $observer)
$product = $observer->getEvent()->getProduct();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
$stockItem = $product->getStockItem();
if ($stockItem->getCanBackInStock() && $stockItem->getQty() > $stockItem->getMinQty() && $stockItem->getIsInStock())
WANT TO ADD BLOCK HERE THAT WILL DISPLAY ON PRODUCT IN FRONTEND
Can anyone here advise me how can I add I block here
magento-1.9 magento-1.8 event-observer blocks
I need to show labels(BACK ON STOCK) on product when they back to stock,
for this I have added a observer
<global>
<events>
<catalog_product_save_commit_after>
<observers>
<Name_StockLabel_Model_Observer>
<type>singleton</type>
<class>Name_StockLabel_Model_Observer</class>
<method>backInStock</method>
</Name_StockLabel_Model_Observer>
</observers>
</catalog_product_save_commit_after>
</events>
</global>
and in observer am adding trying to add block
public function backInStock(Varien_Event_Observer $observer)
$product = $observer->getEvent()->getProduct();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
$stockItem = $product->getStockItem();
if ($stockItem->getCanBackInStock() && $stockItem->getQty() > $stockItem->getMinQty() && $stockItem->getIsInStock())
WANT TO ADD BLOCK HERE THAT WILL DISPLAY ON PRODUCT IN FRONTEND
Can anyone here advise me how can I add I block here
magento-1.9 magento-1.8 event-observer blocks
magento-1.9 magento-1.8 event-observer blocks
asked May 21 at 11:42
Daniel_12Daniel_12
19510
19510
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can use an alternative way:
Create an attribute say back_on_stock with type Yes/No.
Change you event form catalog_product_save_commit_after to catalog_product_save_before.
Now in observer you can set this new attribute value in your if condition, like:
$product->setBackOnStock(1);
return $this;
Now in Your phtml, you can check this attribute value and show label
Hope above will help!
add a comment |
I don't think you need an observer for that.
Just add a conditon in your template (catalog/product/view.phtml), like this:
//$_product is Mage_Catalog_Model_Product object
<?php if ($this->displayProductStockStatus() && $_product->isAvailable()) :?>
Stock is back
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-block-id')->toHtml()?>
<?php endif;?>
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%2f275456%2fadd-block-in-observer-magento-1-9%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
You can use an alternative way:
Create an attribute say back_on_stock with type Yes/No.
Change you event form catalog_product_save_commit_after to catalog_product_save_before.
Now in observer you can set this new attribute value in your if condition, like:
$product->setBackOnStock(1);
return $this;
Now in Your phtml, you can check this attribute value and show label
Hope above will help!
add a comment |
You can use an alternative way:
Create an attribute say back_on_stock with type Yes/No.
Change you event form catalog_product_save_commit_after to catalog_product_save_before.
Now in observer you can set this new attribute value in your if condition, like:
$product->setBackOnStock(1);
return $this;
Now in Your phtml, you can check this attribute value and show label
Hope above will help!
add a comment |
You can use an alternative way:
Create an attribute say back_on_stock with type Yes/No.
Change you event form catalog_product_save_commit_after to catalog_product_save_before.
Now in observer you can set this new attribute value in your if condition, like:
$product->setBackOnStock(1);
return $this;
Now in Your phtml, you can check this attribute value and show label
Hope above will help!
You can use an alternative way:
Create an attribute say back_on_stock with type Yes/No.
Change you event form catalog_product_save_commit_after to catalog_product_save_before.
Now in observer you can set this new attribute value in your if condition, like:
$product->setBackOnStock(1);
return $this;
Now in Your phtml, you can check this attribute value and show label
Hope above will help!
answered May 22 at 5:21
PawanPawan
2,3892721
2,3892721
add a comment |
add a comment |
I don't think you need an observer for that.
Just add a conditon in your template (catalog/product/view.phtml), like this:
//$_product is Mage_Catalog_Model_Product object
<?php if ($this->displayProductStockStatus() && $_product->isAvailable()) :?>
Stock is back
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-block-id')->toHtml()?>
<?php endif;?>
add a comment |
I don't think you need an observer for that.
Just add a conditon in your template (catalog/product/view.phtml), like this:
//$_product is Mage_Catalog_Model_Product object
<?php if ($this->displayProductStockStatus() && $_product->isAvailable()) :?>
Stock is back
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-block-id')->toHtml()?>
<?php endif;?>
add a comment |
I don't think you need an observer for that.
Just add a conditon in your template (catalog/product/view.phtml), like this:
//$_product is Mage_Catalog_Model_Product object
<?php if ($this->displayProductStockStatus() && $_product->isAvailable()) :?>
Stock is back
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-block-id')->toHtml()?>
<?php endif;?>
I don't think you need an observer for that.
Just add a conditon in your template (catalog/product/view.phtml), like this:
//$_product is Mage_Catalog_Model_Product object
<?php if ($this->displayProductStockStatus() && $_product->isAvailable()) :?>
Stock is back
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('your-block-id')->toHtml()?>
<?php endif;?>
answered May 22 at 5:33
Adarsh KhatriAdarsh Khatri
6,75511644
6,75511644
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%2f275456%2fadd-block-in-observer-magento-1-9%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