When I add special pricing for a customer group... I would like it to just show the current price it is at, for example $3.95 in the attached image. I don't want it to show the crossed off "regular price" and new "SPECIAL PRICE". Anyone know how to do that? It seems to show this on the frontend only in the Product Page itself and Wishlist. Thanks
2 Answers
You can also manipulate special price in observers.
Register a Module:
app/etc/modules/Namespace_Module.xml
In Namespace_Module.xml:
<config>
<modules>
<Namespace_Module>
<active>true</active>
<codePool>local</codePool>
</Namespace_Module>
</modules>
</config>
Create a module:
app/code/local/Namespace/Module/
Create a config.xml file:
app/code/local/Namespace/Module/etc/config.xml
In your config.xml of your module:
<?xml version="1.0"?>
<config>
<global>
<models>
<namespace_module>
<class>Namespace_Module_Model</class>
</namespace_module>
</models>
</global>
<frontend> <!--will only trigger in the frontend -->
<events>
<catalog_product_load_after>
<observers>
<namespace_module>
<type>model</type>
<class>namespace_module/observer</class>
<method>catalogProductLoadAfter</method>
</namespace_module>
</observers>
</catalog_product_load_after>
<catalog_product_collection_load_after>
<observers>
<namespace_module>
<type>model</type>
<class>namespace_module/observer</class>
<method>catalogProductCollectionLoadAfter</method>
</namespace_module>
</observers>
</catalog_product_collection_load_after>
</events>
</frontend>
</config>
Create an Observer file:
app/code/local/Namespace/Module/Model/Observer.php
And your observer:
<?php
class Namespace_Module_Model_Observer {
public function catalogProductLoadAfter(Varien_Event_Observer $observer) {
$product = $observer->getEvent()->getProduct();
$product->setSpecialPrice(null);
}
public function catalogProductCollectionLoadAfter(Varien_Event_Observer $observer) {
/** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
$collection = $observer->getEvent()->getCollection();
$collection->walk('setSpecialPrice', array(null));
}
}
Now special price will not be set on products in your frontend store, but will exist in your admin panel.
-
Thanks Ryan. That's exactly how I want it - to be able to set special pricing in the back-end but on the frontend I just want it to show the price with no mention of "regular" or "special" pricing. But...Whereabouts do I find config.xml - within app/code/core somewhere? Is the observer section of the code you mentioned within that config.xml file as well? Commented Feb 12, 2015 at 15:51
-
I have updated my answer to show where you can place your files. Commented Feb 12, 2015 at 15:58
-
Thank you Ryan for the specific details. I made all the changes above and flushed all caches...however, it still is showing the special price / regular price on both the product page and the wishlist. Commented Feb 12, 2015 at 16:35
-
Is the module being registered? Check in System->Configuration->Advanced->Advanced and make sure the module is being loaded. Commented Feb 12, 2015 at 16:36
-
Yep I checked there and Namespace_Module is enabled. Commented Feb 12, 2015 at 16:44
The 'Special Price' section is generated in app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/catalog/product/price.phtml (this of course can be rolling back to pull from other locations or base/default depending on your theme settings).
In that file there are approximately 7 locations that need edited as each section displays based on different tax settings.
You can find the instances of the special price in that file by searching for
<p class="special-price">
Just be sure to make your edits in all locations in that file that you want to update. Save your changes, and clear your Magento caches.
Updated answer below
This is one of the sections that would need edited in price.phtml (line ~245-273).
<p class="old-price">
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?>
</span>
</p>
<p class="special-price">
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
<span class="price-excluding-tax">
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?>
</span>
</span>
<span class="weee">(
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
<?php echo $_weeeSeparator; ?>
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
<?php $_weeeSeparator = ' + '; ?>
<?php endforeach; ?>
)</span>
<span class="price-including-tax">
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
</span>
</span>
</p>
Here is an example of how you could edit it to 1. not display the Regular Price section 2. not display Special Price label
<?php /*
<p class="old-price">
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?>
</span>
</p>
*/ ?>
<p class="special-price">
<?php /* <span class="price-label"><?php echo $this->__('Special Price:') ?></span> */ ?>
<span class="price-excluding-tax">
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?>
</span>
</span>
<span class="weee">(
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
<?php echo $_weeeSeparator; ?>
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
<?php $_weeeSeparator = ' + '; ?>
<?php endforeach; ?>
)</span>
<span class="price-including-tax">
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
</span>
</span>
</p>
You will need to make those type of changes commenting out sections or changing their verbiage anywhere in price.phtml that you see 'Special Price' or 'Regular Price'. After saving you may need to clear your Magento caches to see the updates.
If editing the .phtml file gets a bit daunting (and you are okay with just hiding the information from the site user) you could also just do some CSS like:
.old-price { display:none; } /hides Regular Price when there is a Special Price/ .special-price .price-label { display:none; } /hides the words 'Special Price'/
-
Hello Jason, I was looking at price.phtml in base/default but I wasn't sure exactly how I want to edit the special pricing out of it. Ultimately, I still want to keep the special pricing functionality in the backend but I just want it to show the price in the frontend without any mention of special / regular price. Commented Feb 12, 2015 at 15:48
-
Hello @PremierLighting I've updated the answer with some code examples. Let me know if you have any questions. Commented Feb 12, 2015 at 18:50