Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by MaXi32

  1. Hello there, what are the alternative ways to put prestashop into a maintenance  from the backend server ? 

    At this moment, if I want to manually put a prestashop website into maintenance mode, I can manually change the ps_configuration table.

    So, I created a bash script and change the database table to maintenance mode like this. This is working for me:

            echo "[$script_name | info]: Turning on server maintenance mode for user admin:" | tee -a $REPORT_FILE
            # For lozira.com (prestashop)
            # Clear Prestashop IPs from back office
            mysql -u $LOZDBUSER -p$LOZDBPASS -D $LOZDBNAME -e "UPDATE ps_configuration SET value = NULL WHERE ps_configuration.id_configuration = 1002;"
            # Disable prestashop shop from back office
            mysql -u $LOZDBUSER -p$LOZDBPASS -D $LOZDBNAME -e "UPDATE ps_configuration SET value = 1 WHERE ps_configuration.id_configuration = 28;"
            if [ $? -eq 0 ]; then
                    echo "[$script_name | info]: OK, the website of domain.com is now under maintenance mode" | tee -a $REPORT_FILE
                    echo "[$script_name | info]: Warning, unable to put website of domain.com in maintenance mode" | tee -a $REPORT_FILE

    The front page is under maintenace mode but I notice I can still access into the back office domain.com/backofficeurl (this is what I don't want). I also want to block admin users from accessing the back office until the script finished running.

    Another way I can think of is creating maintenance using .htaccess in the root domain and then another htaccess inside domain.com/backofficeurl.. but is that one of the alternative approaches ? How do you put the entire site including people at the back office who won't be able to log into dashboard ? Then you can enable this from the server. I know how to do this in wordpress using .maintenance file but in prestashop I don't find any alternative ways. Is there an approach like wordpress .maintenace file ?

  2. I can think of creating duplicated countries and this might work. I saw a Malaysian website (using prestashop as well) who might ran out of idea how to solve this and he created 3 Malaysia countries like in the screenshot. So, I think he assign states in Zone 1 to country Malaysia Peninsular, Sabah State into Malaysia Sabah, and Sarawak State into Malaysia Sarawak.


    Screenshot (the website is jelitasara.com):


    I think this is a bad idea because a country shouldn't be divided like that and a country must have standard and specific ISO CODE. So using Zone is a must but that doesn't work.

    Anyone have suggestion or any module that can fix this problem ?


    Edit: seems like this feature is not available and someone suggest to use a module instead. https://github.com/PrestaShop/PrestaShop/issues/11662

  3. Ok.. reading up few posts, I think this is a design flaw by PS. In my country Malaysia the shipping fee is based on local state example i'm in the Peninsular Zone. So,


    Shipping between Peninsular Malaysia (Zone 1) - > The price is MYR 7

    Shipping to Sabah (Zone 2) -> The price is MYR 11

    Shipping to Sarawak (Zone 3) -> The price is MYR 11

    So, I created 3 Zones


    Zone 1 -> which contains this state: Johor, Melaka, Selangor, Pahang, Kuala Lumpur, Putrajaya, Labuan, Penang, Kelantan, Terengganu, Perlis ...

    Zone 2 -> which contains this state: Sabah

    Zone 3 -> which contains this state: Sarawak

    So, I assigned them perfectly. 


    Now, for the courier, I only select this 3 Zones and assign the price between 0kg to 10000kg with the fixed price above.


    Next I made a sample purchase, in the address I put the state 'Melaka' and it's in Zone 1. But guess what, I cannot select courier there is no courier available to be selected. The reason is because.... Malaysia Zone is in Asia!!! and I also have to select Asia Zone in courier but selecting the Asia Zone I have to define the price for that Asia zone.. meaning that... whatever state I selected I got the delivery price from the Asia Zone not the Zone from Zone 1, Zone 2 or Zone 3.

    So.... anyone have answer for this ?



  4. On 6/1/2020 at 4:29 PM, BoshLog said:

    @mimpro Hai, saya baru je cuba prestashop ni untuk e-commerce website . saya nak tanya mcm mana nak intergrate payment gateway sama ada menggunakan ToyyibPay atau BillPlz? sesiapa boleh bantu saya tak untuk memahamkan integration payment gateway., thank you.

    Boleh PM saya untuk maklumat lanjut.  Kalau nak integrate macam biasa biasa:

    Pergi dekat github ada salah satu developer yg develop billplz module

    Tapi sebelum integrate memang kena daftar dulu account dengan mereka



  5. Can anyone shed more light to this post especially on the ps 1.7.



    On 2/18/2020 at 9:06 PM, Joyplaz said:

    Is anybody else getting false positives with this function?

    $this->context->smarty->assign('isMobile', $this->context->isMobile());

    When I var_dump $isMobile in my tpl file, sometimes on desktop it shows true and on mobile (from my chrome dev tools) shows false.  Then randomly after a bunch of refreshes it will work.

    FYI, I'm using prestashop 1.7

     this one is working. thanks a lot

  6. I can see prestashop already has helper form of birthday field:

    Find the file ../classes/form/CustomerFormatter.php

    in line 196 change the setType('text') to setType('date'):

    if ($this->ask_for_birthdate) {
        $format['birthday'] = (new FormField())
            ->setType('text')   //change this to date


    When I use that type birthday I got the populated field like prestashop 1.6 but, it doesn't work when saving. So, I think the birthday type is deprecated helper. Any help ?

  7. In the previous version of Prestashop 1.6 the registration  form has datepicker for birthday field with a dropdown list where we can select month, day, year.

    Prestashop Version 1.6 [screenshot]

    Then in the latest version of Prestashop, the registration form for the birthdate field doesn't have datepicker, we need to manually type in date in the birthdate input field.

    Prestashop Version [screenshot]


    In prestashop 1.6 this is the code how the date dropdown appear:

    <div class="form-group">
                            {l s='Date of Birth'}
                        <div class="row">
                            <div class="col-xs-4">
                                <select name="days" id="days" class="form-control">
                                    <option value="">-</option>
                                    {foreach from=$days item=v}
                                        <option value="{$v}" {if ($sl_day == $v)}selected="selected"{/if}>{$v}&nbsp;&nbsp;</option>
                            <div class="col-xs-4">
    								{l s='January'}
    								{l s='February'}
    								{l s='March'}
    								{l s='April'}
    								{l s='May'}
    								{l s='June'}
    								{l s='July'}
    								{l s='August'}
    								{l s='September'}
    								{l s='October'}
    								{l s='November'}
    								{l s='December'}
                                <select id="months" name="months" class="form-control">
                                    <option value="">-</option>
                                    {foreach from=$months key=k item=v}
                                        <option value="{$k}" {if ($sl_month == $k)}selected="selected"{/if}>{l s=$v}&nbsp;</option>
                            <div class="col-xs-4">
                                <select id="years" name="years" class="form-control">
                                    <option value="">-</option>
                                    {foreach from=$years item=v}
                                        <option value="{$v}" {if ($sl_year == $v)}selected="selected"{/if}>{$v}&nbsp;&nbsp;</option>


    In prestashop 1.7, the registration template is located at .. /templates/customer/_partials/customer-form.tpl. In prestashop 1.7, this is the code how the date appear looping the form:

    <form action="{block name='customer_form_actionurl'}{$action}{/block}" id="customer-form" class="js-customer-form" method="post">
        {block "form_fields"}
          {foreach from=$formFields item="field"}
            {block "form_field"}
              {form_field field=$field}
          {$hook_create_account_form nofilter}

    My question is how to edit this date field before it populate data. Like:


    {if $field['name'] == 'birthday''} 
    // Change birthdate field here to dropdown


    Any idea ?

  8. 22 hours ago, Prestafan33 said:

    It should be the same, but it also deletes XML cache and theme cache.

    This module only makes the same you were talking about in this thread, cleaning cache using this:


    It also adds the ability to set a time for cleaning repeatedly. But the way it works is the same as other people were posting here.

    You can check at Tools.php and Media.php files the content of those methods:

    * Clear Smarty cache and compile folders.
    public static function clearSmartyCache()
    	$smarty = Context::getContext()->smarty;
    * Clear XML cache folder.
    public static function clearXMLCache()
    	foreach (scandir(_PS_ROOT_DIR_ . '/config/xml', SCANDIR_SORT_NONE) as $file) {
    		$path_info = pathinfo($file, PATHINFO_EXTENSION);
    		if (($path_info == 'xml') && ($file != 'default.xml')) {
    			self::deleteFile(_PS_ROOT_DIR_ . '/config/xml/' . $file);
    * Clear theme cache.
    public static function clearCache()
    	$files = array_merge(
    		glob(_PS_THEME_DIR_ . 'assets/cache/*', GLOB_NOSORT),
    		glob(_PS_THEME_DIR_ . 'cache/*', GLOB_NOSORT)
    	foreach ($files as $file) {
    		if ('index.php' !== basename($file)) {
    	$version = (int) Configuration::get('PS_CCCJS_VERSION');
    	Configuration::updateValue('PS_CCCJS_VERSION', ++$version);
    	$version = (int) Configuration::get('PS_CCCCSS_VERSION');
    	Configuration::updateValue('PS_CCCCSS_VERSION', ++$version);


    Thanks a lot for this information. I thought that in prestashop 1.7, the theme cache also went inside /var/cache folder. Now I understand.

  9. On 7/5/2020 at 3:12 AM, Prestafan33 said:

    Yes, you can use this module. The method it uses to clear cache is the same that @mmsh describes in his post in this thread.

    It has two execution methods available: through own module (you can set execution time at settings), or through a CRON task (you'll get an URL you can use to program it at CRON job).

    I posted the module in Spanish forum, but it's also in english, so you can use it and settings will appear in english.

    Since you are the developer of this module,  I have a question:

    Does deleting the /var/cache folder manually equivalent to cleaning everything using this module ?

  10. 3 hours ago, bnadauld said:

    ive always been unsure how the /img/ directory is created and used in Prestashop. My 1.6 site shows an image the site actually uses is in really odd directory locations /img/5/6/5/556.jpg

    I think the base image is like 123.jpg and the image for thumbnail (non-base image) are like:


    each folder has its own category (in prestashop 1.7):


    public_html/img/c/123.jpg = image for category
    public_html/img/p/123.jpg = image for product
    public_html/img/s/123.jpg = image for shipping logo

      in prestashop 1.6 I think this is the answer: 


    3 hours ago, bnadauld said:

    Do you have to have them in these locations or is there a way to tidy this up -  ie to 'regenerate all the derived image formats' - not really sure what this is?

    Can you help?

    You can regenerate the thumbnail images at: Design - > Image Settings -> Regenerate thumbnails, so if you accidentally deleted the thumbnail image 123-cart_default.jpg (or just to save space for backup), then you can regenerate here.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More