Fires04 Posted March 6, 2018 Share Posted March 6, 2018 Hi, I really want change order reference to numeric. (TEXT order reference is really difficult to say via phone to customers). Normaly I do it by override order class by change getOrderReference method. public static function generateReference() { $last_id = Db::getInstance()->getValue(' SELECT MAX(id_order) FROM '._DB_PREFIX_.'orders'); return str_pad((int)$last_id + 1, 9, '000000000', STR_PAD_LEFT); } but if I create order.php in ./overrides/class/order/ nothing happends. I try add hardcoded die() in generateReference method but it do not works. It looks like prestashop do not use this override class. I check BO and overrides are on. Where could be problem ? thanks for advice, and have a nice day guys. Link to comment Share on other sites More sharing options...
joseantgv Posted March 6, 2018 Share Posted March 6, 2018 Just now, Fires04 said: Hi, I really want change order reference to numeric. (TEXT order reference is really difficult to say via phone to customers). Normaly I do it by override order class by change getOrderReference method. public static function generateReference() { $last_id = Db::getInstance()->getValue(' SELECT MAX(id_order) FROM '._DB_PREFIX_.'orders'); return str_pad((int)$last_id + 1, 9, '000000000', STR_PAD_LEFT); } but if I create order.php in ./overrides/class/order/ nothing happends. I try add hardcoded die() in generateReference method but it do not works. It looks like prestashop do not use this override class. I check BO and overrides are on. Where could be problem ? thanks for advice, and have a nice day guys. Have you removed /app/cache/prod/class_index.php? Link to comment Share on other sites More sharing options...
Fires04 Posted March 6, 2018 Author Share Posted March 6, 2018 26 minutes ago, joseantgv said: Have you removed /app/cache/prod/class_index.php? Yes.. But it not help. In attachement is newly generated class_index.php, it do not include my order.php and my ftp and class content. class_index.php Link to comment Share on other sites More sharing options...
halem Posted March 6, 2018 Share Posted March 6, 2018 Add <?php tag at the top of Order.php ? Link to comment Share on other sites More sharing options...
Fires04 Posted March 7, 2018 Author Share Posted March 7, 2018 17 hours ago, halem said: Add <?php tag at the top of Order.php ? Oh. FU**. Sorry my fault, copy and paste without brain involved. SOLVED Link to comment Share on other sites More sharing options...
TinyStore Posted June 30, 2018 Share Posted June 30, 2018 On 3/6/2018 at 6:40 AM, joseantgv said: Have you removed /app/cache/prod/class_index.php? Thanks, this was my issue. Link to comment Share on other sites More sharing options...
Kogkalidis Posted November 18, 2020 Share Posted November 18, 2020 (edited) Guys, I had the same issue and found out which was the cause. On PrestaShop install (v.1.7.6.7 in my case) there was only the /override/classes directory. So, it was trying to copy a file to a directory that does not exist (/override/classes/order). My fix: public function install() { $order_override_directory = _PS_OVERRIDE_DIR_ . 'classes/order'; if (!is_dir($order_override_directory)) { mkdir($order_override_directory, 0755, true); copy(_PS_MODULE_DIR_ . $this->name . '/index.php', $order_override_directory . '/index.php'); } return parent::install(); } Regards ✌🇬🇷🛠🇳🇱 Edited November 18, 2020 by tapanda.gr Typo (see edit history) 1 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