Remove decimals from configurable product option price update script in Magento

Many time you need to remove decimal places from magento prices. In this post we going to check the code that can be used to remove decimal places when price is updated by selection of configurable product options –

in file js/varien/product.js about line 773:

change this:

formatPrice: function(price) {
            return formatCurrency(price, this.priceFormat);

to this:

formatPrice: function(price) {
        this.priceFormat.requiredPrecision = 0;
        return formatCurrency(price, this.priceFormat);

Displaying Category name on Magento Product page

The trick is very simple and easy to do. Using the view.phtml file of your theme that can be found on app/design/frontend/your-package/your-theme/template/catalog/product/view.phtml. Open it and add the following code:

		foreach ($cats as $category_id) {
		$_cat = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($category_id);
		echo $_cat->getName();             

How to Change URL Prefix For Custom Post Types in WordPress

While developing our own website with WordPress I came across one issue with URL structure of blog and portfolio pages. I needed to have blog post URL to be To achieve this I used WordPress permalinks settings and added a URL prefix using custom permalinks options as blog/%postname%/

This solved one problem with blog URL and created another one. Now all our portfolio pages also started to have this URL prefix and all url portfolio URL started to have two url prefix with a structure like

We don’t wanted to have this kind of structure at all. After searching around the internet I came across below solution to fix the problem –

We have registered a custom post type for our portfolio and I added below line of code in the post type register function of the plugin.

'rewrite' => array(
'with_front' => false,
'slug'       => 'portfolio'

Hope this helps anyone looking for a solution to problem like this with custom post type. Even if your URL don’t work after adding this code, make sure you refresh your rewrite rules stored in the wp_options table. To refresh that try saving your permalinks settings to default once and than reset it back to your original settings. It will regenerate all rewrite rule and your custom post type URL will start working as per your settings.


Looking to Get Started?

We have an online project planner that is the most simpler way to
get your project started. Start a Project