Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hide Buy Now Button from Products Marked 'Price on Application'


islandgeek

Recommended Posts

Hi

 

I am working on a new site where I need to hide the price on any products marked 'Price on Application'

 

I have already modified the code so that any product woth a zerp £0 price shows 'Price on Appliation' I now want to hide the add to cart / buy now button from these products.

 

An example of what I am trying to do is here:

www.magsells.co.uk/industrial-grade-microwave-magnetron-water-cooled-msm259m12-p-62.html

 

Any help would be much appreciated.

 

Thank you.

Link to comment
Share on other sites

You will need to open file: product_info.php in the main directory and fin the code for the add to cart button.

 

something similar to:

 

<div class="buttonSet">' . TEXT_ENTER_QUANTITY . tep_draw_input_field('cart_quantity', '1', 'size=3'); ?><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</span></div>' ; ?>

 

and add an if/else statement like this:

 


<?php if ($product_info['products_price'] > 0) { echo ' <div class="buttonSet">' . TEXT_ENTER_QUANTITY . tep_draw_input_field('cart_quantity', '1', 'size=3'); ?><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</span>' ; }

 else {
echo '<div class="buttonSet"></div>'; }
?>

 

So you basically wrap your button into a if statement which says if product_price is more than 0 show the button

else

show nothing.

 

Hope that helps.

Find this post helpful? Click the 'Like this' button. :)

Link to comment
Share on other sites

Hi Aleksander

 

Thanks for replying

 

I find this in product_info.php

 

<div class="buttonSet">

<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>

 

<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>

</div>

 

But I am having problems working out where to inser the code, I have tried and the code works, as in it removes the button but the whole alignment of the pages goes wonky!

 

Please can you advise further?

 

Many Thanks

Link to comment
Share on other sites

Try replacing the section of the code you posted above to this:

 

<?php if ($product_info['products_price'] > 0) {
echo '<div class="buttonSet"><span class="buttonAction">' . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</span>'
. tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); }

else {
echo '<div class="buttonSet">' . tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? '
(' . $reviews['count'] . ')' : ''), 'comment',
tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())) .  '</div>' ; }
?>

 

What this code basically does is if product_price is more than 0 show add to cart button and your reviews button,

and if the price is 0 it shows only the reviews button.

Find this post helpful? Click the 'Like this' button. :)

Link to comment
Share on other sites

Hi Aleksander

 

Brilliant that did the trick, the only problem I found with it was there was un needed opening div in

<div class="buttonSet">

I changed this to

<class="buttonSet">

And it works perfectly.

 

Thank you.

Link to comment
Share on other sites

Great, glad you got it working. :)

 

<class="buttonSet"> on it's own doesn't do anything so you can delete that too.

Find this post helpful? Click the 'Like this' button. :)

Link to comment
Share on other sites

  • 1 month later...

Great, glad you got it working. :)

 

<class="buttonSet"> on it's own doesn't do anything so you can delete that too.

 

1. Removing "div" from <div class="buttonSet"> or deleting <div class="buttonSet"> entirely

a. When price is NOT zero: action #1 shows product info page correctly

b. When price is zero: action #1 shows product info with all boxes now floating to right side

 

2. Keeping <div class="buttonSet">

a. When price is NOT zero: action #1 shows product info with all left boxes completely gone, and all right boxes dropped to bottom of page

b. When price is zero: action #1 shows product info page correctly

 

I can't seem to find a dual solution, so if there is no price showing the boxes stay put, and if there is a price showing they also stay put. Currently have to choose one or the other.

Web Developer, Firebug, and Notepad++ are powerful free tools for web design.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...