Sign in
Log inSign up

I'm thinking cronjob, but it can't work. How to alert a user every day (based on a condition)?

Lila Fowler's photo
Lila Fowler
·Mar 30, 2019

Hi :)

I have a structure in place, and I'm not sure how to put it into practise.

Let's say I have a shopping cart website where users must register to order.

If a user places an order and completed their purchase on the first day, they get 100 points. If they complete it on the second day, they get 70 points. Third day, 50 points. If eventually they didn't complete the order in 7 days they get no points, possibly negative points.

How can I put this into php? I usually do a cronjob for anything that needs a day-to-day schedule, but this is quite specific. The dates are relative to the date the user placed the order, not just every x hours. Also, to save on resources I wouldn't want to perform these checks on every user, only those who have pending orders.

I thought on different ideas but none are really practical.... Any advice would be much appreciated.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct