Category: ecommerce

  • Prestashop 1.6 Upgrading from old version, product images not showing

    Solution: http://www.prestashop.com/forums/topic/271091-images-not-showing-after-upgrading-1550
    Preferences > Images
    1) Set Use the legacy image filesystem to YES
    2) Click Move images
    Wait for the process to complete.
    3) Set Use the legacy image filesystem back to NO

    Should solve the problem of missing images.

  • Prestashop 1.6: enable collation_database for creating tables

    DB tables created with a collation different than the database collation
    http://www.prestashop.com/forums/topic/363458-fresh-install-doesnt-prestashop-respect-the-existing-database-collation/
    Solution: http://forge.prestashop.com/browse/PSCSX-3486

  • Prestashop: Category Quantity Discount

    Apply Quantity Discounts across all products in a category
    Prestashop 1.2 – 1.3 Source: http://www.prestashop.com/forums/topic/75558-mod-quantity-discounts-for-all-the-products-in-the-same-default-category/
    Prestashop 1.4 – 1.6 Source: http://www.prestashop.com/forums/topic/140803-free-module-category-quantity-discount-apply-quantity-discounts-across-all-products-in-a-category/

    Quantity discount is calculated based on the price of product. For promotion mechanics below, if we use the built-in sale price function for 1 product, the quantity discount will be calculated based on the discounted price of 1 product.
    Purchase 1 items 10% off
    Purchase 2 items 15% off
    Purchase 3 items 20 % off
    Purchase 4 items 25 % off
    Purchase 5 items 30% off
    Purchase 6 items 35% off

    So we disable the admin check for minimum more than 1 quantity in order to allow creating quantity discount % for purchase of 1 product.
    change: admin/tabs/AdminProducts.php

    elseif (!($quantity_discount = intval(Tools::getValue(‘quantity_discount’))) OR $quantity_discount <= 1) $this->_errors[] = Tools::displayError(‘quantity is required and must be superior of 1’);

    to

    elseif (!($quantity_discount = intval(Tools::getValue(‘quantity_discount’))) OR $quantity_discount <= 0) $this->_errors[] = Tools::displayError(‘quantity is required and must be superior of 0’);

  • Prestaship 1.3 Force default currency for checkout

    Source: http://www.prestashop.com/forums/topic/9473-module-force-currency/

    Note: Error in amount shown in store owner email but is correct in customer email. Use with caution.

    in init.php before:

    $currency = Tools::setCurrency();

    add:

    $cookie->id_currency = intval(Configuration::get(‘PS_CURRENCY_FRONT_DEFAULT’));

    in admin/tabs/AdminCurrencies.php after:

    ‘PS_CURRENCY_DEFAULT’ => array(‘title’ => $this->l(‘Default currency:’), ‘desc’ => $this->l(‘The default currency used in shop’), ‘cast’ => ‘intval’, ‘type’ => ‘select’, ‘identifier’ => ‘id_currency’, ‘list’ => Currency::getCurrencies()),

    add:

    ‘PS_CURRENCY_FRONT_DEFAULT’ => array(‘title’ => $this->l(‘Default currency front:’), ‘desc’ => $this->l(‘The default currency used in front shop’), ‘cast’ => ‘intval’, ‘type’ => ‘select’, ‘identifier’ => ‘id_currency’, ‘list’ => Currency::getCurrencies()),

    Next go to admin->payment->currencies and set up your default shop currency. Customer CAN change the currency if needed.

  • Prestashop 1.6 Remove backoffice module update notifications listing

    Modules are updated according to prestashop core file updates. However the currently installed shop may not be compatible with the latest module updates. To prevent accidentally breaking the shop due to incompatible module updates,
    Go to Administration Preferences to disable Automatically check for module updates

    The following help to remove the update notification listing doesn’t remove the module button highlight but it is good enough for now.

    Source: http://www.prestashop.com/forums/topic/319074-solvedhow-to-remove-bo-module-update-notifications/

    I remove the next code from <admin directory>/themes/default/template/controllers/modules/page.tpl:

    Lines 70 to 80

    ****************************************************************************************************

    {if $upgrade_available|@count}
    <div>
    {l s=’An upgrade is available for some of your modules!’}
    <ul>
    {foreach from=$upgrade_available item=’module’}
    <li><a href=”{$currentIndex|escape:’html’:’UTF-8′}&amp;token={$token|escape:’html’:’UTF-8′}&amp;anchor={$module.anchor|escape:’html’:’UTF-8′}”><b>{$module.displayName|escape:’html’:’UTF-8′}</b></a></li>
    {/foreach}
    </ul>
    </div>
    {/if}

    ****************************************************************************************************

  • Prestashop 1.6: Delete all sample data

    1) Remove statistics information from dashboard.
    Click NO to ‘Demo Mode’ on your Dashboard. It’s on the lower right hand side.

    2) Remove all sample and demo orders, catalog etc from the database
    Go to the “Modules > Modules” page.
    Find the “Database Cleaner” module and click its “Install” button.
    You are directly taken to its configuration page (if not, click its “Configuration” button).
    Read and accept the warning, then click the “Delete Catalog” button: it will delete all your products and their attributes, manufacturers, etc.
    Read and accept the warning, then click the “Delete Orders & Customers” button: it will delete all your customers and their orders, carts, etc.
    Click the “Check & fix” button to refine your database integrity constraints.
    Click the “Clean & optimize” button to reorganizes the physical storage of table data and associated index data, to reduce storage space and improve I/O efficiency when accessing the tables.

    THERE IS NO WAY BACK. Be sure to only click these buttons if you do intend to wipe your database from its default content.

    Source: http://www.prestashop.com/forums/topic/320579-delete-all-sample-data/

  • Tips to Optimise your php.ini File for PrestaShop

    PrestaShop system requirements Summary:
    Web server: Apache 1.3, Apache 2.x, Nginx or Microsoft IIS
    PHP 5.4+
    MySQL 5.0+
    PHP memory_limit 2048M
    upload_max_filesize 100M
    max_execution_time 1000
    post_max_size 100M
    max_input_time -1

    PHP extensions: GD, cURL, SimpleXML, SOAP
    To improve performances: MemCached, mcrypt PHP extension

    Source: http://www.prestatraining.com/12-tips-to-optimise-your-php-ini-file-for-prestashop/

    Memory and Size Limits

    There are times when you may encounter an error because you’ve exceeded a PHP limit that is set on your server.  You can increase these limits in your php.ini file.

    Tip: One common limit that is exceeded is the memory limit.  One case where you may encounter this limit is when you upload a full-resolution image and PHP is unable to load the entire image into memory.  In this case, you could manually reduce the size of the image before uploading it, or you could increase the memory limit by searching for and changing the memory_limit setting in php.ini, or add it if it doesn’t exist:

    ; Set memory limit in megabytes
    memory_limit = 128M

    If you are using shared hosting, which is common with inexpensive hosting packages, try to set the smallest limit you can that stops the memory limit error.  If you set the memory limit too high, it is possible for inefficient code to use up too much memory and cause performance issues for other users on your server.  In that case, your host may shut down your account until you reduce your memory usage.

    If you find yourself needing a high memory limit, it may be better for you to upgrade to a virtual private server (VPS) or a dedicated server so that you don’t have to share the server’s RAM.  You can then increase the RAM as high as you like, as long as it doesn’t exceed the total RAM that is available in the server.

    Tip: The other common limit that is exceeded is the maximum execution time.  One case where you may encounter this limit is when you import a large number of products.  Once the maximum execution time has elapsed, PHP will stop the script and display an error message.  You can increase the maximum execution time by searching for and changing the max_execution_time setting in php.ini, or add it if it doesn’t exist:

    ; Set maximum execution time in seconds
    max_execution_time = 120

    Like the memory limit, if you are using shared hosting, you should try to set the shortest time you can that stops the timeout error.  If you set the maximum execute time too high, it is possible for inefficient code to cause many PHP scripts to be running at the same time for an extended period, using up a lot of the server’s resources.  In that case, your host may shut down your account until you reduce the number of PHP scripts that are running.

    If you find yourself needing a high maximum execution time, it may be better for you to upgrade to a VPS or a dedicated server so that you don’t have to share the server’s resources.

    Tip: When uploading a large product image, you may also encounter the maximum file upload size limit.  In this case, you could manually reduce the size of the image, or you could increase the maximum file upload size by searching for and changing the upload_max_filesize setting in php.ini, or add it if it doesn’t exist:

    ; Set maximum file upload size in megabytes
    upload_max_filesize = 32M

    Set the value to the size of the largest product image or downloadable product you expect to upload through the Back Office.  That way, you will get an error message if you accidentally upload a product image that is too high resolution.  It is best to resize product images to the resolution they are displayed in the Fancybox before uploading to minimise the amount of disk space used on the server.  Downloadable products should also be compressed as ZIP files to reduce the amount of space used.

    Tip: Two more limits that may be encountered are the maximum post size and maximum input time.  One case where you may encounter these limits is when you are saving a large number of module translations.  In this case, you will need to increase the maximum post size and maximum input time by searching for the post_max_size and max input time settings in php.ini, or adding them if they don’t exist:

    ; Set maximum post size in megabytes
    post_max_size = 32M

    ; Set maximum input time in seconds
    max_input_time = 180

    If you are using shared hosting, you should try to set the smallest values you can that stop the error messages.  A value that is too high may use up too much disk space or other resources on the server, causing performance issues for other users on your server.

  • PrestaShop 1.3 BackOffice login refresh issue

    Took over an ecommerce project running PrestaShop 1.3.

    The BackOffice’s unexplained admin login time-out issue was driving me crazy. Tried many solutions to optimise the various settings to no avail. Finally found this solution below which finally worked.

    Solution discovered by http://www.gibni.com/solved-prestashop-backoffice-login-refresh

    Steps here:

    In the file “login.php” under your BackOffice’s folder, on line 55, you have:

    $cookie = new Cookie(‘psAdmin’, substr($_SERVER[‘PHP_SELF’], strlen(__PS_BASE_URI__), -10));

    where the “-10″ value corresponds to the number of letters of “prestashop”, set it to the number of letters of your store’s sub-directory name and your will be back in business again.

    For example:
    if your store is located at: http://www.yourdomain.com/store/
    the word “store” contains 5 letters, so the line 55 in login.php should become:

    $cookie = new Cookie(‘psAdmin’, substr($_SERVER[‘PHP_SELF’], strlen(__PS_BASE_URI__), -5));