2

I've setup a simple product with custom options but I would like to hide the base price from the category page (list or grid mode). How can I do this ?

I highlighted the "price" I would like to remove : https://i.stack.imgur.com/VBMzs.png

Here you have my price.phtml code : http://pastebin.com/JGjSQDB7

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
eticha
  • 23
  • 1
  • 4

3 Answers3

1
jQuery(document).ready(function () {
    jQuery('.price-box').each(function () {
        if (jQuery(this).find(jQuery('.minimal-price-link')).length > 0) {
            jQuery(this).find('.regular-price').hide();
        }
    })
})
0

I would hide it using CSS, that will likely be the easiest way to hide the price. I'm not sure what your selectors are called. If you include a link to the site I'm sure you can be helped!

djthoms
  • 3,026
  • 2
  • 31
  • 56
  • In fact, I could hide completely both prices but not only the first one (commenting out a php line). You can see the page at http://extremedata.ca/magento/index.php/ordinateurs-de-bureau.html – eticha Feb 11 '13 at 00:06
  • With a little bit of CSS such as `.category-products .regular-price .price { display: none; }` it will hide the price just like you want. Since the `category-products` selector is **only** called on those page sit should work. See the [image](http://img145.imageshack.us/img145/9241/siteqm.png) – djthoms Feb 11 '13 at 09:52
  • Thank you ! CSS is very usefull in that case :) – eticha Feb 12 '13 at 01:33
0

Since you have jQuery installed, you can do the following:

jQuery(document).ready(function () {
    jQuery('.price-box').each(function () {
        if (jQuery(this).find(jQuery('.minimal-price-link')).length > 0) {
            jQuery(this).find('.regular-price').hide();
        }
    })
})

This loops through .price-box individually and will conditionally hide .regular-price depending on the availability of .minimal-price-link in that given box.

Francis Kim
  • 4,235
  • 4
  • 36
  • 51
  • Thanks for your answer, I'm not familiar with jQuery. I search a little bit about that language but can't find any information about integration in a website. Where do I put your code ? I'll copy-paste my page code (mainly PHP) here if it can help you solve this "problem". Thanks again! – eticha Feb 11 '13 at 02:23
  • wrap it in – Francis Kim Feb 11 '13 at 23:19
  • Thanks however as i'm not familiar with jQuery I couldn't get it to work so I used CSS. – eticha Feb 12 '13 at 01:31
  • jQuery was already installed, you just needed to paste in the code in the right file. Anyway if CSS gives you trouble, you can try my method - it's tested. – Francis Kim Feb 12 '13 at 03:05
  • Also careful with the CSS method as it can hide prices from view even if when you want it to show. – Francis Kim Feb 12 '13 at 03:07