Post by Jones_98 » Fri Oct 16, 2020 7:11 pm

Regarding OpenCart store selling digital downloads.

I am trying to add a script to the product page to warn the customer if that specific product (download) is already purchased and exists in Account>Downloads. The reason is to avoid customers purchasing the same product twice.

Appreciate your help.

Edit: I have tried getting the product IDs of all orders by a customer using a SQL query and that works fine externally but inside OpenCart I am facing issues. A query such as:

SELECT product_id
FROM ocuk_order_product
WHERE order_id IN (
SELECT order_id
FROM ocuk_order
WHERE customer_id = 'xxxx'
)
My main problem is not being sure how to get similar results in OpenCart Product page. (Which pages and path exactly and where inside the files)

Tried this post as well: Opencart get product downloads But it is not exactly working on product page (product.php)

Opencart Version 3.0.2.0

php

iMessage PC


Newbie

Posts

Joined
Sat Oct 10, 2020 12:53 pm

Post by OSWorX » Fri Oct 16, 2020 10:09 pm

Don't understand your problem.
First get all past downloads by this customer (he needs to be loggend in because without a customer_id no database results are possible).
Next add this values to the products.
And assign the template variables you can add inside the template.
All done inside the controller product.php.

Or 1 new model.
You then call this new model with one line from the product.php.
This do avoid editing too many core files and for better updates.

Third option: create a new OCMod for that, and install.
Best option: based on a new event.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 7 guests