osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Nicer Resized Product Images combined with Random New Products and Buy Now button

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > New osCommerce Contributions

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 03-18-2008, 01:11 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,967
Thanks: 80
Thanked 345 Times in 324 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Post Nicer Resized Product Images combined with Random New Products and Buy Now button

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


  • osCMax Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Advertisement
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 01:04 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax