Page 1 of 1

Customers search orders or order history

Posted: Tue Jul 04, 2023 10:58 am
by 14Steve14
Does anyone know if there is anything that will allow a customer to search through their order history for a specific product or model number, without opening every order. I know Gary did an 'Already Purchased' hook but cant seem to find anything else suitable. Am I missing something.

We are doing away with all the side boxes on our next site so want the customers to be able to reorder products that they have previously purchased with having to search through every order they have placed.

Re: Customers search orders or order history

Posted: Tue Jul 04, 2023 12:40 pm
by burt
The other one that may fit your needs a bit or not, would be "s10e05 Quick Reorder" - I think this one allows the customer to reorder a whole order with one click. However, the customer does not know what is inside each order until they look.

I don't know of anything that would allow the customer to search through their orders for a model or product name. It should be fairly straightforwardish to make though, you'd have some sort of search which searches the orders_products table for the given search term - you'd need to join the orders table to ensure they are searching only their own orders.

Re: Customers search orders or order history

Posted: Tue Jul 04, 2023 3:08 pm
by ecartz
burt wrote: Tue Jul 04, 2023 12:40 pm you'd have some sort of search which searches the orders_products table for the given search term - you'd need to join the orders table to ensure they are searching only their own orders.
You might want to have it search the products tables joined against the two order tables. Then you'd get back all the current data, which you could pass to the product listing. Something like

Code: Select all

SELECT m.*, %s
 FROM
  products p
    INNER JOIN products_description pd ON p.products_id = pd.products_id
    INNER JOIN orders_products op ON p.products_id = op.products_id
    INNER JOIN orders o ON op.orders_id = o.orders_id
    LEFT JOIN specials s ON p.products_id = s.products_id
    LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
    LEFT JOIN (SELECT products_id, COUNT(*) AS attribute_count FROM products_attributes GROUP BY products_id) a ON p.products_id = a.products_id
  WHERE p.products_status = 1 AND pd.language_id = %d AND o.customers_id = %d
Then you can just pass that query to sortable_product_columns.

Re: Customers search orders or order history

Posted: Tue Jul 04, 2023 3:57 pm
by heatherbell
14Steve14 wrote: Tue Jul 04, 2023 10:58 am order history for a specific product
We use this:
viewtopic.php?f=28&t=164

Re: Customers search orders or order history

Posted: Thu Jul 06, 2023 8:26 am
by 14Steve14
heatherbell wrote: Tue Jul 04, 2023 3:57 pm
14Steve14 wrote: Tue Jul 04, 2023 10:58 am order history for a specific product
We use this:
viewtopic.php?f=28&t=164
@heatherbell Thanks for that I will take a look.