juanmlg Posted April 20, 2013 Share Posted April 20, 2013 Hello, I want to show the product's warehouse position at the backoffice order page, if it's possible inside the products table of the order. It 's possible? In wich page is the backoffice order code? Any help? I know that the warehouse position is in the database. thanks so much! Link to comment Share on other sites More sharing options...
juanmlg Posted April 21, 2013 Author Share Posted April 21, 2013 Nothing? Link to comment Share on other sites More sharing options...
Terragg Posted April 22, 2013 Share Posted April 22, 2013 (edited) (Assuming PrestaShop 1.5+) You will need to override the AdminOrderController templates to display the data and override the AdminOrderController to get the data to display. Getting the new data feild (one possibility of many): Override AdminOrderController::renderView to snag the warehouse data and add the 'location' data on a per-product basis. I think the foreach loop right under Warehouse::getWarehousesByProductId(...) provides access to the 3 things to get the location id_product, id_product_attribute, and id_warehouse. Use those id's to grab the data point from WarehouseProductLocation::getProductLocation($id_product, $id_product_attribute, $id_warehouse) and store it in the $products array. You may need to store it in a temporary array and find a way to insert it into the $products array if that array isn't keyed by product id. ProTip: Don't forget to end the override with: return AdminController::renderView(); as calling parent::renderView() will not get you the results you expect. As for displaying the new data feild: Copy: admin/themes/default/template/controllers/orders/_product_line.tpl admin/themes/default/template/controllers/orders/form.tpl admin/themes/default/template/controllers/orders/helpers/views/view.tpl to the BO template override folder override/controllers/admin/template/orders/ Add the new column for 'location' field to override/controllers/admin/template/_product_line.tpl Make sure that the column headers/footers in override/controllers/admin/template/orders/form.tpl and /helpers/views/view.tpl match the updated columns in the overridden product_line.tpl file. You'll also need to get the view.tpl file to use the overridden files instead of the default files. This isn't an exhaustive how-to, but it should get you pointed in the right direction. Hope this helps, PS: edits are in red. Edited May 8, 2013 by Terragg (see edit history) 1 Link to comment Share on other sites More sharing options...
juanmlg Posted April 24, 2013 Author Share Posted April 24, 2013 Thanks so much, I am going to try it. Link to comment Share on other sites More sharing options...
amine.bahou Posted May 2, 2013 Share Posted May 2, 2013 (edited) Hello, I managed to display the location field in the BO by adding the following lines to the /site/admin/themes_default / template/controllers/orders/_product_line.tpl: <td align="center" class="location"> <span class="location"> {$ product ['location']} </ span> {if} $ can_edit <span class="location" style="display:none;"> <input name="location" class="location" value="{$product['location']|htmlentities}" size="2" /> </ span> {/ if} </ td> [/ CODE] but I can not display the text "location" at the top of the table, I do a lot of changes to the file form.tpl I'm in prestashop 1.5.4.0? someone a solution? and thank you Edited May 2, 2013 by amine.bahou (see edit history) Link to comment Share on other sites More sharing options...
Terragg Posted May 8, 2013 Share Posted May 8, 2013 The form.tpl seems to be overridden in certain areas with the file: [...]/template/controllers/orders/helpers/view/view.tpl The table headings are controlled there. HTH, Link to comment Share on other sites More sharing options...
soware Posted May 14, 2013 Share Posted May 14, 2013 Hi, I used a simple solution: I override the template file in admin/themes/default/template/controllers/orders/_product_line.tpl Alter the code like this from line 36 and insert the red code: <td><a href="index.php?controller=adminproducts&id_product={$product['product_id']}&updateproduct&token={getAdminToken tab='AdminProducts'}"> <span class="productName">{$product['product_name']}</span><br /> {if $product.product_reference}{l s='Ref:'} {$product.product_reference}<br />{/if} {if $product.product_supplier_reference}{l s='Ref Supplier:'} {$product.product_supplier_reference}<br />{/if} {$warehouse_list[$product['id_warehouse']]['name']} </a></td> I used existing controllers variables, and you don't need modify the AdminOrderController. I hope this can help! Thxs Link to comment Share on other sites More sharing options...
soware Posted May 14, 2013 Share Posted May 14, 2013 Hi, a made another change in pfd/invoice.tlp to print the stock location in product description: pdf/invoice.tlp line 128: <td style="text-align: left; width: 45%">(Ref. {$order_detail.product_reference}) {$order_detail.product_name} / {Warehouse::getWarehouseNameById($order_detail['id_warehouse'])}</td> The red code was added. This show the product ref. and stock location in order invoice, to be printed. 1 Link to comment Share on other sites More sharing options...
ludivick Posted June 22, 2013 Share Posted June 22, 2013 Hi, a made another change in pfd/invoice.tlp to print the stock location in product description: pdf/invoice.tlp line 128: <td style="text-align: left; width: 45%">(Ref. {$order_detail.product_reference}) {$order_detail.product_name} / {Warehouse::getWarehouseNameById($order_detail['id_warehouse'])}</td> The red code was added. This show the product ref. and stock location in order invoice, to be printed. Hello!! i found really usefull your solution but I cant make the warehouse or teh product position in the wareghouse appear.. any idea on what can I change? Reference is working perfect! Link to comment Share on other sites More sharing options...
besssbesss Posted September 2, 2013 Share Posted September 2, 2013 Hi. I tried your code. But nothing appears on the invoice when I open it on an order page. I am on prestashop 1.5.3.1. Maybe you can help me please ? Thank you Link to comment Share on other sites More sharing options...
Xzelot Posted September 24, 2013 Share Posted September 24, 2013 How can i show the warehouses but none in the admin backoffice, instead, in the product.tpl from my theme? Link to comment Share on other sites More sharing options...
vekia Posted September 24, 2013 Share Posted September 24, 2013 hello what information you want to display exactly ? 1 Link to comment Share on other sites More sharing options...
Xzelot Posted September 24, 2013 Share Posted September 24, 2013 (edited) Hi there The item location plus qttyies. I tryed to place a like with a for each on product.warehouse_id, but i really don't know waht key to call or even where the vars of warehouse are placed. i have like 2 month trying. Prestashop 1.5.5 For example: Name warhouse - Qttyies But in the Product.tpl from the front view. Edited September 24, 2013 by Xzelot (see edit history) Link to comment Share on other sites More sharing options...
soware Posted September 24, 2013 Share Posted September 24, 2013 Hi XZelot, I don't tried show this information in product.tpl. You need to search in the correct controller for the smarty variable passed to product.tpl. I think it's in the ProductController.php (front) If this information (warehouse) was sent to the smarty variable, is possible show this information in product.tpl. If not, you need override the productController, and send this information to smarty variable. I hope was useful. Thank you! Link to comment Share on other sites More sharing options...
soware Posted September 24, 2013 Share Posted September 24, 2013 Hi besssbesss. Have you activated the advanced stock manager? Do you configure the warehouses? I was using the 1.5.4.1 prestashop version. Thks Link to comment Share on other sites More sharing options...
Xzelot Posted September 24, 2013 Share Posted September 24, 2013 (edited) Hi XZelot, I don't tried show this information in product.tpl. You need to search in the correct controller for the smarty variable passed to product.tpl. I think it's in the ProductController.php (front) If this information (warehouse) was sent to the smarty variable, is possible show this information in product.tpl. If not, you need override the productController, and send this information to smarty variable. I hope was useful. Thank you! none happens on productconrtoller, i opened de admin warehouse controller but still can't do it The thing i need to do is include an php file made by myself but i don't know how to do it, couse when i use the php go with error even using the smarty integration. Edited September 24, 2013 by Xzelot (see edit history) Link to comment Share on other sites More sharing options...
Xzelot Posted September 26, 2013 Share Posted September 26, 2013 Sorry Don't Know how to do it 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