Tag: prestashop 1.6

  • Prestashop: Additional field in product attributes

    Added an additional field for product attributes

    Files updated and added to override folder

    override/classes
    Attribute.php
    line 36    public $barcode;
    line 50            ‘barcode’ =>             array(‘type’ => self::TYPE_STRING, ‘validate’ => ‘isAnything’, ‘size’ => 3),

    override/controllers/admin
    AdminAttributesGroupsController.php
    line 128
    ‘barcode’ => array(
    ‘title’ => $this->l(‘Barcode’),
    ‘align’ => ‘center’,
    ‘class’ => ‘fixed-width-xs’
    )
    line 277
    array(
    ‘type’ => ‘text’,
    ‘label’ => $this->l(‘Barcode’),
    ‘name’ => ‘barcode’,
    ‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’
    )

    Database insert column
    #     Name     Type     Collation     Attributes     Null     Default
    5     barcode     varchar(3)     utf8_unicode_ci    –     Yes     NULL

  • Prestashop 1.6: PDF invoice encoding issues for Chinese language

    File to change is located at classes\pdf\PDFGenerator.php
    Generally:
    Change helvetica font.
    Delete useless languages, leave only ‘zh’ => ‘cid0cs’,
    Change encoding.
    Than on English language documents Chinese characters are displayed correctly (address, names, etc….)
    Probably it works for other languages too.

    Source: https://www.prestashop.com/forums/topic/336709-presta-15-cant-display-chinese-characters-in-pdf-documents/?p=1702105

    class PDFGeneratorCore extends TCPDF
    {
    const DEFAULT_FONT = 'helvetica';

    public $header;
    public $footer;
    public $content;
    public $font;

    public $font_by_lang = array(
    ‘ja’ => ‘cid0jp’,
    ‘bg’ => ‘freeserif’,
    ‘ru’ => ‘freeserif’,
    ‘uk’ => ‘freeserif’,
    ‘mk’ => ‘freeserif’,
    ‘el’ => ‘freeserif’,
    ‘en’ => ‘dejavusans’,
    ‘vn’ => ‘dejavusans’,
    ‘pl’ => ‘dejavusans’,
    ‘ar’ => ‘dejavusans’,
    ‘fa’ => ‘dejavusans’,
    ‘ur’ => ‘dejavusans’,
    ‘az’ => ‘dejavusans’,
    ‘ca’ => ‘dejavusans’,
    ‘gl’ => ‘dejavusans’,
    ‘hr’ => ‘dejavusans’,
    ‘sr’ => ‘dejavusans’,
    ‘si’ => ‘dejavusans’,
    ‘cs’ => ‘dejavusans’,
    ‘sk’ => ‘dejavusans’,
    ‘ka’ => ‘dejavusans’,
    ‘he’ => ‘dejavusans’,
    ‘lo’ => ‘dejavusans’,
    ‘lv’ => ‘dejavusans’,
    ‘tr’ => ‘dejavusans’,
    ‘ko’ => ‘cid0kr’,
    ‘zh’ => ‘cid0cs’,
    ‘tw’ => ‘cid0cs’,
    ‘th’ => ‘freeserif’
    );


    public function __construct($use_cache = false)
    {
    parent::__construct('P', 'mm', 'A4', true, 'UTF-8', $use_cache, false);
    $this->setRTL(Context::getContext()->language->is_rtl);
    }

    Than change it like this:


    class PDFGeneratorCore extends TCPDF
    {
    const DEFAULT_FONT = 'cid0cs';

    public $header;
    public $footer;
    public $content;
    public $font;

    public $font_by_lang = array(

    ‘zh’ => ‘cid0cs’

    );


    public function __construct($use_cache = false)
    {
    parent::__construct('P', 'mm', 'A4', true, 'gb2312', $use_cache, false);
    $this->setRTL(Context::getContext()->language->is_rtl);
    }

  • Prestashop 1.6: Currency conversion issue Paypal module

    E.g. Default currency USD
    Customer shop with EUR
    Backoffice Payment setting for Paypal module: Shop Default Currency
    Paypal module Configuration options (Express Checkout shortcut (Offer your customers a 3-click checkout experience)
    Express checkout disabled/enabled no difference

    Let’s say, 100 EUR value is 150 USD

    Result:
    At Paypal checkout, 100 EUR becomes 100 USD
    For some reason, there is a bug in Paypal/PS that only changes the currency symbol to the Shop Default Currency without converting the value.

    Solution:
    Download the process.php file from Prestashop forum. It ensures Prestashop only send ONE default shop currency value to Paypal regardless of what currency customer selects (which is what I needed)
    Source: https://www.prestashop.com/forums/topic/268556-solved-currency-not-supported-in-paypal-358/page-2

    Backoffice Payment setting for Paypal module must be set to Customer currency
    Express checkout disabled/enabled no difference

  • Prestashop 1.6: Homepage slider not showing on mobile devices

    Homepage slider shows up on desktop version website but not on responsive default-bootstrap mobile theme. Solution is to go to the Image slider for your homepage plugin configuration and enable it for mobile devices.

    Source: https://www.prestashop.com/forums/topic/345282-my-home-page-slider-is-not-showing-on-mobile-device/ (Answer in post #8)

  • Prestashop: Paypal module v3.5.7 and up IPN validation error

    Change your IPN settings in Paypal from yoursite/modules/paypal/validation.php TO yoursite/modules/paypal/inp.php

    Source: https://www.prestashop.com/forums/topic/271627-paypal-instant-payment-notification-warning/

  • 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.