######################################################################################
# Buy_it_Now Contribution submitted by Wayne Wetterhahn, version 1.0 2002/05/13
#
#     Disclaimer: This contribution is intended for users of osCommerce
# (http://www.oscommerce.com). Users of this contribution, agree to abide by the same
# licensing and restrictions as set by osCommerce.
#
#     This contribution allows osCommerce users to place a "Buy It Now" button in the
# new products this month section of their website. This includes the home page and
# category pages.
#
#     I will show you what I did to get the button inserted and functioning correctly.
# You are responsible for implementing this in your specific version.
#
#     I am using version 1.32 of new_products.php (catalog/includes/modules/new_products.php).
# If you are using this version, you can just upload the files included in this download and
# skip to step 4.
#
#####################################################################################

Step 1:

Make a backup of your new_products.php (catalog/includes/modules/new_products.php) file.
This should always be done prior to modifying any code.

#####################################################################################
Step 2:

Chang line 12 from

?>

to look like this

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEW_PRODUCTS);
?>

#####################################################################################

Step 3:

changed line 32 from

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

to look like this

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW) . '</a>');


NOTE: IF you compare the two lines above, you can clearly see the addition I made.
It's toward the end of the line. If you have a different version of new_products.php
than in this example, just paste the addition I made to your file. All of the
versions I saw have this line in them. The code may differ slightly though.
Make sure you paste it correctly noticing the placement of the closing bracket
and semi-colon.

#######################################################################################

Step 4:

Upload all of the files to your website. There should be two files included in this contribution.

Note: Only upload file #1 included in this download if you are using version 1.32!

File 1: new_products.php (catalog/includes/modules/new_products.php) 
File 2: new_products.php (catalog/includes/languages/new_products.php)

NOTE: File #2 is for the alt text when a user moves his mouse over the buy it now button.

########################################################################################

Step 5. There is no step 4. Your Done. Go test the script to see if it works.

#########################################################################################

Send Comments, Questions, or whatever to

Wayne @ wwetterhahn@yahoo.com

Good Luck
