Multiple Sales Per Product for osCommerc

for osCommerce Online Merchant v2.3

Our store often sets up sale prices several months in advance due to the lead time for the magazines in which we advertise. Many times the same products are repeated from ad to ad but the sale price changes. Since osCommerce as written only allows one sale price per product but has the potential to set more than one since sale prices are in their own file linked to the products I decided to see about writing my own contribution to allow sales to be set in advance and activated automatically at the proper time. This contribution also allows you to create named sales. The names can be anything you like such as "July Magazine Ad" or "April 15 Newspaper Ad" or "Summer Sale Flyer" or whatever else you like. Each named sale will have its own beginning and ending dates which can overlap if you like. When you create a new sale for a product and associate it with an named sale the product sale will automatically take its beginning and ending dates from the named sale so you won't need to enter those again. On the catalog side specials.php the user will now be able to choose which sale items to view, whether all items on sale, items on sale that aren't associated with a named sale, or only items that are part of a specific named sale. I’ve modified the stock osCommerce specials maintenance enough to allow for the new features and added some basic error checking but focused my attention on writing a new sale price entry utility that focuses on products. In that utility only those sales for the focal product are listed. You can choose different products using either an advanced search or a drop down list of all products. One button click will return you to category/product maintenance with the current focal product selected. I've also added a button in the product information info box of categories.php to take you directly to sale maintenance for that product. This could make life easier since the osCommerce specials maintenance provides no way to search for the sale information for a specific product. This contribution also includes a file that allows you to set sale prices for multiple products at one time. Prices may be set as a dollar amount, dollar reduction or a percentage reduction. Search terms for the applicable products are entered with the sale information. You will then be presented with a list of matching products and the resulting sale prices. Uncheck the boxes for any matching items that aren't supposed to be put on sale and confirm to set all checked matching items on sale at one time. In this version, items where the sale price is more than the warning percentage (defined in admin configuration) off of the regular price will not be automatically checked. In other words, if the warning percentage is left at the default of 50% then sale prices found to be more than 50% off of the regular price will not be checked automatically. You still have the option of checking them manually before clicking the confirm button to set the sale prices. There is a configuration variable that determines whether you are allowed to create unending sale prices. This will appear under My Store in Configuration. If set to true then the expiration date for the sale can be left blank to create sale prices that never expire. If set to false a valid expiration date will be required in order to create a new sale price or named sale. Note that this only applies when you create or edit a sale, it does NOT have any effect on sale prices that are already stored in the database. There is also a configuration that sets up a warning level that requires confirmation if sale prices are set lower than a certain percentage of the regular price and adds the capability to display the sale expiration date and time. Expiration display can be changed in admin and display of date and time is set set separately. The expiration time won't be displayed unless the date is also displayed. Display of expiration time is available since this contribution allows setting the time of expiration for sale prices. For those that use the capability to set expiration time as well as date the expiration time should probably be displayed. Those that simply use the default expiration time of the end of the day don't need to display the expiration time.

Files