Moving a PrestaShop 1.4 webshop

 When moving a PrestaShop version 1.4 webshop to a new domain name (from a development server to a live site for example) you must do the following: 

  1. Make sure all directories are writeable according to the PrestaShop installation instructions.
    Don’t forget that the files in config directory must be writeable as well as the entire cache directory structure. All files and directories in tools/smarty/compiletools/smarty/cache, tools/smarty_v2/cache and smarty_v2/compile must also be writeable.
    Internal server error 500 is a sign that these directories or files are not writeable.
  2. Update the file config/settings.php regarding PS base URI (if that will change) and the database settings.
  3. After importing the database on the new server use a tool like phpMyAdmin to access the database.
  4. Login to the Back Office of your shop on the new domain and go to Settings -> SEO & URLS and update the domain name for the shop (two fields). If this is not successful use the steps 5-7, otherwise go to step 8.
  5. Find a table named ps_configuration.
  6. Find the records PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL
  7. Update the values with your new domain name. You should enter just the domain name, no leading http:// or trailing path to subirectories (if your shop is located in a subdirectory, that should be entered in the PS base URI in step 1).
  8. If you use .htaccess and robots.txt files, go to Tools -> Generators and regenerate them.

 

Compaq HP 6910p with builtin 3G/GSM modem and Windows 7

A while ago I decided to start fresh with my HP Compaq 6910p laptop so I installed a new harddisk and Windows 7. My 6910p has an internal 3G/GSM modem (HS2300). When visiting the HP Support & Drivers page for the 6910p and Windows 7 I discovered there are no drivers or software for this 3G modem under Windows 7.

However, it turns out that both the driver and the connection manager for Vista works in Windows 7.

Download and install:

  1. HP WWAN Broadband Wireless drivers
  2. HP WWAN Connection Manager
  3. HP Broadband Wireless Client for Vodafone (or if there is one for your provider, pick that one instead)

If your 3G/GSM provider is Vodafone you’re done now. In my case I use the Swedish provider Tre (3). To use the Vodafone Connection Manager with another provider you must find out your providers APN and what number to dial (normally *99#). For Tre in Sweden the APN is "bredband.tre.se".

To use the connection manager with another provider just edit the connection profile that was installed by default and change (if necessary) the number to dial and the APN. To use Tre in Sweden the profile should look like this:

 

 

Create a start page without a corresponding menu item in Joomla!

In most cases when creating a site in Joomla!, the first choise on the menu is something like "Start" or "Home" that brings the user back to the landing page of the site. Normally you will also link the website logo to the start page.

But sometimes when creating a site in Joomla, it is not desirable to have a specific menu item with the sole purpose to bring up the start page. Just linking the logo to the start page may be sufficient and you don’t want to clutter up your menu with an additional item (or you are running out of menu space).

The solution to not having a menu item corresponding to the start page is to simply create a hidden menu, for example "hiddenmenu". Do not publish a module for it. Place the menu item that brings up the start page in this hidden menu. Done!

By the way, linking your logo to the start page can be done in the template html-file by something like this: 

<a href="<?php echo $this->baseurl; ?>"><div id="logo"></div></a>

 

 

Check if a file is open by another process in PHP (Linux/UNIX)

The PHP flock() function is good when the file locking method is used the same way by all programs that will lock the file.

However, you can’t check if any process in the system is actually using the file or not. If you for example are monitoring an incoming ftp folder, you don’t want to start processing a file until the file is completely tranferred (i.e. wait until the ftp daemon is no longer having the file open).

The following code illustrates how the command lsof can be used for the purpose: 

<?php
$filename = "locktest.txt";
$directory = ".";
while (1) {
        $result = exec("lsof +D $directory | grep -c -i $filename");
        if ($result == "0") {
                echo "$directory/$filename is NOT open ($result)\n";
        } else {
                echo "$directory/$filename IS OPEN ($result)\n";
        }
        sleep(1);
};
?>

 

Brain mouse for the brainiac

BrainmouseThis is a cool mouse from emmys.dk for all of you brainiacs. If not for yourself, maybe as a gift for your nerd friend.

They also have some funny female shaped mouses, which you of course has no need for as a cool nerd. Everybody knows that nerd is the new sexy and women stand in line to get one of their own (a nerd that is, not the mouses I’ve mentioned :)).

Ktools PhotoStore batch image regenerate

Ktools PhotoStoreThe Ktools PhotoStore software (www.ktools.net) automatically generates thumbnails, sample and large images with watermarks of the images in the database. If you change the settings regarding the image sizes only newly added images will get the new sizes.

The following simple script regenerates / resizes the thumbnails, sample and large images from the original images. It runs in batch mode, i.e it will work on every image you have in your stock_photos folder. It will overwrite your current i_, s_ and m_-versions of your images without warning. The sizes is set in the script (it does not read the current settings in the manager).

#!/bin/sh
# ps_regenerate.sh for Ktools Photo Store - http://www.ktools.net
# Copyright 2010-12-27 HelTech Communication, Stefan Helander
# http://www.heltech.se
#
# This script may be downloaded from https://nerdia.net and used for free. It is not
# allowed to redistribute this script without written permission.
#
# Requires GraphicsMagick - gm
#
# Regenerates thumbnail, sample and large images for Ktools Photo Store.
# Copy this file to photostoreroot/stock_photos and execute it
# in that folder. If necessary adjust the sizes below.
# !!! WARNING !!! This script overwrites current m_, s_ and i_versons
# of your current images without question.
#
I_SIZE=”150″
S_SIZE=”500″
M_SIZE=”1200″
COMMAND=”gm convert”
FILES=`ls *.jpg | grep -v “^m_” | grep -v “^s_” | grep -v “^i_”`
for FILE in $FILES
do

# Make i_ image
$COMMAND -size $I_SIZE "$FILE" -resize $I_SIZE "i_$FILE"
# Make s_ image
$COMMAND -size $S_SIZE "$FILE" -resize $S_SIZE "s_$FILE"
# Make m_ image
$COMMAND -size $M_SIZE "$FILE" -resize $M_SIZE "m_$FILE"

done

PrestaShop module TECHNICAL ERROR

On a PrestaShop 1.3.2.3 installation I purchased the One Page Checkout 1.2.2 and installed it. After that I got the following error message when trying to add a product to the basket in the shop front end: TECHNICAL ERROR: unable to add the product.

Details:
Error thrown: [object XMLHttpRequest]
Text status: parserror

Solution: The reason is the web server is running in SAFE MODE and the user owning all the PrestaShop files is the FTP user I use to upload the shop. When installing the One Page Checkout module it will be owned by the user running the web server process (in my case www-data:www-data). In SAFE MODE a php script is not allowed to execute a script owned by another user. The solution is to set the owner of all the order-files in the PrestaShop directory to my FTP-user (including the files installed by the OPC module). In a shell this is simply done by the chmod command: cd prestashop-installation-dir chown -R my-user:my-group order* (Replace prestashop-installation-dir with the real path where PrestaShop is installed and my-user:my-group to the userid:grouid owning the rest of the files in the Prestashop installation.)

Screen is displayed upside down or sideways on my laptop with Windows 7, Windows 8 or Windows 10

Just press and hold CTRL and ALT and then press the up arrow and the screen will return to it’s normal orientation.

In order to support devices with different orientation you can rotate the screen. The screen can be rotated left (left arrow key), right (right arrow key), upside down (down key) and normal (up key) while pressing CTRL and ALT.

My guess this is going to be the next practical joke at the office 🙂

In case the keyboard shortcut doesn’t work, it can also be fixed through control panel settings described in this article.

/tmp problem when installing plugins in WordPress

When you try to install a plugin in WordPress and get an error message like this:

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp//google-integration-toolkit.tmp) is not within the allowed path(s): (/var/www/XXX/) in/var/www/XXX/web/wp-includes/functions.php on line 2140

Warning: touch() [function.touch]: SAFE MODE Restriction in effect. The script whose uid is 12345 is not allowed to access /tmp owned by uid 0 in /var/www/XXX/web/wp-admin/includes/file.php on line 184

Download failed. Could not create Temporary file.

This is happening when the server is running with SAFE MODE because WordPress will not be able to access paths outside it’s web root. Find out the full path to your web root on the server (a hint is in the error message you just saw). Create a temporary directory within your website path and add the following line.

Edit wp-config.php and add:

define(‘WP_TEMP_DIR’, ‘/var/www/XXX/tmp’);

(Replace /var/www/XXX/tmp with the full path to your temporary directory.)

Fixing a stuck thermostat (TA RVT) on your central heating radiator

Is your radiator cold or gives very little heat? Or is it burning hot, no matter how you turn the knob on the thermostat? Then the problem is probably caused by the thermostat being stuck.

Use this instruction on your own risk. If you feel unsecure about it, call a professional. This instruction applies to central heating systems using water and a thermostat called TA RVT. If your thermostat is of another type it is possible that the procedure is similar but not necessarily. Go on with caution.

Read more