VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: mailblade on February 11, 2018, 09:09:43 AM

Title: Auto-reduce customfield value by 1 every day?
Post by: mailblade on February 11, 2018, 09:09:43 AM
Solved; Will use STUDIO 42's suggestion.

I've got a small issue I am not sure on how to approach.

Let's say I've got a customfield "Days until Release", with each product having a different "Days until Release" customfield value (5, 10 etc).

How would I go about automatically reducing this value in the database by 1 every day until it reaches zero and then stops reducing?

I'm not really sure how to go about this, so any advice/tips would be kindly appreciated.

Thanks
Title: Re: Auto-reduce customfield value by 1 every day?
Post by: AH on February 11, 2018, 15:03:06 PM
Maybe you should set a date rather than days and do the calculation based on that
Title: Re: Auto-reduce customfield value by 1 every day?
Post by: Studio 42 on February 12, 2018, 01:08:12 AM
This need to do a customfield plugin, or use a standard customfield using a date and compare with current date.
In all case this need to have some PHP knowledge to do the plugin or to check the customfield ID, compare and display the countdown.
Title: Re: Auto-reduce customfield value by 1 every day?
Post by: mailblade on February 12, 2018, 12:43:39 PM
Yes thanks guys will try that. For now, I'll just run an SQL query myself everyday to reduce by 1 every morning.
Title: Re: Auto-reduce customfield value by 1 every day?
Post by: Studio 42 on February 12, 2018, 13:35:17 PM
You complicate your live for nothing, but it's your choice
Title: Re: Auto-reduce customfield value by 1 every day?
Post by: mailblade on February 12, 2018, 15:01:14 PM
I mean until I figure out how to do a custom plugin this will have to do.