/*
  $Id: UPGRADE_ENG.txt,v 1.03 2003/11/09

  Product Availability

  Contribution based on:

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 - 2003 osCommerce

  Released under the GNU General Public License
*/

The module has been designed to be intergrated into osCommerce. 

While the module is based on the release version of osCommerce 2.2 Milestone 2, 
It may be possible to intergrate this module with CVS versions of osCommerce 2.2 but no support is given, 
due to the constantly changing code base of the CVS

********  WHAT DOES IT DO???  **********

This module give you the ability to assign various estimated despatch dates and product availability messages 
to your customers (ala amazon.com)

You can assing various messages to each product and these are then displayed immediately under the 
products price on the product_info.php page


********  TO INSTALL **********

UPGRADE INSTALLATIONS ONLY (FOR NEW INSTALLATIONS SEE THE INCLUDED FILE NAMED INSTALL_ENG.txt)

1). BACKUP BACKUP BACKUP

2). DID I MENTION BACKUP BACKUP BACKUP???

3). Upload all files to corresponding folders of your osCommerce site.

4). You must also perform a few manual alterations to your osCommerce files

5). Read the FAQ


********  IT IS STRONGLY SUGGESTED TO MAKE A BACK-UP OF THESE FILES FIRST **********


MySQL ALTERATIONS

See the SQL_changelog.txt


CATALOG ALTERATIONS

v1.2b > v1.03

In catalog/includes/functions/general.php find:

  function tep_get_products_availability($products_availability_array = '') {
    if (!is_array($products_availability_array)) $products_availability_array = array();

    $products_availability_query = tep_db_query("select products_availability_id, products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " order by products_availability_name");
    while ($products_availability = tep_db_fetch_array($products_availability_query)) {
      $products_availability_array[] = array('id' => $products_availability['products_availability_id'], 'text' => $products_availability['products_availability_name']);
    }

    return $manufacturers_array;
  }

and change to:

  function tep_get_products_availability($products_availability_array = '') {
    if (!is_array($products_availability_array)) $products_availability_array = array();

    $products_availability_query = tep_db_query("select products_availability_id, products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " order by products_availability_name");
    while ($products_availability = tep_db_fetch_array($products_availability_query)) {
      $products_availability_array[] = array('id' => $products_availability['products_availability_id'], 'text' => $products_availability['products_availability_name']);
    }

    return $products_availability_array;
  }


in catalog/products_info.php find:


    $products_availability = $product_info['products_availability_id'];

    $products_availability_info_query = tep_db_query("select e.products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " e where e.products_availability_id = '" . (int)$products_availability . "' and e.languages_id = '" . (int)$languages_id . "'");

    $products_availability_info = tep_db_fetch_array($products_availability_info_query);
    $products_availability_name = $products_availability_info['products_availability_name'];

and change to:

    $products_availability = $product_info['products_availability_id'];

    $products_availability_info_query = tep_db_query("select e.products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " e where e.products_availability_id = '" . (int)$products_availability . "' and e.language_id = '" . (int)$languages_id . "'");

    $products_availability_info = tep_db_fetch_array($products_availability_info_query);
    $products_availability_name = $products_availability_info['products_availability_name'];



v1.0 > v1.02b

In catalog/products_info.php

find the the following code:


<?php
  } else {
    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);

and change to

<?php
  } else {
    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id,  p.products_availability_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);



v1.0 > v1.01

in catalog/products_info.php find:

          <tr>
            <td class="main" align="right" valign="top"></td>
            <td class="main" align="right" valign="top"><b><?php echo TEXT_AVAILABILITY; ?></b>:&nbsp<?php echo $products_availability_name; ?></td>
          </tr>

and replace with

<?php
   if (tep_not_null($products_availability_info['products_availability_name'])) {
?>
         <tr>
           <td class="main" align="right" valign="top"></td>
           <td class="main" align="right" valign="top"><?php echo TEXT_AVAILABILITY; ?>:&nbsp<?php echo $products_availability_name; ?></td>
         </tr>
<?php
   }
?>


ADMIN ALTERATIONS

v1.02 > v1.03

In admin/includes/functions/general.php find:

// Return the shipping ETA in the needed language
// TABLES: products_availability
  function tep_get_products_availability_name($products_availability_id, $language_id) {
    $products_availability_query = tep_db_query("select products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " where products_availability_id = '" . (int)$products_availability_id . "' and languages_id = '" . (int)$language_id . "'");
    $products_availability = tep_db_fetch_array($products_availability_query);

    return $products_availability['products_availability_name'];
  }

and change to:

// Return the shipping ETA in the needed language
// TABLES: products_availability
  function tep_get_products_availability_name($products_availability_id, $language_id) {
    $products_availability_query = tep_db_query("select products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " where products_availability_id = '" . (int)$products_availability_id . "' and language_id = '" . (int)$language_id . "'");
    $products_availability = tep_db_fetch_array($products_availability_query);

    return $products_availability['products_availability_name'];
  }


v1.01 > v1.02

in admin/categories.php find:


         <tr>
           <td class="main" align="right" valign="top"></td>
           <td class="main" align="right" valign="top"><?php echo TEXT_AVAILABILITY; ?>:&nbsp<?php echo $products_availability_name; ?></td>
         </tr>

and replace with:

          <tr>
            <td class="main"><?php echo TEXT_PRODUCTS_AVAILABILITY; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_availability_id', $products_availability_array, $pInfo->products_availability_id); ?></td>
          </tr>


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



********  TO USE THIS MODULE **********

There are a couple of simple settings in the products and shipping sections of your admins configuration that may need editing.

Simply login to the localization section of your admin, select the Products Availability section and edit the various entries to suit your store.

Now go to your categories section and either enter new products or edit current ones. You will now see a drop down option list near the top of the edit/insert page, where you can insert the option of your choice.


********  IT IS STRONGLY SUGGESTED TO MAKE A BACK-UP OF THESE FILES FIRST **********



********  BUGS **********

If you find any bugs please report them at http://forums.snowtech.com.au or at the osCommerce Support Site
 

********  DEVELOPER **********

Steve Kemp   Snowtech Services  	http://www.snowtech.com.au	(Developer)
	Donate via paypal:  		https://www.paypal.com/xclick/business=info%40alpinehosting.net


********  CREDITS **********

Credit to everyone that has inspired me in the development of this evolving module for osCommerce.