This is a discussion on Nicer Resized Product Images combined with Random New Products and Buy Now button within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; Nicer Resized Product Images combined with Random New Products and Buy Now button ---------- New code in case someone else ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| Nicer Resized Product Images combined with Random New Products and Buy Now button ---------- New code in case someone else has the same problem I had in looking for an all in one for their new_products.php file in the future. This is a combination of three contributions applied over the latest version of osCommerce as of March 2008. version osCommerce Online Merchant v2.2 Release Candidate 2a. This contribution combines the following: * Random images on homepage / on new_products.php * Resized images with FAST cache file for faster loading * BUY NOW feature for each item on the new_products.php page. 1. Changing new items to Random Products: Open the file new_products.php which is found at /catalog/includes/modules/ Find both instances of CODE p.products_date_added desc Change both CODE p.products_date_added desc to CODE RAND() That completes the random images on your new_products.php modification. 2. Resizing images: There are THREE steps to resizing the images on your new_products.php file. FIRST: Go to [via FTP] your /catalog/ install directory create a folder calling it 'img_cache'. Next chmod this file to 777 so it is writable. SECOND: Go to catalog/includes/configure.php and at bottom, just before CODE ?> ADD: CODE /** Cache Resized Images BEGIN**/ define('DIR_WS_PRODUCT_IMAGE_CACHE_FS_PATH',DIR_FS _CATALOG . '/img_cache'); define('DIR_WS_PRODUCT_IMAGE_CACHE_HTTP_PATH',HTTP _SERVER . DIR_WS_HTTP_CATALOG . '/img_cache'); /** Cache Resize Images FINISH **/ THIRD: Open the file new_products.php which is found at /catalog/includes/modules/ and FIND CODE $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . ' ' . $new_products['products_name'] . ' ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))); REPLACE this completely with the following: CODE /** Cache Resized Images BEGIN**/ $fileToResize = DIR_FS_CATALOG . DIR_WS_IMAGES . $new_products['products_image']; $resizedImageResult = resizeImage($fileToResize,SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $resizedImage = $resizedImageResult[0]; $resizedImageWidth = $resizedImageResult[1]; $resizedImageHeight = $resizedImageResult[2]; $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '' . tep_image($resizedImage, $new_products['products_name'], $resizedImageWidth, $resizedImageHeight) . ' ' . $new_products['products_name'] . ' ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) /** Cache Resize Images FINISH **/ 3. Adding the "BUY NOW" button FIRST: Find a .gif image on the internet suitable for your website or create one on your own. Name it button_buy_now.gif Place this file into catalog/includes/languages/english/images/buttons/ SECOND: Open the file new_products.php which is found at /catalog/includes/modules/. Your are going to add CODE .' '. '' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . ' ' so it looks like the code found below in THIRD. THIRD: You are going to change the end of the following code CODE 'text' => '' . tep_image($resizedImage, $new_products['products_name'], $resizedImageWidth, $resizedImageHeight) . ' ' . $new_products['products_name'] . ' ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) So it looks like this CODE 'text' => '' . tep_image($resizedImage, $new_products['products_name'], $resizedImageWidth, $resizedImageHeight) . ' ' . $new_products['products_name'] . ' ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) .' '. '' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . ' '); Here is my final version of new_products.php. REMEMBER I have additional modifications so see my website www.BudoMall.com for an example. CODE
__________________ Michael Sasek osCMax Developer
|
| Sponsored Links | ||
| ||
| |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Nicer Resized Product Images | michael_s | New osCommerce Contributions | 0 | 12-09-2007 03:30 PM |
| Nicer Resized Product Images | michael_s | New osCommerce Contributions | 0 | 03-14-2007 04:55 PM |
| Nicer Resized Product Images | michael_s | New osCommerce Contributions | 0 | 03-14-2007 03:51 PM |
| Nicer Resized Product Images | michael_s | New osCommerce Contributions | 0 | 03-14-2007 03:11 AM |
| Nicer Resized Product Images | michael_s | New osCommerce Contributions | 0 | 03-13-2007 04:50 PM |