missed-code Posted January 2, 2004 Share Posted January 2, 2004 I have a few items that have links to other sites for purchase. These items I enter as zero dollars and zero weight in the store. I have searched the forums here, and by reading posts have removed the price and add to cart from all items with zero price by adding this line: ($product_info['products_price'] > 0) However cant find anything in the forums on the buy now button except to remove it completly which I dont want to do. I need to remove the buy now button for these zero price items only. I assume it is in the file product_listing.php however I cant seem to figure out exactly what I need to place in the file. If any one has an idea, please let me know. I am using ms2 Thanks, M-C Link to comment Share on other sites More sharing options...
missed-code Posted January 7, 2004 Author Share Posted January 7, 2004 Does no one know how to remove the buy now button only if price is zero? This has to be simple like everything else in OSC is, I just dont know how ;) The last time I asked was 11-18-03, unanswered....... http://www.oscommerce.com/forums/index.php?showtopic=66621&hl= and a post before that when I asked I said something about my posts going unanswered I was told very few posts ever go answered and then later my post was deleted, I guess I ofended some one by saying it........... Please dont do that this time. Hope some one can help me or has an idea. Thanks, M-C Link to comment Share on other sites More sharing options...
Goanna Posted January 7, 2004 Share Posted January 7, 2004 see, the thing is that there is only one file, product info.php, and that file displays the product information which is stored in the database, not on the server. So if you remove it from product_info.php then it wouldnt show up on any item. Maybe though, you can do this. You can copy the PHP sorce code for the buy now button, and ad it in as part of the product description? Then delete the one on the bottom. Dont know if that will work. Link to comment Share on other sites More sharing options...
missed-code Posted January 7, 2004 Author Share Posted January 7, 2004 Thank you for replying..... The only entries for the buy now button I can find are in the Product_listing.php file. I tried adding a "if"statement to it there, as I see other entries there with "if" statements. But I tried several things and it didnot work. So you are thinking maybe I can add the info for the Buy Now button to the product description then modify it there? WOuld this require removing it from themproduct_listing? thanks for the idea, Ill give that a try later.... Thanks. M-C Link to comment Share on other sites More sharing options...
missed-code Posted January 7, 2004 Author Share Posted January 7, 2004 Hollice, I received your email, Here is how you remove the price and in cart button from displaying if price is zero: In your product_info.php find this code: <td class="pageHeading" align="right" valign="top"><?php echo ($products_price : ''); ?></td> and replace with this: <td class="pageHeading" align="right" valign="top"><?php echo (($product_info['products_price'] > 0) ? $products_price : ''); ?></td> For the in cart button: Find this code: <td class="main" align="right"> <?php echo (tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', ?IMAGE_BUTTON_IN_CART) : ''); ?></td> and replace with: <td class="main" align="right"> <?php echo (($product_info['products_price'] > 0) ? tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', ?IMAGE_BUTTON_IN_CART) : ''); ?></td> Hope this helps you, If you find anything for buy now button please let me know. The buy now button is part of my theme, and would really take away from the site if I removed it altogether, so hoping some one has an answer. Link to comment Share on other sites More sharing options...
Hollice Posted January 7, 2004 Share Posted January 7, 2004 Michael, Thank you! Hope you get the answers that you need. Hollice Link to comment Share on other sites More sharing options...
missed-code Posted January 9, 2004 Author Share Posted January 9, 2004 NP Hollice, glad I could help! Any one with any more ideas on removing the buy now button on items with zero price?? Thanks, M-C Link to comment Share on other sites More sharing options...
aldaffodil Posted January 9, 2004 Share Posted January 9, 2004 I think you would need to put a similar if statement in index.php somewhere in this code: $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); Maybe something like: [/code] if(PRODUCT_LIST_PRICE != "0") { 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); } This isn't tested, and may not be the exact code you need. (They made me take java classes, and then vb classes, and now I use PHP and not either of the other two and it just confuses me!) Link to comment Share on other sites More sharing options...
missed-code Posted January 11, 2004 Author Share Posted January 11, 2004 (They made me take java classes, and then vb classes, and now I use PHP and not either of the other two and it just confuses me!) LMAO! Thanks for the idea, I am going to give that a try. Thanks, M-C Link to comment Share on other sites More sharing options...
gravspeed Posted January 12, 2004 Share Posted January 12, 2004 Just a thought... instead of removing the add to cart button, how about replacing it with a contact for price button that links to the contact us page... Scott Wigle "The first rule of intelligent tinkering is to save all the pieces" Aldo Leopold Link to comment Share on other sites More sharing options...
guanche Posted January 12, 2004 Share Posted January 12, 2004 Just a thought... instead of removing the add to cart button, how about replacing it with a contact for price button that links to the contact us page... How would I go about doing this? I would like to have my customers contact us through the contact us page, come by our location, or call for availability. Link to comment Share on other sites More sharing options...
Guest Posted January 12, 2004 Share Posted January 12, 2004 Hi, I had similar issues with trying to remove the "Buy" button on items where $ value = 0 Have a look at this post http://www.oscommerce.com/forums/index.php?sho...=0entry246845 Hope they help? Cheers, J Link to comment Share on other sites More sharing options...
gravspeed Posted January 12, 2004 Share Posted January 12, 2004 I'm thinking.... totally untested <td class="pageHeading" align="right" valign="top"><?php echo (($product_info['products_price'] > 0) ? $products_price : ''); ?></td> should be a little more like <td class="pageHeading" align="right" valign="top"><?php if ($product_info['product_price'] = 0) {echo "Contact for price";} else { echo $product_price; } ?></td> and something kindof different for the add to cart button... anyone who knows what they're talking about want to have a crack at this? Scott Wigle "The first rule of intelligent tinkering is to save all the pieces" Aldo Leopold Link to comment Share on other sites More sharing options...
gravspeed Posted January 14, 2004 Share Posted January 14, 2004 ok, i've figured it out... it's 6am now so there might be some typos, but it's workin for me.... for starters create new images for the add to cart and buy now buttons and upload them to /includes/languages/english/images/buttons/, then add a line to /includes/languages/english.php around line 263 define('IMAGE_BUTTON_CONTACT_US', 'Contact Us'); in product_info.php around line 93 <td class="pageHeading" align="right" valign="top"><?php echo ($products_price : ''); ?></td> should look like <td class="pageHeading" align="right" valign="top"><?php echo ($product_info['products_price'] > 0) ? $products_price : 'Call for Price' ?></td> around line 213 <td class="main" align="right"> <?php echo (tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?></td> should look like <td class="main" align="right"><?php echo (($product_info['products_price'] > 0) ? tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : '<a href="'.tep_href_link(FILENAME_CONTACT_US).'">'.tep_image_button('button_contact_us.gif', IMAGE_CONTACT_US).'</a>'); ?></td> in /includes/modules/product_listing.php around line 112 $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' '; should look like $lc_text = ' ' . (($listing['products_price'] > 0) ? $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : 'Call for price'). ' '; and around line 133 $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; should look like $lc_text = '<a href="' .(($listing['products_price'] > 0) ? tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) : tep_href_link(FILENAME_CONTACT_US).'">'.tep_image_button('button_contact_sm.gif', IMAGE_CONTACT_US)) . '</a> '; and i think that does it... let me know if it works for you too.... Scott Wigle "The first rule of intelligent tinkering is to save all the pieces" Aldo Leopold Link to comment Share on other sites More sharing options...
gravspeed Posted January 14, 2004 Share Posted January 14, 2004 Very similar modifications must be made to products_new.php and product_reviews.php... if anyone needs help i'll post the code Scott Wigle "The first rule of intelligent tinkering is to save all the pieces" Aldo Leopold Link to comment Share on other sites More sharing options...
missed-code Posted February 5, 2004 Author Share Posted February 5, 2004 Thank you EVERYONE for your help! I used a combination of things from several people. Here are my results and working perfectly fine! Remove Price, add to cart, and buy now button ONLY if price is $0 and display it otherwise. Reason: I have some items that are only purchased from another web site, Affiliates basicly, but displayed in the catalog as a product with a link to Buy in the product description. In your product_info.php find this code: <td class="pageHeading" align="right" valign="top"><?php echo ($products_price : ''); ?></td> and replace with this: <td class="pageHeading" align="right" valign="top"><?php echo (($product_info['products_price'] > 0) ? $products_price : ''); ?></td> Find this code: <td class="main" align="right"> <?php echo (tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?></td> and replace with: <td class="main" align="right"> <?php echo (($product_info['products_price'] > 0) ? tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) : ''); ?></td> Next edit your product_listing.php Find this code: $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' '; And replace with: $lc_text = ' ' . (($listing['products_price'] > 0) ? $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : '') . ' '; Find: $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; And replace with: $lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' : ' '); I do not use the reviews or new products modules, I assume these will need a similar modification if you use them. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.