Expirable Product

Contrib type: 
Module
Status: 
Work in progress
Compatibility: 
Ubercart Alpha 7b
Latest version: 
5.x-1.0-alpha3

Thanks to this module, you can create expirable products. A new 'expiry' tab appears when you edit a product (eg: node/15/edit/expiry) and you can enter several expiry periods for a product (eg: 1 month, 3 months, 6 months...).

You can define too a reminder (triggered before product expiry) and a different price for each period.

Then, when a user view the product, there is a select box displayed in order to choose the period to purchase. The price associated to this period replaces the default product price in the cart view.

TODO: The default product price should be automatically hidden, or dymamically changed if javascript is enabled.

Note that once a user purchased an expirable product, then the expiry setting for that product can't be changed.

You can associate this module with uc_role.module in order to create expirable subsciptions to a role.

This module main goal is to provide a hook that triggers events related to product expiry:

<?php
/**
* Hook called on product expiry events.
*
* @param $op Operation
*    'new' : a new product expiry is scheduled
*    'reminder': a product expiry reminder is triggered
*    'renew': a product expiry has been renewed by a new order
*    'expiry': a product expired
* @param $full_schedule Product expiry schedule informations
*/
function hook_product_expiry($op, $full_schedule) {
...
}
?>

Remember that this is beta code... not in production for now... bla bla bla bla... use it at your own risk... bla bla bla bla....

CHANGE LIST
5.x-1.0-alpha3

  • Disabled quantity field.
  • Added expiry infos when viewing the product.
AttachmentSize
uc_expiry-5.x-1.0-alpha3.tar.gz6.9 KB



everywhere i go, there's always something to remind me...

This reminds me of a functionality I saw on an older version of Ubercart where one could choose how many items they had in stock, so when the number became 0 no one was able to add it to their cart. Then of course when the store owner had more in stock he could just add a new number to the product and make it available again. However I believe that may have been another contribution from someone else.

This too "You can associate this module with uc_role.module in order to create expirable subsciptions to a role." provides a great service!

Re: everywhere i go, there's always something to remind me...

I believe you're looking for CpILL's inventory contribution:

http://www.ubercart.org/contrib/132

patch for ubercart alpha 7e

aymerick,

Thanks for your work on this module. For compatibility with Ubercart alpha 7e, some code changes are required:

1. uc_order_get_status_id seems to be deprecated in favor of uc_order_status_data, as per the discussion at: http://www.ubercart.org/comment/3572/Re-Alpha-7e-Released

2. The second argument of hook_order has been changed from the order id to the new order object. See: http://www.ubercart.org/docs/api/hook_order

Attached is a patch for these two issues. With these modifications, uc_expiry is running on my site with Ubercart alpha 8.

Thanks!

AttachmentSize
uc_expiry-uc7e.diff1.41 KB

Re: patch for ubercart alpha 7e

Just wondering if this contrib will conflict with the Expiration info on the uc_role product. I like the idea of sending the reminder a few days or so before their role expires again. Is there any added value for installing this contrib alongside the uc_role module? Thanks!

Re: Re: patch for ubercart alpha 7e

It's my understanding this functionality was included in the new roles module... perhaps not? This won't work in conjunction w/ uc_role.

Re: Re: Re: patch for ubercart alpha 7e

uc_roles's logic was based off some of the code in uc_role & this module, however it was all written from scratch. As far as I can remember, there shouldn't be any conflict with this module & uc_roles; each have their own tables they work off of. This far from a guarantee though.

Related module

I recently posted a module for handling subscriptions that came through a long derivation from this module. Please see:
http://www.ubercart.org/contrib/2851