Post by madaha » Sun Jan 20, 2008 1:07 pm

better hide the price "0.00" too.

Looking for help.

New member

Posts

Joined
Thu Sep 06, 2007 6:02 pm

Post by david.gilbert » Sun Jan 20, 2008 4:28 pm

I added into the product description input by clicking the source button the following code to remove the add to cart buttons on opencart-extras.com

Code: Select all

<style type="text/css">
.buttons { display: none; }
</style>
to disable the price and the buttons just add

Code: Select all

<style type="text/css">
.buttons { display: none; }
.right { display: none; }
</style>

Hope this helps

-Dave

Professional Website Services - http://www.davidmgilbert.com/


User avatar
Active Member

Posts

Joined
Sun Jan 06, 2008 5:02 pm
Location - Mount Compass, South Australia

Post by madaha » Sun Jan 20, 2008 10:12 pm

What I mean is to hide the "add to cart" button if the price is zero. If the price is not zero, I want the button to be there.

New member

Posts

Joined
Thu Sep 06, 2007 6:02 pm

Post by david.gilbert » Sun Jan 20, 2008 10:20 pm

This fix is done per listing. When you add or edit the product, the WYSIWYG editor for the description has a button that says source. If you click that button ad add the code I've posted above at the very top of all that writing and then click the source button again and edit your listings description as normal, it will hide the buttons.

-Dave

Professional Website Services - http://www.davidmgilbert.com/


User avatar
Active Member

Posts

Joined
Sun Jan 06, 2008 5:02 pm
Location - Mount Compass, South Australia

Post by madaha » Wed Jan 23, 2008 11:19 am

I want to handle this by PHP script automatically instead of CSS by hand.

thanks anyway.

New member

Posts

Joined
Thu Sep 06, 2007 6:02 pm

Post by bruce » Wed Jan 23, 2008 12:08 pm

At the bottom of catalog\template\default\content\product.tpl make the following change. I have shown some surrounding code to make it easier to see where.

Code: Select all

  <div class="buttons">
    <table>
      <tr>
        <td align="left"><input type="button" value="<?php echo $button_reviews; ?>" onclick="location='<?php echo $review; ?>'" /></td>
<?php if ($price > 0 ) { ?>        
        <td align="right"><input type="submit" value="<?php echo $button_add_to_cart; ?>" /></td>
<?php }?>
      </tr>
    </table>
  </div>

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by madaha » Wed Jan 23, 2008 4:47 pm

Thanks for help.

It hide all "Add to Cart" buttons no matter what price is.

New member

Posts

Joined
Thu Sep 06, 2007 6:02 pm

Post by bruce » Wed Jan 23, 2008 5:24 pm

:-[ sorry about that, not enough testing on my part.

add the following line of code that sets 'price_amount' to catalog\controller\product.php ( extra code shown for location reference )

Code: Select all

    $view->set('price', $currency->format($tax->calculate($product_info['price'], $product_info['tax_class_id'], $config->get('config_tax'))));
    $view->set('price_amount', $tax->calculate($product_info['price'], $product_info['tax_class_id'], $config->get('config_tax')));

modify what I gave you before in catalog\template\default\content\product.tpl to be as follows

Code: Select all

  <div class="buttons">
    <table>
      <tr>
        <td align="left"><input type="button" value="<?php echo $button_reviews; ?>" onclick="location='<?php echo $review; ?>'" /></td>
<?php if ($price_amount > 0.0 ) { ?>        
        <td align="right"><input type="submit" value="<?php echo $button_add_to_cart; ?>" /></td>
<?php }?>
      </tr>
    </table>
  </div>
You will note that it tests $price_amount this time which is a number, not $price which is text formatted with currency characters.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by madaha » Wed Jan 23, 2008 10:14 pm

thank you so much for your kind help!

New member

Posts

Joined
Thu Sep 06, 2007 6:02 pm
Who is online

Users browsing this forum: No registered users and 11 guests