Expired Products
for osCommerce Online Merchant v2.2
Expired Products adds the ability to flag products with an expiration flag and date. This is very useful when selling things like tickets to events.
This contribution is loosely based on "Products Date Expiry" created by Axel Erpenbach (http://www.oscommerce.com/community/contributions,2064/category,all/search,events). Axel's contribution uses sql queries to filter out expired products. This is a fine method of handling product expiry, but has the downside of requiring that all products be marked with an expiration date.
Rather than filtering out expired products using an expiration date when fetching the data, Expired Products sets a field (products_does_expire) to indicate that the product does or does not expire. This allows you to pull all the products and then filter the results within the code.
Legend: 
Download

Report
Events Calendar (http://addons.oscommerce.com/info/7071)
I've decided to re-work Expired Products to create a better method for selling tickets to events, and displaying that information to customers.
Events Calendar is a fork of Expired Products 1.3c
It is highly recomended that you switch over to Events Calendar as Expired Products will no longer be actively maintained.
File is a dummy file
This contains a number of bug fixes and feaure upgrades.
- Added printable page option to "products_expiring_calendar.php"
- Added calendar code to set class for todays events.
- Cleaned up code to beter integrate with oscommerce.
- Fixed error in calendar code that causes previous and future months events to display as active events.
- Fixed error in tep_count_products_in_category function where it would count expired products.
- Fixed admin/categories.php to display correct product preview.
- Modified the instructions to be a bit more clear.
This is a FULL package
Just a quick modification that adds the experation date to products that expire in index.php
This is a FULL package
1.3a can now display multiple events per day, and highlights the current day.
Version 1.3 adds products_expiring_calendar.php this page displays all expired products within a monthly calendar. This assumes that the events take place on the day the product expires.
This is a FULL package
I had intended to include this in 1.2, but completely forgot.
This is a fix for the admin edit product page. version 1.1 did not bother to check or un-check the products_does_expire checkbox based on it's current state.
in "admin/categories.php"
find
<!-- BEGIN EXPIRED PRODUCT 1.1 -->
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_DATE_EXPIRE; ?><br><small>(YYYY-MM-DD)</small></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateExpire.writeControl(); dateExpire.dateFormat="yyyy-MM-dd";</script><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . TEXT_PRODUCTS_DATE_EXPIRE_CHECK . tep_draw_checkbox_field('products_does_expire', '', '', "1"); ?></td>
</tr>
<!-- END EXPIRED PRODUCT 1.1 -->
Replace With
<!-- BEGIN EXPIRED PRODUCT 1.1 -->
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_DATE_EXPIRE; ?><br><small>(YYYY-MM-DD)</small></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateExpire.writeControl(); dateExpire.dateFormat="yyyy-MM-dd";</script><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . TEXT_PRODUCTS_DATE_EXPIRE_CHECK;
if ($pInfo->products_does_expire == 1) {
echo tep_draw_checkbox_field('products_does_expire', '', true);
} else {
echo tep_draw_checkbox_field('products_does_expire', '');
}
?>
</td>
</tr>
<!-- END EXPIRED PRODUCT 1.1 -->
File included in the FULL package
After submitting the 1.2 release, I noticed an error in "catalog/includes/modules/product_listing.php" and "catalog/includes/modules/new_products.php". I had intended to remove products from the catalog listing on the day the expire. The original code, insted, removed them the day after.
in "catalog/includes/modules/product_listing.php"
and "catalog/includes/modules/new_products.php"
find
// BEGIN EXPIRED PRODUCTS 1.1
if ($listing['products_does_expire'] == 0 || ($listing['products_does_expire'] == 1 && $listing['products_date_expire'] >= date('Y-m-d'))) {
// END EXPIRED PRODUCTS 1.1
replace with
// BEGIN EXPIRED PRODUCTS 1.2a
if ($listing['products_does_expire'] == 0 || ($listing['products_does_expire'] == 1 && $listing['products_date_expire'] > date('Y-m-d'))) {
// END EXPIRED PRODUCTS 1.2a
File included is a FULL package
Version 1.2 now includes products_expiring.php (modified products_new.php) which displays a list of products that are due to expire starting with the products that are closest to their experation date.
This is a FULL package
This fixes a few issues I found in the 1.0 version
1.1
- Fixed misc errors in the instructions.
Mostly due to previously installed contributions.
- Fixed confusing add in catalog/admin/categories.php.
May lead some to add code in wrong section.
- Added comments bounding changes.
This is a FULL package
Expired Products adds the ability to flag products with an expiration flag and date. This is very useful when selling things like tickets to events.
This contribution is loosely based on "Products Date Expiry" created by Axel Erpenbach (http://www.oscommerce.com/community/contributions,2064/category,all/search,events). Axel's contribution uses sql queries to filter out expired products. This is a fine method of handling product expiry, but has the downside of requiring that all products be marked with an expiration date.
Rather than filtering out expired products using an expiration date when fetching the data, Expired Products sets a field (products_does_expire) to indicate that the product does or does not expire. This allows you to pull all the products and then filter the results within the code.