Community Add-Ons

Add file to this package
Top » Features

Multiple Sales Per Product for osCommerce 2.3
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.

Legend:  Download   Report

Expand All / Collapse All

Multiple Sales Per Product for osCommerce 2.3 19 Apr 2015  

Recently we discovered that the multi-nested select queries that I used when I created this contribution were causing some really bad slow downs on our web site. Our site has over 14,000 products (over 11,000 active) and between this and other contributions some search queries were slogging through millions of rows! With this revision the number of rows examined drops to match the total number of products. This contribution now uses a couple of user defined MySQL functions to quickly load the proper sale price and expiration date in those queries (primarily index.php and advanced search) where the sale price needs to be loaded with the query and not at a later time as is done on the product information page.

For those who have already installed this contribution it is highly recommended that you update to this version so you can avoid the slowdowns that we experienced. No changes have been made to the included PHP files. To update you only need to make the changes as noted below. The following instruction changes have been made:

The product index created by osCommerce is dropped in favor of a new special sort index that can also be used like the product index.

Instruction 0 is added and required for all other changed instructions. Make sure you apply that change first.

The following instructions have changed: 13a, 14, 15 (all parts), 16b and 18.

The complete contribution is attached with the new install instructions.

Multiple Sales Per Product for osCommerce 2.3 3 Oct 2014  
Multiple Sales Per Product for osCommerce 2.3 7 Nov 2013  
Multiple Sales Per Product for osCommerce 2.3 1 Nov 2012  
Multiple Sales Per Product for osCommerce 2.3 31 Oct 2012