Jump to content
xt:Commerce Community Forum

Trick! Update your Products Ordered count


argv64

Recommended Posts

Sometimes the count of the "products ordered" (table: products, field: products_ordered) is not real. It contains the user installation order test, delete orders or others irrelevant orders. Easy to solve, next query update the product_ordered counting the order table.

Query to update the product_ordered, execute it in your MySQL Query Manager (like PhpMyAdmin)


UPDATE products 

SET products_ordered = (

    SELECT SUM( products_quantity ) AS total

    FROM orders_products

    WHERE orders_products.products_id = products.products_id

    GROUP BY products_id) 

Good luck and Good night!

Others trick in:

http://www.albertserra.cat/

- Manufacturers in product detail (product_info)

- Show the customer phone in print orders

- Custumer name in cart box

- Prototype & Scriptaculous to build a Banner in a homepage

--

Albert Serra

Senior PHP Developer

[email protected]

[email protected]

http://www.senior-php-developer.com/

http://www.albertserra.cat/

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...