Currently, the alert links (when product is back in stock and price change alert) are simply wrapped in paragraph tags. I would like to surround both of these paragraph tags with <div class="alert-links">[default alert urls code here]</div>

I've looked round /base/default for some answers, and have found base/default/template/productalert/product/view.phtml but this only seems to plug the values from `/base/default/layout/productalert.xml - it looks like the phtml file is called twice, which outputs one paragraph tag after another. So I can't add my wrapper div in here.

I have also tried adding a div in /template/catalog/product/view.phtml around this piece of code:

echo $this->getChildHtml('alert_urls');

This works - the div then shows up in the source code - however, I'm using alert.urls as a reference elsewhere and appending another block under it. This causes the appended block to display inside the wrapper div, rather than under it.

So what's the best way to do this? Probably something involving productalerts.xml?

  • What if i want to add let's say an icon (<i class="icon-alert"></i>) beside text inside p tag?
    – Shahroq
    Nov 13, 2015 at 18:29

1 Answer 1


My advice for you is to create wrapper block in productalerts.xml.

    <reference name="content">
        <reference name="product.info">
            <reference name="alert.urls">
                <block type="core/template" name="alert.urls.wrapper" template="path/to/wrapper.phtml">
                     <block type="productalert/product_view" name="productalert.price" as="productalert_price" template="productalert/product/view.phtml">
                         <action method="preparePriceAlertData"/>
                         <action method="setHtmlClass"><value>alert-price link-price-alert</value></action>
                         <action method="setSignupLabel" translate="value"><value>Sign up for price alert</value></action>
                    <block type="productalert/product_view" name="productalert.stock" as="productalert_stock" template="productalert/product/view.phtml">
                        <action method="prepareStockAlertData"/>
                        <action method="setHtmlClass"><value>alert-stock link-stock-alert</value></action>
                        <action method="setSignupLabel" translate="value"><value>Sign up to get notified when this product is back in stock</value></action>

Than in /path/to/wrapper.phtml you will do

<div class="alert-links">
    <?php echo $this->getChildHtml('productalert_price');?>
    <?php echo $this->getChildHtml('productalert_stock');?>

Now your alert will be wrapped and you still can append other blocks under alert.urls and they will be displayed out of alert-links div.

  • Perfect - exactly the solution I was looking for! Thanks. Feb 13, 2014 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.