0

How to provide option for products to be automatically expired using ubercart.

I know one solution could be scheduler.

Is there any other solution which can be applicable only for add to cart products alone instead of auction item which already has expiry dates.

Thanks in advance.

1 Answer 1

0

There is one for Drupal 6, but there does not appear to be a solution for Drupal 7.

The easiest way may be to use rules with an additional field in the products content type and set the product to be unpublished after the date (see https://groups.drupal.org/node/240678 for an example).

Another more complex way would be to make a module that runs on cron (hook_cron) loops through all the products (MySQL select * from uc_products for an example), add a new field to the products content type called expired, set it to a date (using the date module), upon looping through products get the entire node (including this field) and see if it is expired.

But scheduler can do what you want, you just need to add a new field to the content type for the expiration date and set it to expire on that.

5
  • The thing with scheduler is that it will be there for all products. I just want for products which are not auction,because auctioned products default has expiry dates.So that only i asked this question.
    – Ram
    Sep 26, 2013 at 4:09
  • Alright then use Rules to do it, and set one of the rules to check to make sure it isn't an auction product.
    – Steven
    Sep 26, 2013 at 15:30
  • I found another way, i dont know whether its right or not. The solution is that i created a field called as product expiry in product content and checked with all views where i am displaying product to check whether product expiry date is greater than today and only those i am displaying.
    – Ram
    Sep 27, 2013 at 4:38
  • That is also a good way of doing it, you would still be able to access the product through the URL and order it though, if they know what that is.
    – Steven
    Sep 27, 2013 at 13:19
  • Yes thats a good point.So what you suggest?
    – Ram
    Sep 30, 2013 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.