How can i get current user purchase history in opencart 2.0.3.1?
I want the reviews to be given only by the users who has purchased the product, i could not find any free extension for it so would like to write the code manually.
Thank you.
How can i get current user purchase history in opencart 2.0.3.1?
I want the reviews to be given only by the users who has purchased the product, i could not find any free extension for it so would like to write the code manually.
Thank you.
If you know a little PHP/MySQL, you can easily do this with querying "order" table. The algorithm is simple: take current customer's ID (CUSTOMER_ID) and look for it in "order" table, when customer browses product with certain PRODUCT_ID (visits its page):
SELECT COUNT(order_id) as total FROM order WHERE customer_id = CUSTOMER_ID AND product_id = PRODUCT_ID
If "total" is more than zero, display review form. Otherwise, hide it.