JulioQ Posted September 30, 2021 Share Posted September 30, 2021 Hi there, in PrestaShop 1.7.6 I have added a new column in oder details to see the supplier of each line of product. I did it this way: - adminXXXX/themes/default/template/controllers/orders/helpers/view/view.tpl -->adding line: <th><span class="title_box">{l s='Supplier'}</span></th> - adminXXXX/themes/default/template/controllers/orders/_product_line.tpl --> adding lines: <td> {Supplier::getnamebyid($product.id_supplier)} </td> But now with the new version I cannot find those files to modify them and to add the Supplier. Does anybody know how to do it? Many thanks in advance Link to comment Share on other sites More sharing options...
ChOmar Posted October 1, 2021 Share Posted October 1, 2021 On 9/30/2021 at 12:09 PM, JulioQ said: But now with the new version what is your new version? Link to comment Share on other sites More sharing options...
JulioQ Posted October 1, 2021 Author Share Posted October 1, 2021 4 minutes ago, ChOmar said: what is your new version? 1.7.7.7 I think the last one Link to comment Share on other sites More sharing options...
JulioQ Posted October 18, 2021 Author Share Posted October 18, 2021 On 10/1/2021 at 3:16 PM, ChOmar said: what is your new version? 1.7.7.7 Link to comment Share on other sites More sharing options...
JulioQ Posted October 26, 2021 Author Share Posted October 26, 2021 please, anybody knows how to do it? Link to comment Share on other sites More sharing options...
ps8modules Posted October 26, 2021 Share Posted October 26, 2021 ./admin-folder/themes/default/template/controllers/orders/_product_line.tpl $product['product_supplier_reference'] $product['purchase_supplier_price'] $product['id_supplier'] $product['supplier_reference'] {Supplier::getNameById($product['id_supplier'])} Link to comment Share on other sites More sharing options...
JulioQ Posted October 26, 2021 Author Share Posted October 26, 2021 18 minutes ago, WebSoft said: ./admin-folder/themes/default/template/controllers/orders/_product_line.tpl $product['product_supplier_reference'] $product['purchase_supplier_price'] $product['id_supplier'] $product['supplier_reference'] {Supplier::getNameById($product['id_supplier'])} It does not exist that directory 'orders' in bersion 1.7.7.7 Link to comment Share on other sites More sharing options...
JulioQ Posted October 26, 2021 Author Share Posted October 26, 2021 Just now, JulioQ said: It does not exist that directory 'orders' in bersion 1.7.7.7 Version* Link to comment Share on other sites More sharing options...
ps8modules Posted October 26, 2021 Share Posted October 26, 2021 Sorry, I took a bad look at the version. Link to comment Share on other sites More sharing options...
ps8modules Posted October 26, 2021 Share Posted October 26, 2021 (edited) ./src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/Blocks/View/.... Edited October 26, 2021 by WebSoft (see edit history) Link to comment Share on other sites More sharing options...
JulioQ Posted October 26, 2021 Author Share Posted October 26, 2021 18 minutes ago, WebSoft said: ./src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/Blocks/View/.... ok, thanks but please which file do I have to modify? and what line and code? Link to comment Share on other sites More sharing options...
ps8modules Posted October 27, 2021 Share Posted October 27, 2021 In the new versions of Prestashop, it is quite complicated and without programming knowledge you will not achieve the goal and probably no one will give advice from A to Z here. For a programmer, it is a matter of a few minutes of work to create a module. The most sensible thing is to create a small module and create your own hook and create an override twig template product.html.twig. Just use the parameters in your own hook, which you will add to the override twig template. E.g.: (added renderhook) {% if product.supplierReference is not empty %} <p class="mb-0 productSupplierReference"> {{ 'Supplier reference:'|trans({}, 'Admin.Orderscustomers.Feature') }} {{ product.supplierReference }} </p> <p class="mb-0 productSupplierReference"> {{ 'Supplier:'|trans({}, 'Admin.Orderscustomers.Feature') }} {{ renderhook('displaySupplierNameInOrderProductList', {'product_id':product.id, 'combination_id':product.combinationId, 'supplier_reference':product.supplierReference}) }} </p> {% endif %} And put the correct SQL query into the module, eg: public function hookDisplaySupplierNameInOrderProductList($params) { $id_product = $params['product_id']; $id_attribute = $params['combination_id']; $reference = $params['supplier_reference']; $getName = Db::getInstance()->getValue('SELECT a.name FROM '._DB_PREFIX_.'supplier a LEFT JOIN '._DB_PREFIX_.'product_supplier b ON (b.id_supplier = a.id_supplier) WHERE b.id_product = '.$id_product.' AND b.id_product_attribute = '.$id_attribute.' AND b.product_supplier_reference = '."'".$reference."'"); return $getName; } result: 2 Link to comment Share on other sites More sharing options...
JulioQ Posted October 27, 2021 Author Share Posted October 27, 2021 2 hours ago, WebSoft said: In the new versions of Prestashop, it is quite complicated and without programming knowledge you will not achieve the goal and probably no one will give advice from A to Z here. For a programmer, it is a matter of a few minutes of work to create a module. The most sensible thing is to create a small module and create your own hook and create an override twig template product.html.twig. Just use the parameters in your own hook, which you will add to the override twig template. E.g.: (added renderhook) {% if product.supplierReference is not empty %} <p class="mb-0 productSupplierReference"> {{ 'Supplier reference:'|trans({}, 'Admin.Orderscustomers.Feature') }} {{ product.supplierReference }} </p> <p class="mb-0 productSupplierReference"> {{ 'Supplier:'|trans({}, 'Admin.Orderscustomers.Feature') }} {{ renderhook('displaySupplierNameInOrderProductList', {'product_id':product.id, 'combination_id':product.combinationId, 'supplier_reference':product.supplierReference}) }} </p> {% endif %} And put the correct SQL query into the module, eg: public function hookDisplaySupplierNameInOrderProductList($params) { $id_product = $params['product_id']; $id_attribute = $params['combination_id']; $reference = $params['supplier_reference']; $getName = Db::getInstance()->getValue('SELECT a.name FROM '._DB_PREFIX_.'supplier a LEFT JOIN '._DB_PREFIX_.'product_supplier b ON (b.id_supplier = a.id_supplier) WHERE b.id_product = '.$id_product.' AND b.id_product_attribute = '.$id_attribute.' AND b.product_supplier_reference = '."'".$reference."'"); return $getName; } result: ok, many thanks, uf... so complicated. I tried but i cannot. I have put the first part of the code (added renderhook) in file product.html.twig and second part as a SQL query. I supposed it is wrong because it is not working... Link to comment Share on other sites More sharing options...
ps8modules Posted October 27, 2021 Share Posted October 27, 2021 You must have your own module and register a hook. Link to comment Share on other sites More sharing options...
ps8modules Posted October 27, 2021 Share Posted October 27, 2021 You can add hook to Orders.php, but it must be registered. Link to comment Share on other sites More sharing options...
JulioQ Posted October 27, 2021 Author Share Posted October 27, 2021 Just now, WebSoft said: You can add hook to Orders.php, but it must be registered. ok. Really thank you for your help. But I don´t have enough knowledge to do that. It was very easy in previous version many thanks anyway! 1 Link to comment Share on other sites More sharing options...
ps8modules Posted October 27, 2021 Share Posted October 27, 2021 The higher the Prestashop version, the more problems. The open system is closing. Unfortunately, I do not provide entire modules or modifications. 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