Recent Updates Toggle Comment Threads | 快速鍵

  • starway 1:40 pm on August 4, 2018 固定鏈結 | 回應
    Tags:   

    WooCommerce 購物網站的免運費機制 

    自動偵測免費運送的設定方法
    打開主題中的 functions.php
    將下方的程式片段碼貼入後存檔

    更新 for WC 2.6+

    /**

    • Hide shipping rates when free shipping is available.
    • Updated to support WooCommerce 2.6 Shipping Zones.
    • @param array $rates Array of rates found for the package.
    • @return array

    */
    add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available’, 100 );
    function hide_shipping_when_free_is_available( $rates ) {
    $free = array();

    foreach ( $rates as $rate_id => $rate ) {
    if ( ‘free_shipping’ === $rate->method_id ) {
    $free[ $rate_id ] = $rate;
    break;
    }
    }

    return ! empty( $free ) ? $free : $rates;
    }

    更新 for WC 2.5

    /**

    • woocommerce_package_rates is a 2.1+ hook

    */
    add_filter( ‘woocommerce_package_rates’, ‘hide_shipping_when_free_is_available’, 10, 2 );

    /**

    • Hide shipping rates when free shipping is available
    • @param array $rates Array of rates found for the package
    • @param array $package The package array/object being shipped
    • @return array of modified rates

    */
    function hide_shipping_when_free_is_available( $rates, $package ) {

    // Only modify rates if free_shipping is present
    if ( isset( $rates[‘free_shipping’] ) ) {

    // To unset a single rate/method, do the following. This example unsets flat_rate shipping
    unset( $rates[‘flat_rate’] );

    // To unset all methods except for free_shipping, do the following
    $free_shipping = $rates[‘free_shipping’];
    $rates = array();
    $rates[‘free_shipping’] = $free_shipping;
    }

    return $rates;
    }

    最後還要在 WooCommerce 的後台,設定免運費的金額限制

    參考:
    https://cloudwp.pro/blog/woocommerce-%E8%B3%BC%E7%89%A9%E7%B6%B2%E7%AB%99%E7%9A%84%E5%85%8D%E9%81%8B%E8%B2%BB%E6%A9%9F%E5%88%B6%E5%BB%BA%E8%AD%B0/

    廣告
     
  • starway 3:12 pm on July 4, 2018 固定鏈結 | 回應
    Tags: css   

    Prevent Address-Bar hiding in mobile Browsers 

    html
    {
    overflow: hidden;
    width:100%;
    body
    {
    width:100%;
    height:100%;
    position:fixed; /* prevent overscroll bounce*/
    overflow-y:scroll;
    -webkit-overflow-scrolling: touch; /* iOS velocity scrolling */
    }
    }

     
  • starway 7:39 am on April 17, 2018 固定鏈結 | 回應
    Tags:   

    使用一個腳本監控mysql進程

    進入 cd /backup
    如果沒mysql資料夾
    建立 mysql資料夾
    mkdir mysql
    然後
    nano /backup/mysql/mysql.sh

    #!/bin/sh
    ps -fe|grep mysqld |grep -v grep
    if [ $? -ne 0 ]
    then
    echo “start process….."
    service mysql start
    else
    echo “runing….."
    fi

    DATE=`date +%Y%m%d%H%M%S`
    echo $DATE >> /backup/mysql/test.txt

    存檔

    nano /etc/crontab

    */1 * * * * root /backup/mysql/mysql.sh

    存檔

    crontab /etc/crontab

    然後更改檔案權限(這是 permission denied 解決方案)
    chmod 777 /backup/mysql
    chmod 777 /backup/mysql/mysql.sh

    備註:
    假如是 mariadb
    service mysql start 請修改成 systemctl restart mariadb

    參考文件 https://java-er.com/blog/mysql-restart/

     
  • starway 11:51 am on November 13, 2017 固定鏈結 | 回應  

    經緯度距離相關網站

    http://www.bijishequ.com/detail/256788?p=
    http://www.cnblogs.com/mgbert/p/4146538.html
    http://blog.csdn.net/liuxiaoshuang002/article/details/71122153
    https://www.wizzer.cn/archives/2254
    http://smallpoint-program.blogspot.tw/2014/12/php.html

     
  • starway 9:54 pm on September 22, 2017 固定鏈結 | 回應
    Tags:   

    roundcube 連線到 imap 伺服器失敗 

    nano /etc/dovecot/dovecot.conf

    Add the following:
    namespace inbox {
    inbox = yes
    }

     
  • starway 7:24 am on July 30, 2017 固定鏈結 | 回應  

    Secure PhpMyAdmin 

    https://forum.vestacp.com/viewtopic.php?t=5271

     
  • starway 7:47 am on July 28, 2017 固定鏈結 | 回應
    Tags:   

    how to remove csf firewall 

    cd /etc/csf
    sh uninstall.sh

     
  • starway 7:05 pm on July 3, 2017 固定鏈結 | 回應
    Tags:   

    log size 大小 

    cd /etc/logrotate.d

    nano nginx

    增加SIZE

    size 10M

     
  • starway 2:39 pm on July 3, 2017 固定鏈結 | 回應
    Tags:   

    [HOWTO] Recompile NGINX with OpenSSL 1.0.2+ for HTTP/2 via ALPN on Debian 8 Topic is solved 

    特別注意:

    每個版本 nginx 搭配 openssl
    會有成功與失敗 不同的結果
    要注意

    ===========================================================

    參考文件:

    http://hg.nginx.org/njs/archive/njs-63d7430291f2.zip

    ===========================================================

    nginx -V

    yum install gc gcc gcc-c++ pcre-devel zlib-devel make wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel gperftools gperftools-devel libatomic_ops-devel perl-ExtUtils-Embed -y

    cd /usr/local/src/

    wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz

    tar zxf openssl-1.1.0e.tar.gz

    wget https://nginx.org/download/nginx-1.12.0.tar.gz

    tar zxf nginx-1.12.0.tar.gz

    cd nginx-1.12.0

    service nginx stop

    ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –modules-path=/usr/lib64/nginx/modules –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-compat –with-file-aio –with-threads –with-http_addition_module –with-http_auth_request_module –with-http_dav_module –with-http_flv_module –with-http_gunzip_module –with-http_gzip_static_module –with-http_mp4_module –with-http_random_index_module –with-http_realip_module –with-http_secure_link_module –with-http_slice_module –with-http_ssl_module –with-http_stub_status_module –with-http_sub_module –with-http_v2_module –with-mail –with-mail_ssl_module –with-stream –with-stream_realip_module –with-stream_ssl_module –with-stream_ssl_preread_module –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC’ –with-ld-opt=’-Wl,-z,relro -Wl,-z,now -pie’ –with-openssl=/usr/local/src/openssl-1.1.0e

    make & make install

    service nginx restart

    nginx -V

    ==============================================================
    最後修改樣板

    cd /usr/local/vesta/data/templates/web/nginx/

    nano force-https.stpl

    server {
    listen %ip%:%proxy_ssl_port%;
    改成
    server {
    listen %ip%:%proxy_ssl_port% http2;

    參考文件:
    https://forum.vestacp.com/viewtopic.php?f=11&t=13150&p=55968&hilit=http2#p55968

     
  • starway 11:03 am on July 3, 2017 固定鏈結 | 回應
    Tags:   

    vestacp 

    文件 https://vestacp.com/docs/
    樣板路徑 /usr/local/vesta/data/templates/web/nginx/

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
回應
e
編輯
o
Show/Hide comments
t
至頂
l
Go to login
h
Show/Hide help
shift + esc
取消