Page 1 of 1

Order list => count numer, dublicate name or telephone

Posted: Thu Jul 16, 2020 12:25 am
by livemedia
Hello,
can you help me by displaying a repeat number of a user with the same name and phone number?

Example: if user Ivan Ivanov with number +359998877, has three requests in the system, then next to his name in the list:
Ivan Ivanov (3)
Repetition counter in the database for the same name and phone number ...

Re: Order list => count numer, dublicate name or telephone

Posted: Wed Aug 12, 2020 4:30 am
by sandraolt
You could do this with a mysql query in your database (assuming you are using mysql) Once you have designed the query and have it reporting what you want, you could in theory add it to your dashboard, but that is a bit more complicated...

A basic query that would give you contact info for people who have ordered multiple times is

Code: Select all

SELECT firstname, lastname, telephone, COUNT( telephone ) AS x 
FROM `oc_order` 
WHERE order_status_id >5 
Group by telephone 
HAVING x  >  1 
ORDER BY `x` DESC 

Re: Order list => count numer, dublicate name or telephone

Posted: Wed Aug 12, 2020 1:48 pm
by livemedia
Can I have some more information?
To which file should this code be added?

Re: Order list => count numer, dublicate name or telephone

Posted: Fri Aug 14, 2020 11:55 pm
by sandraolt
Typically I would create this as a separate password protected file and put a link to it in my opencart dashboard (rather than change a page in opencart that I the have to change again each time I upgrade). Read https://www.w3schools.com/php/php_mysql_select.asp to see how to create a connection to your database and select the data to show it on your page. The query I created could be used instead of their basic select query.

Sandra