Jump to content

arafatx

Members
  • Posts

    84
  • Joined

  • Last visited

Posts posted by arafatx

  1. On 3/18/2021 at 10:56 PM, dandumit said:

    @arafatx - what control panel do you use ?  could you please share nginx configuration  ? on mine does not work with media servers. there is still to be added for CSS files.

    Sorry for late reply. It's been few months. I actually use Directadmin control panel. When you use nginx_apache, the prestashop site run on nginx and you can use apache config. So it works out of box.

  2. Seems like an old threat but valid question as today so many cases like this one.

    Since you ask about how to block proxy sites or tor exit and you need this in free way, i suggest that you use a firewall that come with this feature such as Config Server Firewall (CSF)- This is free and it has blocklists setting where you can block tor exit users and list of proxies used by internet users to make this fraud transaction.

  3. On 8/25/2020 at 1:04 AM, ericksonvornes said:

    Did you solved??

     

    Edit. Solved it. Actually it works on prestashop 1.7.6.8. Maybe something wrong with the previous prestashop version but now it's working fine when changing to date. Just change what I said. Also I made a mistake about the type. It should be 'date' not 'birthday'

  4. Ok I think the best is using htaccess for all website. So, I don't have to query SQL: This code is working fine here:

     

            web_user="admin"
            web_domain="mypswebsite.com" # 
            web_sub_folder=""
            web_type="prestashop"
            admin_path="admin"
            maintenance_status=1 #1 = on, #0 = off
    
            # DEFINE FIXED PATH for all maintenance htaccess sites
            maintenance_htaccess_www="/home/$web_user/domains/$web_domain/public_html/$web_subfolder/.htaccess"
            # DEFINE ANOTHER PATH for htaccess maintenance file
            # for prestashop maintenance file
            ps_maintenance_htaccess_admin="/home/$web_user/domains/$web_domain/public_html/$web_subfolder/$admin_path/.htaccess"
    
            if [ $maintenance_status == 1 ]; then
                    echo "[$script_name | info]: Turning on server maintenance mode for user $web_user" | tee -a $REPORT_FILE
                    # rename current htaccess as backup .htaccess_x
                    mv -f "${maintenance_htaccess_www}" "${maintenance_htaccess_www}_x"
                    # create .htaccess file with maintenance content including the html (overwrite)
                    touch $maintenance_file_www
                    echo "# AUTO GENERATED BY MAXIRSYNC BACKUP CRON" >> $maintenance_htaccess_www
                    echo "# This htaccess putting website $web_domain into maintenance mode" >> $maintenance_htaccess_www
                    echo "RewriteEngine on" >> $maintenance_htaccess_www
                    echo "RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]" >> $maintenance_htaccess_www
                    echo "RewriteRule .* /maintenance.html [R=302,L]" >> $maintenance_htaccess_www
                    # wait 1 seconnd
                    chmod 644 $maintenance_htaccess_www
                    chown $web_user:$web_user
                    sleep 1
                    if [ "$web_type" == "prestashop" ]; then
                            # DO PRESTASHOP THING
                            # rename current htccess inside admin_dash into .htaccess_y
                            mv -f "${ps_maintenance_htaccess_admin}" "${ps_maintenance_htaccess_admin}_y"
                            # copy the same .htaccess including permission file from root to admin_dash
                            cp -p "${maintenance_file_www}" "${ps_maintenance_htaccess_admin}"
                    elif [ "$web_type" == "wordpress" ]; then
                            # DO EXTRA WORDPRESS THING
                            :
                    fi
                    echo "[$script_name | info]: OK, the website of $web_domain is now under maintenance mode" | tee -a $REPORT_FILE
            else # maintenance status = 0
                    # rename the backup .htaccess_x into .htaccess (and overwrite)
                    mv -f "${maintenance_htaccess_www}_x" "${maintenance_htaccess_www}"
                    if [ "$web_type" == "prestashop" ]; then
                            # PS
                            # rename back the admin_path .htaccess_y into .htaccess inside that admin_dash folder (and overwrite)
                            mv -f "${ps_maintenance_htaccess_admin}_y" "${ps_maintenance_htaccess_admin}"
                    elif [ "$web_type" == "wordpress" ]; then
                            # WP
                            :
                    fi
                    echo "[$script_name | info]: OK, the website of $web_domain is now under live mode" | tee -a $REPORT_FILE
            fi

     

  5. I'm writing the script to put all website in maintenance mode. The bash script is dynamic so it will identify which user to put into maintenace mode, using sql statement is not good here to identify which web_user. So if there is a way like using file based maintenance mode (like wordpress) I really like to know this:     

      #web_user="userwordpress"
    
            #web_domain="mywsite.com"
            #web_sub_folder="www"
            #web_type="wordpress"
            #maintenance_status=1 #1 = on, #0 = off
    
           web_user="userprestashop"
    
           web_domain="mypssite.com"
            web_sub_folder="www"
            web_type="prestashop"
            maintenance_status=1 #1 = on, #0 = off
    
    
    
            if [ $maintenance_status == 1 ]; then
                    if [ "$web_type" == "wordpress" ]; then
                            echo "[$script_name | info]: Turning on server maintenance mode for user $web_user" | tee -a $REPORT_FILE
                            maintenance_file="/home/$web_user/domains/$web_domain/public_html/$web_sub_folder/.maintenance"
                            if [ -f $maintenance_file ]; then
                                    echo "[$script_name | info]: OK, the website of $web_domain is already in a maintenance mode" | tee -a $REPORT_FILE
                            else
                                    touch $maintenance_file
                                    echo "# AUTO GENERATED BY MAXIRSYNC BACKUP CRON" >> $maintenance_file
                                    echo "<?php" >> $maintenance_file
                                    echo "$upgrading = time();" >> $maintenance_file
                                    echo "?>" >> $maintenance_file
                                    chmod 644 $maintenance_file
                                    chown $web_user:$web_user
                                    echo "[$script_name | info]: OK, the website of $web_domain is now under maintenance mode" | tee -a $REPORT_FILE
                            fi
                    fi
                    if [ "$web_type" == "prestashop" ]; then
                            # Prestashop put maintenance mode
                    fi
            else # maintenance status = 0
                    if [ "$web_type" == "wordpress" ]; then
                            if [ -f $maintenance_file ]; then
                                    rm -f $maintenance_file
                            fi
                    else
                            # Prestashop put back live mode
                    fi
            fi

     

  6. 5 minutes ago, musicmaster said:

    You might consider to put all the employees in the employee table as "inactive".

    Ok that is a great idea. But, I forgot to mention, I don't want to write script using sql like above because it has sensitive information about db login. I mean is there alternative way other than changing the database table ? If no way I think setting the employee table as inactive is the best idea.

  7. 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)
            LOZDBUSER="dbuser"
            LOZDBPASS="dbpass"
            LOZDBNAME="dbname"
            # 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;"
            return_code=$?
            if [ $? -eq 0 ]; then
                    echo "[$script_name | info]: OK, the website of domain.com is now under maintenance mode" | tee -a $REPORT_FILE
            else
                    echo "[$script_name | info]: Warning, unable to put website of domain.com in maintenance mode" | tee -a $REPORT_FILE
            fi

    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 ?

  8. 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):

    bad-idea.png.371acfc852b8aa7075a4c7a6fde6ee35.png

    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

  9. 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 ?

     

     

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

     

     

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

×
×
  • Create New...

Important Information

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