Jump to content

How to extend adminsearchcontroller to search on product reference number in orders


Deoorbel

Recommended Posts

I tried to adjust ther clases>order.php to get a order list below. But didn't work

 

public static function getOrderByProductID($productid)
{
$orders = new PrestaShopCollection('Order');
$orders->where('reference', '=', $reference);
                $product_list = $this->getOrderDetailList();
foreach ($product_list as $product)
if ($product['product_id'] == (int)$id_product)
            return $orders;                 
}
 
I stil need to adjust the adminsearchcontroller to display the record of the found orders.
Link to comment
Share on other sites

I would use a MySQL query, either via a client (I use Navicat), or via the SQL Manager in Prestashop. Assuming a table prefix of ps_, and a search for productID 10....

 

 
select
	reference,
	o.id_order,
	d.product_id,
	d.product_name
from
	ps_orders as o
	join ps_order_detail as d on (o.id_order = d.id_order)
where 
	product_id = 10
group by
	reference
order by 
	o.id_order
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...