amiranoosheh Posted March 4, 2017 Share Posted March 4, 2017 How add "total sale" like statsproduct madule to statsbestproducts madule? public function getTotalSales($id_product) { $date_between = ModuleGraph::getDateBetween(); $sql = 'SELECT SUM(od.`total_price_tax_excl`) AS total FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order` WHERE od.`product_id` = '.(int)$id_product.' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' AND o.valid = 1 AND o.`date_add` BETWEEN '.$date_between; return (float)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); } $total_sales = $this->getTotalSales($product->id); i want add a column in statsbestproducts madule as total_sales Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now