havegang Posted September 7, 2010 Share Posted September 7, 2010 HiIs it possible to change the sort order on the PDF-invoice, so it´s order after Preference? Ex.MyStuff1 Reference# 1MyStuff2 Reference# 2MyStuff3 Reference# 3I guess it´s in classes/PDF.php?Thanks in advance./Michael Link to comment Share on other sites More sharing options...
rocky Posted September 8, 2010 Share Posted September 8, 2010 Try changing the getProductDetail() function in classes/Order.php from: public function getProductsDetail() { return Db::getInstance()->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = '.intval($this->id)); } to: public function getProductsDetail() { return Db::getInstance()->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = '.intval($this->id).' ORDER BY od.`product_reference`'); } 1 Link to comment Share on other sites More sharing options...
havegang Posted September 8, 2010 Author Share Posted September 8, 2010 Thanks very much.It works perfect!/Michael Link to comment Share on other sites More sharing options...
rocky Posted September 8, 2010 Share Posted September 8, 2010 Please edit your first post and add [sOLVED] to the front of the title. Link to comment Share on other sites More sharing options...
MrBaseball34 Posted September 8, 2010 Share Posted September 8, 2010 havegang, add [sOLVED] to the front of the title. Link to comment Share on other sites More sharing options...
yadav.kumar Posted November 9, 2012 Share Posted November 9, 2012 Hello There, I have did this and the products are not get sorted in the invoice. I executed the same query in phpmyadmin and there I found the the order is sorted by reference. Do you have any idea why it is behaving like that?? Thank you Link to comment Share on other sites More sharing options...
Yankee Store Posted May 7, 2013 Share Posted May 7, 2013 How can we do this for Prestashop 1.5.4 invoice ? Link to comment Share on other sites More sharing options...
eleazar Posted July 17, 2013 Share Posted July 17, 2013 (edited) Save this Override as /overrides/classes/order/Order.php: <?php /* override Sort by reference ID */ class Order extends OrderCore{ public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id) LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop) WHERE od.`id_order` = '.(int)($this->id).' ORDER BY od.`product_reference`'); } } Edited July 17, 2013 by eleazar (see edit history) Link to comment Share on other sites More sharing options...
prestalollo Posted August 20, 2013 Share Posted August 20, 2013 Hi, do I create a new file, order.php, and place it under "override/classes/order" directory, or how is this done? Link to comment Share on other sites More sharing options...
eleazar Posted August 20, 2013 Share Posted August 20, 2013 Yep, exactly. With the above content. 1 Link to comment Share on other sites More sharing options...
prestalollo Posted August 20, 2013 Share Posted August 20, 2013 Excellent, thank you! Link to comment Share on other sites More sharing options...
Yankee Store Posted September 9, 2013 Share Posted September 9, 2013 I am looking to get the products on the invoices to be sorted by reference of the product or by category in prestashop 1.5.4 . how and which files need to be changed thank you in advance for any help Link to comment Share on other sites More sharing options...
LowCarbCentral Posted February 2, 2015 Share Posted February 2, 2015 Running prestashop 1.6, editing creating an override in order.php only affected the display of the product order in the store. To have that order changed in invoices, I needed to edit OrderInvoice.php. 1. Copy /classes/order/OrderInvoice.php to /overrides/classes/orderOrderInvoice.php 2. Make edit as stated initially. My code ended up like this: public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id) LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop) WHERE od.`id_order` = '.(int)($this->id).' ORDER BY od.product_reference ASC'); } 1 Link to comment Share on other sites More sharing options...
helikoptermannen Posted April 7, 2015 Share Posted April 7, 2015 I want to sort the invoices when creating many pdf invoices in one pdf file. Sometimes I want to sort byt id_order and sometimes by invoice number. Where can I do that? Thanks! 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