Featured Products Infobox V1.3 by Aubrey Kilian <aubrey@mycon.co.za>
for osCommerce V2.2 CVS (http://www.oscommerce.com)
Date: 15/11/2002

Released under the GNU General Public License

---
WHAT IS IT?
---
The purpose of this contribution is to replace the "New Products"
Infobox that appears on the main page and top-level category pages,
to show selected (by the admin) products in the infobox, instead
of new products.  It's been written in such a way that the Infobox
will *not* show up if there are no featured products to display.

On the main default page of oscommerce, a selection of ALL the
featured products will be display, and in top-level categories, only
featured products that belongs to that category.  For example,
"A Bug's Life" is a DVD movie in the sub-category "Cartoons", and
"Cartoons" is a sub-category of "DVD Movies".  If "A Bug's Life" is
made a featured product, it will appear on the main oscommerce page,
and also on the DVD Movies category page, but not on the Hardware
page.  If there are more featured products than the maximum allowed
to be displayed, a random selection will be shown.


---
HOW TO INSTALL
---

Installation should take about 15 to 20 minutes, there are some
copying of files, and then some editing of current files is
necessary.  There are a number of files to be edited, but don't
be put off but this, it's mostly inserting one or two lines
into the file.  Nothing majorly complicated.

* Copy the directory structure that came with this archive, as it is
  into your /catalog and /admin direcories.


* Add the following line to /admin/includes/languages/english.php :

  define('BOX_CATALOG_FEATURED', 'Featured Products');


* Add the following lines into /admin/includes/application_top.php,
  each line at the appropriate place in the file, TABLE_* going with
  the other TABLE_* define lines, etc.
  
  define('FILENAME_FEATURED', 'featured.php');
  define('TABLE_FEATURED', 'featured');


* Add the following line into /admin/includes/boxes/catalog.php, right
  before the line that contains "FILENAME_PRODUCTS_EXPECTED" (line 29
  in the latest cvs version)

  '<a href="' . tep_href_link(FILENAME_FEATURED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_FEATURED . '</a><br>' .


* Add the following line into /catalog/includes/application_top.php,
  
  define('FILENAME_FEATURED', 'featured.php');
  define('FILENAME_FEATURED_PRODUCTS', 'featured_products.php'); // This is the featured products page
  define('TABLE_FEATURED', 'featured');


* In /catalog/includes/application_top.php, insert the following lines
  right after the line that contains "tep_expire_specials();"
  
  // auto expire featured products
  require(DIR_WS_FUNCTIONS . 'featured.php');
  tep_expire_featured();


* In /catalog/includes/languages/english/default.php, add the following
  line right after the line "define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');"
  (roughly line 17) :

  define('TABLE_HEADING_FEATURED_PRODUCTS', 'Featured Products');
  
  and add the following line right before the very last curly bracket,
  after the line "define('HEADING_TITLE', 'Categories');"
  
  define('TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY', 'Featured Products in %s');    


* Add the following line to the end of /catalog/includes/configure.php
  right before the last ?>, and set the value to what you want the maximum
  featured products that should be displayed to be.

  define('MAX_DISPLAY_FEATURED_PRODUCTS', '6');
  define('MAX_DISPLAY_FEATURED_PRODUCTS_LISTING', '10');
  define('FEATURED_PRODUCTS_DISPLAY', false);


* Now edit /catalog/default.php and change the two instances of
  FILENAME_NEW_PRODUCTS to FILENAME_FEATURED


* Now you need to create the database table that will be holding the
  featured products.  You need to run the featured_products.sql file's
  contents in your favourite sql interface to your database, either 
  command-line mysql, or phpmyadmin, or whatever.
  Command line syntax for linux would be something like :
  > mysql -u USERNAME -p DBNAME < featured_products.sql
  Then type your password.
  Use something like phpMyAdmin or something, much easier.



That's it.  So far, the Featured Products has just been installed, but not
activated yet.  It's been written that you can, at will, switch between the
Featured Products box, and the What's New box.  To change it to show the
Featured Products, just changed the FEATURED_PRODUCTS_DISPLAY define line in
the /catalog/includes/configure.php file to true.  Then just go and add your
products that you want to be featured, in the admin panel.


--
HOW TO UNINSTALL
---

* To disable this contribution, all you would need to do is set the value of
  FEATURED_PRODUCTS_DISPLAY in /catalog/includes/configure.php to false.
  This module will automatically display the "New Products for <month>"
  infobox if featured products is disabled in the configure.php
  

* Totally removing the Featured Products Infobox means removing each of
  the lines that were added during the INSTALLATION part of this
  documentation, and then remove the files that were added.


---
HOW TO GET IT GOING
---

All you need to do is to add products into the featured products list from
the Admin section, by going to your admin section's "Catalog" box, and then
clicking on "Featured Products".  The Featured Products section works
exactly like the Specials section, except you don't choose a price.  You can
choose an expiry date for the Featured Product if you so choose.  There is a
status on/off button too.  Any expired Featured Products will automatically
get changed to Off status when their expiry date is reached.

That's it.  I hope some of you find this useful, and if you do, let me know.
Feedback, comments, constructive critisism is always welcome.
If I'm missing something in the archive, please let me know.

---
NEW V1.3 FEATURES
---

Updated to fix several bugs reported via e-mail by the following people,
thanks guys :

Rich Lawrence <Store@RichiesRiches.com>
M. Petrovic <poweranzeigen@t-online.de>
Emiliano Castao <emilianocastano@yahoo.com.ar>

See ChangeLog file for list of bugs fixed.



WARNING:  Upgrading from V1.x to V1.3 is not just an overwrite of the current
          files to the later files.  There are some file edits that need to
          be done too...  So work through the "HOW TO INSTALL" section again
          and make sure you have all the file edits done.



---
Aubrey Kilian
aubrey@mycon.co.za
