Tag: prestashop

  • Prestashop: Allow wildcard search

    Source: https://www.prestashop.com/forums/topic/280306-native-prestashop-search-module-issuessolved-casesimprovementsother/
    The search index indexes on individual words and as it is now, wants you to give a search word from the beginning of the word.

    To fix this, we need to edit the file Classes/Search.php

    to fix this, change the code a little like this: (find the lines in the code above and add the % three times:
    
    ...
    ? ' \'%'.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
    : '\'%'.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
    );
    
    if ($word[0] != '-')
     $score_array[] = 'sw.word LIKE \'%'.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\'';
    ...
  • Prestashop: How to make home slider fade in version 1.6

    Open yourdomain/themes/yourtheme/js/modules/homeslider/js/homeslider.js

    and change this:

    if (!!$.prototype.bxSlider)
            $('#homeslider').bxSlider({
                useCSS: false,
                maxSlides: 1,
                slideWidth: homeslider_width,
                infiniteLoop: homeslider_loop,
                hideControlOnEnd: true,
                pager: false,
                autoHover: true,
                auto: homeslider_loop,
                speed: homeslider_speed,
                pause: homeslider_pause,
                controls: true
            });

    to this

    if (!!$.prototype.bxSlider)
            $('#homeslider').bxSlider({
                useCSS: false,
                maxSlides: 1,
                slideWidth: homeslider_width,
                infiniteLoop: homeslider_loop,
                hideControlOnEnd: true,
                pager: false,
                autoHover: true,
                auto: homeslider_loop,
                speed: homeslider_speed,
                pause: homeslider_pause,
                mode: 'fade',
                controls: true
            });

    Source: https://www.prestashop.com/forums/topic/325730-solvedhow-to-make-home-slider-fade-in-version-16/

  • Prestashop: contentBox HTML module

    Description: contentBox is a very simple, very intuitive and very powerful Prestashop Module. With contentBox you can add html blocks to prestashop, JAVASCRIPT + CSS blocks anywhere you want inside Prestashop 1.5 or Prestashop 1.6.

    Link: http://contentbox.org/

    Works great for adding content to prestashop, like organising CMS links in footer etc.

  • Prestashop 1.6: Get id_customer and getDefaultGroupId

    Source: http://stackoverflow.com/questions/16231440/how-to-get-prestashop-current-user-id
    Example:
    $id = (int)$this->context->customer->id;
    $id_default_group = Customer::getDefaultGroupId((int)$id);

  • Prestashop 1.6: how to centralise logo in new theme

    Source: http://www.prestashop.com/forums/topic/318418-solved-center-logo-in-new-theme-16/
    open header.tpl file (located in your theme dir) and remove this code:

    <div id="header_logo"><a title="{$shop_name|escape:'html':'UTF-8'}" href="{$base_dir}">
    <img src="{$logo_url}" alt="{$shop_name|escape:'html':'UTF-8'}" width="{$logo_image_width}" height="{$logo_image_height}" />
    </a></div>

    then go to /themes/default-bootstrap/modules/blocksearch/blocksearch-top.tpl and paste code that you removed at the end of the file

    Possible issue: This edit may affect the responsive layout, leaving the logo in the middle of the screen in between Search block and Cart block.

  • 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: 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/