Wednesday, April 05, 2017

How to convert decimal to hex in JavaScript? - Stack Overflow

How to convert decimal to hex in JavaScript? - Stack Overflow







Convert a number to a hexadecimal string with:
hexString = yourNumber.toString(16);
and reverse the process with:
yourNumber = parseInt(hexString, 16);

Monday, April 03, 2017

A working method to upgrade PrestaShop 1.2, 1.3, 1.4 or 1.5 to 1.6

A working method to upgrade PrestaShop 1.2, 1.3, 1.4 or 1.5 to 1.6



Introduction:

It was not a week goes by that my modules In User wonder whether or not this is a good idea to migrate an "old" site to the latest version of PrestaShop 1.6, and if so, how.Having the same I throw myself into the adventure of migration of this site 1.6.1 to 1.4.5.3, I could like almost everyone, I realized that the automatic migration tool PrestaShop (module " one click upgrade ") was totally unable to go through the process. The number of errors and crashes from the use of this tool is pretty amazing, as soon as one starts with a rather old version. Forget it then.So far the only alternative, or say compromise was to install a PS 16 to a virgin and export / import data (customers, orders, products, versions, categories and everything else) with the old site various tools. PrestaPricing and PrestaCategories eg for the catalog elements.

This remains a long and arduous process.There are better, much better and I will share with you this really great method. To summarize it is:1 / Migrate the database in the new format 1.6, retaining its data, without at the same PrestaShop code migration time.2 / Associate base and update a brand new PrestaShop 1.6, virgin, to end up with a site completely focntionnel 1.6, with the default theme, but utilsant your data.3 / Change website theme, re-install your add-ons (1.6 compatible versions of course)

Choice of your host provider:

Before introducing this method step, I want to return to the choice of hosting for your new website. In fact if your current website is slow, performing a major update of PrestaShop is I think the right opportunity to choose the right hosting solution.Shared or dedicated? : Below 1,000 orders per month, website traffic does not justify investing in a dedicated.There is an incredible amount of hosts and can speak totue independence of those I have had the opportunity to test in number 4:LWS: cheap solution but I strongly advise that if you support the notion is important. Answers to questions by a ticket system, often only the next day and mostly completely beside the problem.OVH: everyone knows, world number 1. But frankly I do not know why. I can not count the number of times I had to work on sites hosted in shared hosting and OVH étaitent by very slow intermittent. There's a rumor that says that OVH could set up on its shared servers a system of "protection" of bandwidth, limiting the speed or volume of SQL queries allowed on a site, not to penalize other sites even servers. So I do not recommend too.O2Switch: sitolog long been hosted at home and I still have another site for an account with them. I would say that this has still a very good economical choice because everything is "unlimited" for 6 € per month. Their support is also available and competent. But they have chosen to have only one offers the catalog and overall I was disappointed by the speed of the server and its lack of stability (sintermittents frequent stop a few minutes, never explained). In the opinion of O2Switch, because of my PrestaShop, and was unable to get support to optimize I préferré from ...Yoorshop: so I migrated my website to O2Switch Yoorshop, other French web host, identically and was able to see immediately a marked improvement in terms of speed. For a little more expensive (€ 19 / month), I have automatic backups, an SSL certificate and a truly optimized solution for speed. Their support is tip top. The only downside with this host, communication is a little "rough" times. I'm from the old school and appreciate the courtesy. This last point apart, and although I know that there may be other alternatives, I recommend to date frankly choosing YoorshopMy new site once spent frankly PS 1.6 runs faster than before.

Migration Method:


Suppose your old PrestaShop is on the server in a folder / current /1 / Make one, not two, backups of your entire site, from / current / files (with Filezilla for backup on PC or faster with the file manager of your Cpanel for a backup on the server itself ) and database (with PrestaShop or PHPMyAdmin).In fact, it goes without saying it is, but the writing is even better: I assume no liability if the following procedure failed and you have a loss of data or negative impact whatsoever.2 / During the operation, it is advisable to put the current shop in maintenance mode. So it is preferrable to do it at night when everyone is asleep to avoid losing orders.Important: If you are not comfortable with the idea of ​​doing all this directly on the server, it is also possible, see recommended, install a server emulator for PC (like EasyPHP) and do everything locally. Then upload the new site and the new database once everything works locally.My website requires a lot of customization after migration, this is what I have done, to avoid having to leave permanent site maintenance.3 / Create on the server (again if you have changed your hosting) a new directory. I call / new4 / Optional, for safety, you can also create another temporary working directory on the server and duplicated in all of your current site. I call / formerKnowing that it is very long, I jumped from me to this stage, the risk appearing weak me having previously been good backups.5 / Download PrestaShop 1.6, unzip the file on the PC to a temporary folder and a tool commme Filezilla, upload the entire contents of that folder with subfolders in the / new. Go drink coffee, is a long time ....6 / Once the transfer is complete, rename the admin folder of the new Prestashop the same name as the admin folder of your old PrestaShop7 / Give the right of access to 777 setting.inc.php file in the admin folder of the new PrestaShop.8 / Copy from / old / (or / current /) to / new / folders with the following content:/ mails/ img except subfolders / img / admin and / img / jquery-ui/ download/ upload9 / Start PHPMyAdmin on the new server (or even if you do not change server), create a new database, which I'll call "ancienneamigrer" and import it into your last backup of your current database.10 / Copy from / old / config / to New / config / settings.inc.php the file (replacement of already present in this folder)11 / Edit the contents of this file (any word processing permits) as follows:define ('__ PS_BASE_URI__', '/ new /');define ('_ THEME_NAME_', 'default-bootstrap');define ('_ DB_NAME_', 'ancienneamigrer');define ('_ DB_SERVER_', 'localhost');define ('_ DB_USER_', 'root');define ('_ DB_PASSWD_', '');Note: Adapt course root and the password to your own SQL settings.12 / This is where everything happens: from your web navigteur, go to this address:urlduserveur / new / install / upgrade / upgrade.phpor if you travailez locally:localhost / new / install / upgrade / upgrade.phpThis launches a migration script from your current database to the format (or structure) of the dernère version of PrestaShop, while preserving the data.After a few seconds or minutes ,, if the page displays an XML file whose first line containsAction = result = ok errorIs that everything went well. Congratulations.Otherwise we will have to analyze and understand the errors listed (or not) in the xml file, correct them and restart the script. What I observed:-If You are full of mistakes everywhere: Step 9 is not well focntionnée, missing tables in the database.-error 5: Writing rights issue in settings.inc.php, put it in 777-error 28: problems with the linedefine ('__ PS_BASE_URI__', '/ new /'); in setting.ic.php file-Page White: there is a syntax error in the setting.inc.php file as a missing quotation mark.13 / If everything is ok, test the new site (start with the back office with your usual logging). Should be a beautiful site to version 1.6, with its default theme and your old data.14 / Delete the folder / new / install / for safety.15 / Set up your modules, Fast Search another theme or customize the default theme, etc ...15 / If you have worked locally, when everything is ok, put it in the service, duplicate it all files and database to the server, adjust according setting.inc.php the file, test and exit the maintenance mode when everything works good.


Concerns encountered:


Activez le mode "Legacy images", puis le déplacement des images dans les sous dossiers et désactivez le mode "Legacy images".">Product images do not appear => Enable mode "Legacy pictures" and moving images in subfolders and disable the mode "Legacy Images". If not it's enough, start regeneration of thumbnails.Many errors in 404 local => disable the redirect URLsMany errors in 404 remote => disable the redirect URLs to rebuild and reactivate the .htaccess.The backoffice or afichent site without the layout, often a mistake with the line define ('__ PS_BASE_URI__', '/ new /'); in setting.ic.php fileGood luck.Franck




You may need remove combined primary key of table 'ps_hook_module'

-- Algo