Posts

Prestashop multistore – can’t get out of maintenance mode

After maintenance even though setting to shop to active, frontend still shows maintenance mode. This can occur when multistore is enabled.

Solution:

  • Use for example phpMyAdmin to access the shop database
  • Find the ps_configuration table
  • Find all records with the name PS_SHOP_ENABLE and change them from ‘0’ to ‘1’ (there are probably more than one)
PrestaShop

Random product added to cart along with selected product in PrestaShop [solved]

Using PrestaShop 1.6.1.18, this was an older shop that had been offline for a couple of years. It had been upgraded in steps from PrestaShop 1.4 via 1.5 to 1.6. While testing it before relaunch of the shop a problem was discovered. Sometimes when adding a product to the shopping cart, another random product was added. When testing the shop in incognito/private mode this happened more frequent.

It turned out to be a discrepancy between cart ID:s in the two tables ps_cart and ps_cart_product.

Solution:

  1. Use phpMyAdmin or similar to open your PrestaShop database.
  2. Go to the table ps_cart_product, make sure it is ordered by the id_cart column and go to the last page.
  3. Make a note of the highest id_cart value.
  4. Go to the table ps_cart, make sure it is ordered by the id_cart column and go to the last page.
  5. Compare this table’s highest id_cart value with the one you found in ps_cart_product. It will probably be a lower number and this is what is causing the problem. When a visitor puts something in a cart, a new row is created in ps_cart with id_cart value auto incremented but there is already a row in ps_cart_product with this id_cart value from a previous visitor.
  6. Add a new row to ps_cart and in the id_cart field enter the number of the highest value you found in ps_cart_product. Then save the row.
  7. You will probably see some error message about invalid or missing fields but that will be ok as long as the row is saved.

 

PrestaShop

How to move a PrestaShop 1.6 from one domain to another (resolving redirect problems)

There are several descriptions online on how to do this but in one occasion, even though I followed the instructions carefully it kept redirecting me to the old domain name. In my particular case the culprit was that the site used file system cache which was active before the move.

The following procedure fixed my problem. The base of the instructions come from the PrestaShop site with my additions below.

  1. Put the site in Maintenance mode.
  2. Copy all files from the old site (domain) to the new using for example a FTP program.
  3. Dump the old site database to a file and import the database on the new server.
  4. Edit config/settings.inc.php and update the values for _DB_SERVER, _DB_NAME, _DB_USER, _DB_PASSWD and you might need to adjust _PS_DIRECTORY value.
  5. Using phpMyAdmin, go to the table ps_store_url and update the record regarding domain name and physical uri.
  6. Using phpMyAdmin, go to the table ps_configuration and find the records for column name with the records for PS_SHOP_DOMAIN, PS_SHOP_DOMAIN_SSL and __PS_BASE_URI__ and update the values corresponding to the new domain name and base uri.
  7. Using FTP (or other preferred method) clear all content except index.php of the ‘/cache/smarty/compile’ and ‘/cache/smarty/cache’ directories.
  8. Using FTP (or other preferred method) clear all content of the ‘/cache/cachefs’ directory.
  9. Log in to the backend and disable Maintenance mode.
PrestaShop

Error 500 after PrestaShop upgrade from 1.5 to 1.6

Upgrading a PrestaShop 1.5 to 1.6 resulted in Error 500 when visiting the shop frontend. During the upgrade I had selected to disable all non native modules, replace theme with default theme and updating all emails.

I tried every trick in  the book, like cleaning the cache, disable all caching and compression, etc but it didn’t help.

The problem was solved like this:

  • Go to Preferences -> Themes
  • Make sure the default-bootstrap theme is selected
  • Click on the Advanced options button for the theme
  • It turned out the setting for Folder was not set to any folder (no radio button selected). Select default-bootstrap folder and Save

This solved the problem for me.

PrestaShop 1.6 – unable to remove product from cart [solution]

If it’s not possible to remove an item from the cart in PrestaShop 1.6, try this solution:

Advanced settings -> Performance -> Move JavaScript to the end = NO

The problem seems to occur in Chrome and Microsoft Internet Explorer but not in other browsers like Firefox for example.

PrestaShop and PayPal payment error after checkout – 699 kr was paid instead of 699 kr [solved]

A client running PrestaShop 1.6.1.13 with PayPal payment module version 3.11.4 had problems after checkout of orders with an error message saying “699 kr was paid instead of 699 kr”. It turned out it was a rounding error where PrestaShop and PayPal use different methods of calculating the rounding.

The solution suggested was:

  • Go to preferences -> General
  • Rounding rule: Round to infinity when the value is halfway (recommended)
  • Rounding Type: Rounding for each element

This solved part of the problem. However, the client applied a store wide discount of 30%, causing a product (for example) costing 999 kr to checkout at 699 kr. To be precise, 999 kr minus 30% discount is 699,30 kr, but the 0,30 was rounded off. The same problem as mentioned above occured even when putting one piece of this item in the cart and checking it out.

It turned out that the theme used (jms_homewares version 1.0) only display prices in full kronor, without any decimals, independent of the settings regarding decimals in the Preferences -> General tab. In this case the settings was set to display 2 decimals. Setting it to 0 decimals solved the problem. I should mention that I am not sure if this is standard behavoiur of jms_homewares or if it has been modfied by the website developer. However, in this case setting it to display 0 decimals made everyting work without errors.

PrestaShop PHP error Cannot redeclare class BlowfishCore on Ubuntu 14.04 server [solution]

Edit /etc/php5/cgi/conf.d/05-opcache.ini. Add:

opcache.enable=0
opcache.enable_cli=0

Change sorting / position of products in PrestaShop featured section on the start page

  1. In the PrestaShop backoffice (admin), go to Catalog -> Products
  2. Above the product list, tick the “Filter by category”
  3. Select the “Home” category in the category list that drops down under the “Filter by category”
  4. Now far to the right you will find a “Position” column where you can use the arrows to move the products up and down

Copy of PrestaShop default-bootstrap theme from 1.6.0.6 doesn’t display submenus after upgrade to 1.6.0.9

I made a customized theme by copying the PrestaShop default-bootstrap theme in version 1.6.0.6. After an upgrade to 1.6.0.9 the theme will no longer show the dropdown submenus.

The reason is that after the upgrade, the default-bootstrap has been updated but my customized copy hasn’t causing some needed JS files not being loaded.

The quickest solution is to go into Advanced Parameters -> Performance and enable Move JavaScript to the end

 

I found information about the problem here.

 

Multiple attributes / combinations in PrestaShop

Here is the documentation on how to add attributes / combinations to a product in PrestaShop -> http://doc.prestashop.com/display/PS16/Managing+Product+Attributes

If you plan on using multiple attributes for a product, like size and colour, do use the combinations generator and select both the possible sizes and colours at the same time. If you add them by hand one by one you risk ending up with a scenario where only the first attribute is visible in the shopping cart and on the resulting order (like the size but not the colour), i.e. you will have to contact the customer to ask about the other attribute(s).

By using the generator PretaShop will create the all the necessary combinations for you, i.e. size 1 + colour 1, size 2 + colour 1, size 1 + colour 2, size 2+ colour 2 and so on.