Post by ryrocks » Wed Apr 25, 2012 10:21 pm

Hi,

Is it possible to remove the product price and "add to basket" button from the homepage (featured items) and category pages?

I only want to show the price and 'add to basket' button on the individual product page itself.

Thanks,

Ryan

New member

Posts

Joined
Sat Apr 21, 2012 3:15 am

Post by Avvici » Wed Apr 25, 2012 11:14 pm

You will do that in their respective tpl's
catalog/view/theme/your_theme/template/module/featured.tpl

Replace all of the code in the page with this:

Code: Select all

<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-product">
      <?php foreach ($products as $product) { ?>
      <div>
        <?php if ($product['thumb']) { ?>
        <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
        <?php } ?>
        <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
      </div>
      <?php } ?>
    </div>
  </div>
</div>
Now you only display name and image.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by ryrocks » Thu Apr 26, 2012 4:58 am

Awesome :D

Please can you explain how I can do this for the category pages? And also the bestsellers and latest products?

Thanks,

Ryan

New member

Posts

Joined
Sat Apr 21, 2012 3:15 am

Post by ryrocks » Thu Apr 26, 2012 5:45 am

I have managed to remove it from the category, bestsellers, latest etc by adding display:none to the relevant css.

Example:

.product-list .cart {
display:none;
}

.product-list .price {
display:none;
}

I'm all proud of myself now :P

New member

Posts

Joined
Sat Apr 21, 2012 3:15 am

Post by Avvici » Thu Apr 26, 2012 6:55 am

Now you're thinking.!! Good job in using display:none; and not visibility:hidden ;

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by ocmr » Fri May 18, 2012 11:26 pm

Hi Ryrocks,
I have the same demand from my employer to remove the price from category. But I'm not sure where to find the relevant css for category. Thanks for your advice

Newbie

Posts

Joined
Tue Apr 24, 2012 7:19 am

Post by ryrocks » Fri May 18, 2012 11:33 pm

You can edit all this from the main stylesheet found here:

catalog/view/theme/'your-template'/stylesheet

New member

Posts

Joined
Sat Apr 21, 2012 3:15 am

Post by ocmr » Sat May 19, 2012 12:07 am

That's what I thought the first time, but I did not replace the code, I just added another line. And that did not work well. Thanks for the advice.

Newbie

Posts

Joined
Tue Apr 24, 2012 7:19 am

Post by ryrocks » Sat May 19, 2012 12:35 am

Make sure you add it to the bottom of the CSS file. For my problem (see above), I added the following code to the bottom of the stylesheet:

Code: Select all

.product-list .cart {
display:none;
}

.product-list .price {
display:none;
}


New member

Posts

Joined
Sat Apr 21, 2012 3:15 am

Post by kylefultz » Thu Mar 27, 2014 2:37 am

okay I have tried all the above and still nothing in category view - its still showing price

put it in openshop theme, and default

have everything working perfect - just one more price to remove

Newbie

Posts

Joined
Sat Mar 15, 2014 12:02 pm

Post by mainapatrick2937 » Tue Apr 06, 2021 5:29 am

REMOVING PRICE FROME HOMEPAGE AND CATALOGUE IN OPENCART 3

Navigate to

/home/eapackag/public_html/catalog/view/theme/default/template/extension/module/featured.twig

then delete this line of code and save remember to make a backup before attempting

{% endif %}
{% if product.price %}
<p class="price">
{% if not product.special %}
{{ product.price }}
{% else %}
<span class="price-new">{{ product.special }}</span> <span class="price-old">{{ product.price }}</span>
{% endif %}
{% if product.tax %}
<span class="price-tax">{{ text_tax }} {{ product.tax }}</span>
{% endif %}

thats all


Posts

Joined
Sat Mar 13, 2021 9:42 pm
Who is online

Users browsing this forum: Bing [Bot] and 19 guests