Magento 1.9 POA

Add a new attribute, ‘poa’.
Go to Admin→Catalog→Attributes→Manage Attributes and add a new attribute. Call it ‘poa’, set it to type ‘Dropdown’, ‘Global Scope’, Unique Value of ‘No’, Values Required ‘No’, ‘Apply to All Product Types’ and set ‘No’ to all Frontend Properties. EXCEPT : ‘Used in product listing’, Set to ‘yes’ to have the modifications effect the compare, search and list pages.

Under Label Options give it the name ‘POA’ and then add in entries for what you want to show, e.g. ‘POA’, ‘Coming Soon’ and so on. If you want to have an attribute that hotlinks to your contact us page then in the ‘English’ column put some links, so the Default goes to ‘Call for Price’ and the English value is ‘<a href=”contacts”>Call for Price</a>’

Save the attribute and now go into Admin→Catalog→Attributes→Attribute Sets.

Set the attribute to be usable on list pages.
Create a file app/etc/modules/category_product_attributes.xml with the following:
<?xml version=”1.0″?>
<config>
<frontend>
<product>
<collection>
<attributes>
<poa/>
</attributes>
</collection>
</product>
</frontend>
</config>

Now open the template file that shows prices: /app/design/frontend/default/[theme]/template/catalog/product/price.phtml

After the line:
$_product = $this->getProduct();

Add this line:
if ($_product->getAttributeText(‘poa’)==NULL):

Now go to the end of the file and add:
<?php else: ?>
<span class=”regular-price”><?php echo $_product->getAttributeText(‘poa’) ?></span>
<?php endif; ?>

Fix listing pages
Remove add to cart buttons from listing pages, open: /app/design/frontend/default/default/template/catalog/product/list.phtml

There are two instances of this line, one for grid and one for list:
<button type=”button” title=”<?php echo $this->__(‘Add to Cart’) ?>” class=”button btn-cart” onclick=”setLocation(‘<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><span><?php echo $this->__(‘Add to Cart’) ?></span></span></button>

Add an if around them so that that they look like:

<?php if ($_product->getAttributeText(‘poa’)==NULL): ?>
<button class=”button” onclick=”setLocation(‘<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><?php echo $this->__(‘Add to Cart’) ?></span></button>
<?php endif; ?>

Join the Conversation

9 Comments

    1. If I am understanding correctly you want to get the POA link to a contact page?

  1. Following steps above, the ‘price’ is still showing on my product pages for products with the new attribute set to ‘poa’. Now I have POA above price on product pages. How do I remove the ‘price’ and just have POA?

    1. Please could you provide a link to your website? Everything should be done in this file
      /app/design/frontend/default/[theme]/template/catalog/product/price.phtml

  2. Any clue as to how to get it to work for Magento 1.9.1.1 – I’ve followed nearly the same instructions but it spits out a big php error on any pages with a product display…

    1. Hello, could you let me know what PHP error it is spitting out? I have it working on 1.9.1.1

      1. Hi Will,

        The error i’m getting is:

        Fatal error: Call to a member function getSource() on a non-object in /home/datarcom/public_html/dev/DCG/app/code/core/Mage/Catalog/Model/Product.php on line 1385

      2. Hi Will, I’m using the RWD package and it seems to throw an error no matter what i do

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/wwwwebam/public_html/blog/wp-includes/functions.php on line 4339