Author Topic: Auto-reduce customfield value by 1 every day?  (Read 193 times)

mailblade

  • Jr. Member
  • **
  • Posts: 77
  • A beginner
Auto-reduce customfield value by 1 every day?
« 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

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2675
  • VirtueMart Version: 3.2.8
Re: Auto-reduce customfield value by 1 every day?
« Reply #1 on: February 11, 2018, 15:03:06 pm »
Maybe you should set a date rather than days and do the calculation based on that
regards
A

Joomla 3.8.3
php 5.6 + php 7

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 2741
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Auto-reduce customfield value by 1 every day?
« Reply #2 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.

mailblade

  • Jr. Member
  • **
  • Posts: 77
  • A beginner
Re: Auto-reduce customfield value by 1 every day?
« Reply #3 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.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 2741
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Auto-reduce customfield value by 1 every day?
« Reply #4 on: February 12, 2018, 13:35:17 pm »
You complicate your live for nothing, but it's your choice

mailblade

  • Jr. Member
  • **
  • Posts: 77
  • A beginner
Re: Auto-reduce customfield value by 1 every day?
« Reply #5 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.