Rhapsody Posted November 19, 2011 Share Posted November 19, 2011 The BO tab for stats calls a module that displays product stats. The "Products Available" display includes a table that displays the following fields: Ref., Name, Stock I would like to add a field that displays the number of items sold in addition to the stock. It appears that the code for this is in the statsproduct.php file in the statsproduct module as pasted below. How would I modify the code to display the total number of items sold next to the number displayed for stock? <tr> <th>'.$this->l('Ref.').'</th> <th>'.$this->l('Name').'</th> <th>'.$this->l('Stock').'</th> </tr> </thead><tbody>'; foreach ($this->getProducts($cookie->id_lang) AS $product) $this->_html .= '<tr><td>'.$product['reference'].'</td><td><a href="'.$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'&id_product='.$product['id_product'].'">'.$product['name'].'</a></td><td>'.$product['quantity'].'</td></tr>'; Edit: Thanks to Bellini the request is solved. See his post below. Link to comment Share on other sites More sharing options...
Rhapsody Posted January 13, 2012 Author Share Posted January 13, 2012 It has been a while since I've checked on this. Bump to see if anyone has an idea how the total sold can be displayed. I sell registrations for club membership and admission to club events so the inventory tracking is not used. I just need to tally the total sold. Link to comment Share on other sites More sharing options...
bellini13 Posted January 13, 2012 Share Posted January 13, 2012 i think this should do it <thead> <tr> <th>'.$this->l('Ref.').'</th> <th>'.$this->l('Name').'</th> <th>'.$this->l('Stock').'</th> <th>'.$this->l('Sold').'</th> </tr> </thead><tbody>'; foreach ($this->getProducts($cookie->id_lang) AS $product) $this->_html .= '<tr><td>'.$product['reference'].'</td><td><a href="'.$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'&id_product='.$product['id_product'].'">'.$product['name'].'</a></td><td>'.$product['quantity'].'</td><td>'.$this->getTotalBought($product['id_product']).'</td></tr>'; 1 Link to comment Share on other sites More sharing options...
Rhapsody Posted January 14, 2012 Author Share Posted January 14, 2012 You are awesome! Thanks very much. It works just the way I wanted. 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