venditdevs Posted September 3, 2014 Share Posted September 3, 2014 Hi, When a customer order is succesfull i want to add a timestamp into the database for that product. EG: *** Customer order contains product id's 100 and 101 *** Products with id 100 and 101 will get a last sell timestamp I need it on productlevel. How can we achieve this ? I think i need to hook it at hookActionUpdateQuantity...but ....how to go from there? Link to comment Share on other sites More sharing options...
venditdevs Posted September 10, 2014 Author Share Posted September 10, 2014 Nobody? Serious ? Link to comment Share on other sites More sharing options...
hpar Posted September 10, 2014 Share Posted September 10, 2014 Hi, I think i need to hook it at hookActionUpdateQuantity...but ....how to go from there? Quick & Dirty: with an UPDATE (SQL) statement ? (and of course add the column in your install()) Link to comment Share on other sites More sharing options...
El Patron Posted September 11, 2014 Share Posted September 11, 2014 could you not just look through orders for a particular product to find last sold date time? This would not require a new field. Link to comment Share on other sites More sharing options...
venditdevs Posted September 11, 2014 Author Share Posted September 11, 2014 Hi El Patron,If i loop through the orders it will be to slow and especialy if you have many orders in your system. If i can do it on product level it will be much., much faster.I hope somebody can help me with achieving this. THX Link to comment Share on other sites More sharing options...
hpar Posted September 11, 2014 Share Posted September 11, 2014 If you don't want to modify the product table as I suggested, why not just create a dedicated table for that with [ product_id (FK), last_updated (DateTime) ? You can feed it after an hook (application-level) or a trigger (db-level) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now