Inform-All Posted April 9, 2021 Share Posted April 9, 2021 (edited) For globally shipping products the customs need a HS (Harmonised System) code and a Country of Origin. I still have no idea why this is not a default feature of Prestashop, so i created a module for this. After installing the module you can find a HS code and a country of origin field in the back office for each product. (as show in the image above) Afterwards you can easily add the HS code and country of origin on your delivery slips and/or invoices. Installation You can install this module on any Prestashop 1.7 and Prestashop 8 shop. After installing the module you would have to manually edit the invoice/delivery slip template. (because Prestashop does not allow this with the module installation) In the module there is a folder called 'pdf' if you place this folder in your /themes/YOUR-THEME/ folder you are done.Github link Download: hscodes.zip Like my work? Consider donating here. Updates: * 01-08-2023 add country of origin to the module for reach product Edited April 10 by Inform-All (see edit history) 2 5 Link to comment Share on other sites More sharing options...
ButikVille Posted May 2, 2021 Share Posted May 2, 2021 Thanks Bro, This is exactly what I was looking for.. Link to comment Share on other sites More sharing options...
odinp123 Posted May 5, 2021 Share Posted May 5, 2021 I'm going to give this module a try. We were just discussing if we should use "features" feature instead. To my understanding we also need to supply Country of Origin Link to comment Share on other sites More sharing options...
Inform-All Posted May 5, 2021 Author Share Posted May 5, 2021 2 hours ago, odinp123 said: I'm going to give this module a try. We were just discussing if we should use "features" feature instead. To my understanding we also need to supply Country of Origin Hi Let me know what you think of this module! In my customers use case the carrier notes the country of origin, but let me know if you have any other ideas or extensions to this module. Link to comment Share on other sites More sharing options...
odinp123 Posted May 7, 2021 Share Posted May 7, 2021 I've given it a spin on PrestaShop 1.7.5.2 Here I unfortunately experience a problem when saving. While the HS field data is saved to database, it seems like the save action on product pages hangs (screenshot attached). I've just tested it on 1.7.7.4 here it seems like the same bahaviour Link to comment Share on other sites More sharing options...
odinp123 Posted May 7, 2021 Share Posted May 7, 2021 (edited) On 5/5/2021 at 1:36 PM, Inform-All said: Hi Let me know what you think of this module! In my customers use case the carrier notes the country of origin, but let me know if you have any other ideas or extensions to this module. Just to clear up any confusion. The Country of Origin should be applied to each item line on the invoice. It is not where the parcel originates from, but rather where the item originates from. So for instance a pacel originating from Germany, this has to be on the invoice, ie. T-shirt HS: 1234567890 CO: PT Skirt HS: 2134567890 CO: PL and so on. Edited May 7, 2021 by odinp123 (see edit history) Link to comment Share on other sites More sharing options...
Inform-All Posted May 7, 2021 Author Share Posted May 7, 2021 2 hours ago, odinp123 said: I've given it a spin on PrestaShop 1.7.5.2 Here I unfortunately experience a problem when saving. While the HS field data is saved to database, it seems like the save action on product pages hangs (screenshot attached). I've just tested it on 1.7.7.4 here it seems like the same bahaviour Could you enable debug mode, and also share what errors your console gives? Link to comment Share on other sites More sharing options...
odinp123 Posted May 7, 2021 Share Posted May 7, 2021 (edited) Unfortunately there is no stacktrace from debug mode. Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data error https://redacted/admin/themes/default/js/bundle/product/form.js?1.7.7.4:700 https://redacted/admin/themes/new-theme/public/main.bundle.js:277 This is all i get in the console Edited May 7, 2021 by odinp123 (see edit history) Link to comment Share on other sites More sharing options...
odinp123 Posted May 7, 2021 Share Posted May 7, 2021 Could it be that actionProductUpdate Should be changed to actionProductSave actionProductSave This hook is called while saving products Located in: /classes/Product.php actionProductUpdate This hook is displayed after a product has been updated Located in: My thought is that, when you save the product, after its saved actionProductUpdate is called, and IT calls save(); aka actionProductSave, that calls actionProductUpdate ... and so on. Creating an infinite loop Link to comment Share on other sites More sharing options...
Inform-All Posted May 7, 2021 Author Share Posted May 7, 2021 (edited) 35 minutes ago, odinp123 said: Could it be that actionProductUpdate Should be changed to actionProductSave actionProductSave This hook is called while saving products Located in: /classes/Product.php actionProductUpdate This hook is displayed after a product has been updated Located in: My thought is that, when you save the product, after its saved actionProductUpdate is called, and IT calls save(); aka actionProductSave, that calls actionProductUpdate ... and so on. Creating an infinite loop Nope. It looks like a different problem, please send me a private message with some login credentials so i can have a look. Edited May 7, 2021 by Inform-All (see edit history) Link to comment Share on other sites More sharing options...
Giuseppe F Posted June 16, 2021 Share Posted June 16, 2021 Hello @Inform-All I think this is a really good module. Do you have a new version of it with all the hotfix in it? Thanks Link to comment Share on other sites More sharing options...
Inform-All Posted June 16, 2021 Author Share Posted June 16, 2021 6 hours ago, Giuseppe F said: Hello @Inform-All I think this is a really good module. Do you have a new version of it with all the hotfix in it? Thanks I'm not sure what to fix. I can't reproduce the error, and i have not gotten credentials (in a private message) to debug. Link to comment Share on other sites More sharing options...
benisevme Posted July 29, 2021 Share Posted July 29, 2021 Hello, many thank you for this module, I am using Advanced Invoice Template plugin and I am entering Origin information to Reference field and using this {$order_detail.product_reference} for Origin of the manufacturer, I was using UPC code field for the HS code and using this attribute {$order_detail.product_upc} for the HS code to show on the invoice. How can I use HS code field on my invoice? Do you have any idea what the attribute should be for this field? Link to comment Share on other sites More sharing options...
Roar Posted August 13, 2021 Share Posted August 13, 2021 Hello, I am also having the same problem, where the HS code disappears after I save it and therefore I cannot make it appear on my invoices. Was there a solution found for this? Thank you! Link to comment Share on other sites More sharing options...
Inform-All Posted August 13, 2021 Author Share Posted August 13, 2021 To put the HS in the invoice manually you should use the hscode attribute. Because every product now has the field .hscode, you should first loop over your products inside your invoice template, then you can display the hscode for each product. This would be the bare minimum, if you are $order_details contains the products. {foreach $order_details as $order_detail} {$order_detail.hscode} {/foreach} Link to comment Share on other sites More sharing options...
Inform-All Posted August 13, 2021 Author Share Posted August 13, 2021 8 minutes ago, Roar said: Hello, I am also having the same problem, where the HS code disappears after I save it and therefore I cannot make it appear on my invoices. Was there a solution found for this? Thank you! Please enable debug mode, it looks like there is an error in the product data you are tying to save. Link to comment Share on other sites More sharing options...
benisevme Posted August 13, 2021 Share Posted August 13, 2021 Can we use the one below for the Origin? {$order_detail.origin} Thank you Link to comment Share on other sites More sharing options...
Roar Posted August 13, 2021 Share Posted August 13, 2021 HI, Thank you for your quick reply. I tried turning on debug but can't seem to see what might be causing it. I am no expert though, so I will ask my webmaster to check in debug too (he has been trying to find a solution for a while now, which is why I sent this message here). I enter the code, save the product, all seems good, then when I leave the product page and return it is back to 0 being the code. Link to comment Share on other sites More sharing options...
Inform-All Posted August 13, 2021 Author Share Posted August 13, 2021 (edited) 5 minutes ago, benisevme said: Can we use the one below for the Origin? {$order_detail.origin} Thank you Currently this module does not have the option for setting or displaying the origin. Edited August 13, 2021 by Inform-All (see edit history) Link to comment Share on other sites More sharing options...
benisevme Posted August 13, 2021 Share Posted August 13, 2021 5 minutes ago, Inform-All said: Currently this module does not have the option for setting or displaying the origin. this is an obligation for the commercial invoices in order to post abroad, I am using reference input for this purpose for now. Many thank you for this module. Link to comment Share on other sites More sharing options...
odinp123 Posted August 13, 2021 Share Posted August 13, 2021 (edited) @Inform-All@benisevme We got a dirty version that adds Country of Origin as well Edited August 13, 2021 by odinp123 Removed dirty version (see edit history) 1 Link to comment Share on other sites More sharing options...
odinp123 Posted August 13, 2021 Share Posted August 13, 2021 @Inform-All you got a github repo for this? Link to comment Share on other sites More sharing options...
Inform-All Posted August 13, 2021 Author Share Posted August 13, 2021 2 minutes ago, odinp123 said: @Inform-All you got a github repo for this? Added github link in first post. Link to comment Share on other sites More sharing options...
korvent Posted August 23, 2021 Share Posted August 23, 2021 Hi, My HS Code are different on each of my combinations, do you have any idea how I could add a custom field on combinations instead of products ? Thanks Link to comment Share on other sites More sharing options...
Inform-All Posted August 24, 2021 Author Share Posted August 24, 2021 (edited) On 8/23/2021 at 12:22 PM, korvent said: Hi, My HS Code are different on each of my combinations, do you have any idea how I could add a custom field on combinations instead of products ? Thanks This is a good idea! Might make it in the future, currently i have lot's of paid work so no time to spare. For a small donation fee i can start earlier though. Edited August 24, 2021 by Inform-All (see edit history) Link to comment Share on other sites More sharing options...
KM19 Posted September 6, 2021 Share Posted September 6, 2021 On 8/13/2021 at 11:54 AM, Inform-All said: Added github link in first post. Thanks for sharing. I want to install your HS Code Module from Github but during upload via Module Manager (PS 1.7.7) I get an error. The version from post #1 is working well. Can you give me a hint for installing modules from your Github. VAT Checker, Order List etc. have the same issue. Maybe I am only to stupid for it. Is there an import available via CSV in HS Code module? Many thanks in advance. Link to comment Share on other sites More sharing options...
Inform-All Posted September 6, 2021 Author Share Posted September 6, 2021 6 hours ago, KM19 said: Thanks for sharing. I want to install your HS Code Module from Github but during upload via Module Manager (PS 1.7.7) I get an error. The version from post #1 is working well. Can you give me a hint for installing modules from your Github. VAT Checker, Order List etc. have the same issue. Maybe I am only to stupid for it. Is there an import available via CSV in HS Code module? Many thanks in advance. If you download the module from Github, you should first open the zip, rename the folder to 'hscodes' and rezip it again. 1 Link to comment Share on other sites More sharing options...
KM19 Posted September 6, 2021 Share Posted September 6, 2021 @Inform-All Great it works. Is there a method to import HS with a CSV file or something other? Link to comment Share on other sites More sharing options...
Inform-All Posted September 8, 2021 Author Share Posted September 8, 2021 On 9/6/2021 at 7:29 PM, KM19 said: @Inform-All Great it works. Is there a method to import HS with a CSV file or something other? Not yet, there will be a new module version available soon that allows the import of HS codes with the normal Prestashop import method. But this is a work in progress, i will keep this forum topic updated. Link to comment Share on other sites More sharing options...
KM19 Posted September 8, 2021 Share Posted September 8, 2021 @Inform-All TOP Link to comment Share on other sites More sharing options...
[email protected] Posted October 13, 2021 Share Posted October 13, 2021 Looking this module for PrestaShop 1.6 Thank You ... Link to comment Share on other sites More sharing options...
Inform-All Posted October 13, 2021 Author Share Posted October 13, 2021 6 hours ago, [email protected] said: Looking this module for PrestaShop 1.6 Thank You ... I really doubt if anyone is still going to develop a Prestashop 1.6 module. Sorry, i can't help you either. Link to comment Share on other sites More sharing options...
[email protected] Posted October 13, 2021 Share Posted October 13, 2021 1 hour ago, Inform-All said: I really doubt if anyone is still going to develop a Prestashop 1.6 module. Sorry, i can't help you either. I have made it my self ... Thank you for support ... Link to comment Share on other sites More sharing options...
Ali Samie Posted July 28, 2022 Share Posted July 28, 2022 Hi. I didnt get what this module is used for? Link to comment Share on other sites More sharing options...
Inform-All Posted July 28, 2022 Author Share Posted July 28, 2022 50 minutes ago, stifler97 said: Hi. I didnt get what this module is used for? It is for companies that ship abroad. If you ship products, the customs of the other cou try need a HS code to see what product type is in the package. 1 Link to comment Share on other sites More sharing options...
St055 Posted October 7, 2022 Share Posted October 7, 2022 I use 1.7.8.7 and it hangs when saving. MySQL +140% of processor. Must restart MySQL server... So I suppose a problem in the code... Link to comment Share on other sites More sharing options...
Inform-All Posted October 7, 2022 Author Share Posted October 7, 2022 Just now, St055 said: I use 1.7.8.7 and it hangs when saving. MySQL +140% of processor. Must restart MySQL server... So I suppose a problem in the code... Could you elaborate? Can you share a private message with the queries that are being executed? Do you have any other product modification modules installed? How many queries are being executed when the module is not installed? It's simply an extension of the product, it's hard to believe that this causes SQL overload. Link to comment Share on other sites More sharing options...
St055 Posted October 7, 2022 Share Posted October 7, 2022 I don't know anymore... I just see each time I try to save HS code it hangs all shop... when I type "top" on SSH on my server, MySQL is using huge processor... I've uninstalled it and it works now... So I don't know if it is MySQL related, but there is a problem with the module, for sure... Link to comment Share on other sites More sharing options...
Inform-All Posted October 7, 2022 Author Share Posted October 7, 2022 1 minute ago, St055 said: I don't know anymore... I just see each time I try to save HS code it hangs all shop... when I type "top" on SSH on my server, MySQL is using huge processor... I've uninstalled it and it works now... So I don't know if it is MySQL related, but there is a problem with the module, for sure... So please share more info so can debug for you. I have 15+ shops (including multistore and PS 1.7.8.7) running this module, i highly doubt it is the module. Link to comment Share on other sites More sharing options...
TwinkleEye Posted December 29, 2022 Share Posted December 29, 2022 Hi, where is the donload link for the newest module? Aslo does it inlucdes both HS Country of Origin Thanks Link to comment Share on other sites More sharing options...
Inform-All Posted January 2, 2023 Author Share Posted January 2, 2023 On 12/29/2022 at 2:16 PM, TwinkleEye said: Hi, where is the donload link for the newest module? Aslo does it inlucdes both HS Country of Origin Thanks The updates will always pushed to Github (here). But i just updated the initial post with the latest version. Link to comment Share on other sites More sharing options...
TwinkleEye Posted January 2, 2023 Share Posted January 2, 2023 Thank you Link to comment Share on other sites More sharing options...
prestaconfig Posted January 3, 2023 Share Posted January 3, 2023 Hi, I just installed it on Prestashop 1.7.6.4 and it's exactly what I needed ! For each product, I can see the HS Code on invoices 👍 Thank you very much for you work ! As others, I would like the Country of Origin to appear as I had thought of 3 solutions : Make an adaptation of your module HSCode and create CountryCode (2 modules). - I made some tests but I have a problem with the Override. Keep the your HSCode module and adapt it. - I am not a developer and i failed ;-/ The third solution would be simple but I would like you opinion. By consulting the code of your module, I saw that you had put an INTEGER field which respects the size of the HS Code. Example: return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'product` ADD `hscode` INT NULL DEFAULT 0'); ... self::$definition['fields']['hscode'] = ['type' => self::TYPE_INT, 'validate' => 'isInt', 'size' => 10]; <input type="number" name="hs_code" id="hs_code" class="form-control" value="{$hscode}"/> To avoid a big additional development, would it be possible and "clean" according to you to transform this field in STRING? return Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'product` ADD `hscode` ISSTRING ... self::$definition['fields']['hscode'] = ['type' => self::TYPE_STRING, ... <input type="string" name="hs_code" id="hs_code" ... So instead of entering the HS Code like this: 95030039, we could enter "95030039 CO:FR" for example. Maybe you won't like this method, but in the end, it would save a lot of development time? Not being a developer, I am not able to provide the right code but maybe the reasoning will fit. What do you think? Regards, Link to comment Share on other sites More sharing options...
benisevme Posted January 3, 2023 Share Posted January 3, 2023 Hello is there a way to print this HS code and Origin information to the invoice? Link to comment Share on other sites More sharing options...
prestaconfig Posted January 4, 2023 Share Posted January 4, 2023 Hi @benisevme, Since @Inform-All upgrade his module, you can print HS code on invoice in the last version. Not the Origin because it's not implemented on this module. As you can see, he has updated his post Monday at 08:54 AM by Inform-All with the new version of the module specifying in detail the procedure to add the HS code on the invoice. He also specifies the Github link of his module in this post which will allow you to see possible new versions to come. Quote Installation You can install this module on any Prestashop 1.7 shop. After installing the module you would have to manually edit the invoice/delivery slip template. (because Prestashop does not allow this with the module installation) In the module there is a folder called 'pdf' if you place this folder in your /themes/YOUR-THEME/ folder you are done. So my previous question was related to this new version and propose a possible modification to add the Country Origin. Regards, Link to comment Share on other sites More sharing options...
St055 Posted January 4, 2023 Share Posted January 4, 2023 Hi, I've installed it. There is the form on the product page (BO), but when I download invoice or slip, the HS code is not present... Link to comment Share on other sites More sharing options...
Inform-All Posted January 4, 2023 Author Share Posted January 4, 2023 About the Country of Origin questions for this module, i could add this to the module, but i don't see why. Just to be clear, this invoice/delivery slip does not have all the requirements of a CN22 or CN23 document ( https://customs-documents.com ). So if you would like the Country of Origin added, please send me a private message and we can talk about the use case and implementation. @St055 check the installation text in the first post, you have to manually override the files. 1 Link to comment Share on other sites More sharing options...
prestaconfig Posted January 4, 2023 Share Posted January 4, 2023 Hi @St055, Did you read the previous post? Quote After installing the module you would have to manually edit the invoice/delivery slip template. (because Prestashop does not allow this with the module installation) In the module there is a folder called 'pdf' if you place this folder in your /themes/YOUR-THEME/ folder you are done. In others words : 1) Installation of module : You've done it. Until this step, it's will not display you the HS code on invoice. (because Prestashop does not allow this with the module installation) 2) Connect you on your FTP 3) Go on the folder /themes/YOUR-THEME/ Copy the FTP folder of the module "module/hscode" inside the folder /themes/YOUR-THEME/ and it's done ! Regards, Link to comment Share on other sites More sharing options...
St055 Posted January 4, 2023 Share Posted January 4, 2023 I've copied it. But nothing more... Still not having HS code on invoices/slip... Link to comment Share on other sites More sharing options...
prestaconfig Posted January 4, 2023 Share Posted January 4, 2023 @St055 Do you have a specific template or Prestashop default template ? Here is my config on FTP exemple wich is ok for me for a specific template. Of course, to check the invoice, you have to complete an order and see if it appears afterwards. If it's not work, i can't help you more. 😕 Regards, Link to comment Share on other sites More sharing options...
technocracy Posted February 28, 2023 Share Posted February 28, 2023 I just tried to install this and it installed and all looked well - however when I tried to add a HS Code on a product and hit save it just hung with the "saving wheel" frozen. Basically unusable - thankfully the module manager wasn't affected and could get to the it and uninstall the module and everything returned to normal. Anyone come across this before? Link to comment Share on other sites More sharing options...
Inform-All Posted March 1, 2023 Author Share Posted March 1, 2023 On 2/28/2023 at 11:06 AM, technocracy said: I just tried to install this and it installed and all looked well - however when I tried to add a HS Code on a product and hit save it just hung with the "saving wheel" frozen. Basically unusable - thankfully the module manager wasn't affected and could get to the it and uninstall the module and everything returned to normal. Anyone come across this before? Hmmm sounds odd, could you try again and check your browsers console if it brings anything up? Link to comment Share on other sites More sharing options...
gorkij77 Posted July 17, 2023 Share Posted July 17, 2023 Hi, pulled the latest version from Github since I need this because the Spanish Postal Services are making a fuss about missing HS codes and countries of origin on intra-european sales. I too would need to be able to add country of origin to this. Quite willing to pay for it as well, how'd we go about this? Link to comment Share on other sites More sharing options...
Inform-All Posted July 17, 2023 Author Share Posted July 17, 2023 1 minute ago, gorkij77 said: Hi, pulled the latest version from Github since I need this because the Spanish Postal Services are making a fuss about missing HS codes and countries of origin on intra-european sales. I too would need to be able to add country of origin to this. Quite willing to pay for it as well, how'd we go about this? I will send you a private message. Link to comment Share on other sites More sharing options...
gorkij77 Posted July 17, 2023 Share Posted July 17, 2023 (edited) Excellent. By the way, is there a limit on character numbers here? I can enter 85051110 as a HS code, but not 3926909700? Edit: My bad, export uses only the 8 numbers, import weirdly enough uses 10 at times. Edited July 18, 2023 by gorkij77 Issue resolved (see edit history) Link to comment Share on other sites More sharing options...
Inform-All Posted August 1, 2023 Author Share Posted August 1, 2023 Thanks to @gorkij77 i've updated the module with the Country of Origin possibility. Link to comment Share on other sites More sharing options...
aitorjp Posted October 10, 2023 Share Posted October 10, 2023 Thanks for this free module! but after installing it nothing has happened in PrestaShop 8.1.2, PHP 8.1.24 and warehouse theme. No form or tab appears on the BO product page Link to comment Share on other sites More sharing options...
Inform-All Posted October 11, 2023 Author Share Posted October 11, 2023 15 hours ago, aitorjp said: Thanks for this free module! but after installing it nothing has happened in PrestaShop 8.1.2, PHP 8.1.24 and warehouse theme. No form or tab appears on the BO product page You are correct, Prestashop made a huge update on product hooks and the extending of Products in PS8.1. Unfortunately i have not adapted this module yet. This module is "Community paid" meaning if an update/improvement is requested i will make it for a small donation. So please send me a private message if you are interested in the updated module. 1 Link to comment Share on other sites More sharing options...
OwnedFiston Posted August 22 Share Posted August 22 Thank's for that great idea ! Work Fine on my PS 8.1.7 😀 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