Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do i add the " Specials " box to my main page under New Products Box on Index


bgrcmodels

Recommended Posts

Posted

Hello,

 

I would like to add a " Box " to my main index page. I wouold like this box to include the " Special's " items and i would like this box located under the " New Products " box on the main page.

 

Can anyone advise me on how to do this.

 

Many Thanks

Ben

Posted

Back up (catalog)/index.php, and go to your catalog/index.php page.

 

Find this line:

 

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

 

Add below it:

<tr>

<td><?php include(FILENAME_SPECIALS); ?></td>

</tr>

 

So it will look like this:

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

<tr>

<td><?php include(FILENAME_SPECIALS); ?></td>

</tr>

 

Not sure if it'll work, but it's worth a try. Just back the file index.php up before you alter it. Then if it doesn't work, you can always switch back. Hope this helps.

Jason

 

Simple 1-2-3 Intructions on how to get, install and configure SSL

 

The Google Sandbox explained

 

Simple to follow instructions on how to change the look of your OSC

 

How To Make A Horrible OSC Website

 

my toolbox: All things WordPress-related - All things Adobe-related - PHP Designer 2007 - Codecanyon Junkie - Crimson Editor - Winmerge - phpMyAdmin - WS_FTP

 

my installed contributions: Category Banners, File Upload feature-.77, Header Tags, Sort_Product_Attributes_1, XSellv2.3, Price Break 1.11.2, wishlist 3.5, rollover_category_images_v1.2, Short_Description_v2.1, UPSXML_v1_2_3, quickbooks qbi_v2_10, allprods v4.4, Mouseover-effect for image-buttons 1.0, Ultimate_SEO, AAP 1.41, Auto Select State Value, Fast Easy Checkout, Dynamic SiteMap v2.0, Image Magic, Links Manager 1.14, Featured Products, Customer Testimonials, Article Manager, FAQ System, and I'm sure more ...

Posted

Save this file as includes/modules/specials_products.php:

<?php

/*

$Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => 'Specials');

 

new contentBoxHeading($info_box_contents);

 

if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS)) {

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($new_products = tep_db_fetch_array($new_products_query)) {

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="33%" valign="top"',

'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'])));

 

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

}

}

}

 

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

 

Now do almost exactly as Jason said except:

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . 'specials_products.php'); ?></td>

</tr>

I haven't tested this but it should look like the products new box except it has just specials in it.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Posted
Save this file as includes/modules/specials_products.php:

Now do almost exactly as Jason said except:

 

I haven't tested this but it should look like the products new box except it has just specials in it.

 

 

This is the error message i get:

 

Warning: main(includes/modules/specials_products.php): failed to open stream: No such file or directory in /home/bend6333/public_html/catalog/index.php on line 320

 

Warning: main(includes/modules/specials_products.php): failed to open stream: No such file or directory in /home/bend6333/public_html/catalog/index.php on line 320

 

Warning: main(): Failed opening 'includes/modules/specials_products.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bend6333/public_html/catalog/index.php on line 320

Posted

ok i have managed to add the specials box now, i dont this by adding the " specials " file to modules folder.

 

it works ok just tht it onnly dosplays 1 item, can i make it display more than that

Posted

Did you copy above text to a text editor and save it as includes/modules/specials_products.php?

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Posted
ok i have managed to add the specials box now, i dont this by adding the " specials " file to modules folder.

 

it works ok just tht it onnly dosplays 1 item, can i make it display more than that

 

What i dont is :

 

1: I copied the " Specils " file from catalog/includes/boxes to catalog/includes/modules

 

2: The i edited catalog/index.php file from this:

<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
</tr>

 

to this:

<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . 'specials.php'); ?></td>
</tr>

 

It copies the specials box foun in the right_coloum exactly and displays it in the index.

 

All i need to do now is know how to make it display the max number of specials. ie. 9 the same as new products box

Posted

I would not know how to display more than one product with the specials box. I tried to edit the above code to do the same thing as the new products box.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Archived

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

×
×
  • Create New...