都道府県 / 州 / 郡 woocommerce

翻訳ファイルの修正

WooCommerceの日本語ファイル
/wp-content/languages/plugins/woocommerce-ja.mo

woocommerce-ja.po が編集用のファイルなので、このファイルをダウンロード

翻訳ファイルの編集ソフト「Poedit」 をインストール
書き換え後に ファイル MOにコンパイル → woocommerce-ja.mo をアップして上書き

laravel8 クエリービルダー サブクエリ 複数条件 算術演算 groupBy複数 orderBy DESC混在 生のSQL chank


    サブクエリ
    変数はたいていグローバル化しないと渡せない

    $ranks_tags = DB::table('ranks_tags')->where('label',$this->range_w);

        DB::table('post_tags as p')->select(
            DB::raw(   //この中の''は1セット。最初と最後のみで全体を囲む
            'p.fave_id , p.tag_id, f.name , f.cnt_cheer , s.before_cnt_cheer
            , f.cnt_cheer - s.before_cnt_cheer AS incre_cheer 
            , f.cnt_post, s.before_cnt_post
            , f.cnt_post - s.before_cnt_post AS incre_post
            , cnt_share
            , s.id as ranktag_id'
            )
        )
        ->LeftJoin( 'tags as t' , 'p.tag_id' ,'t.id')
        ->LeftJoin( 'faves as f', 'p.fave_id','f.id')
        ->LeftJoinSub($ranks_tags, 's', function ($join) {
            $join->on('s.tag_id' , 'p.tag_id' );
            $join->on('p.fave_id' , 's.fave_id');
        })
        ->groupBy('p.tag_id' , 'p.fave_id' , 'incre_cheer' , 'ranktag_id' )
        ->orderBy('p.tag_id' ,'asc')
        ->orderBy('incre_cheer' ,'DESC')
        ->orderBy('cnt_post' ,'DESC')
        ->limit(999999)
        // ->toSql(); ←素のSQL文を書き出せる
        ->chunk( $this->max_lows, function ($tag_fave) {
            foreach ($tag_fave as $key => $row) {
                // DB::table('tags')
                //     ->where('id', $tags->id)
                //     ->update(['created_at' => $this->ranges['day']]);
                var_dump($key, $row );
							
			}
            return false; //← これで終わる
		});

wsl2 Apache バーチャルホスト設定

Windowsのhosts ファイルに追加

 
  172.25.29.190       sample.org

※↑ipアドレスはUbuntu起動時のもの、127。0。0.1 ではないことに注意



<VirtualHost *:80>
    ServerAdmin webmaster@sample.org
    ServerName sample.org
    ServerAlias sample.org
    DocumentRoot /var/www/web/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
   <Directory /var/www/web/public>
        AllowOverride All
        Options All
        Require all granted
    </Directory>
</VirtualHost>


lalavel8 サブクエリー (クエリビルダー)


 $sql = "SELECT ←普通のSQL文
 FROM
 WHERE " ; 
 

 DB::table('app_user_user AS uu')
        ->select( ~ ~ 

    ) ->leftJoin( DB::raw("( $sql  ) AS sc ") , 'uu.id', '=', 'sc.user_id')


	$juhuku = DB::table('issuers')
		->orWhere(function($query) {
			$query->where('tel', $this->tel[$this->j])
			->where('user_id', '!=', $this->user_id);
		})
		->orWhere(function($query) {
		$query->where('email', $this->email[$this->j])
		->where('user_id', '!=', $this->user_id);
	})->exists() ;



select exists( select * from `issuers` where ( `tel` = '230-0234-5432' and `user_id` != 4604 ) or ( `email` = 'izumo@reqw.wer' and `user_id` != 4604) ) as `exists`

localStorage 配列の保存方法

そのまま保存するとデータ構造が書き換えられて配列がcsv形式になってしまう。


localStorage.setItem('stockoutData', JSON.stringify(stockoutData)); //保存

let stockoutData = localStorage.getItem('stockoutData'); //取得
     let stockouts = JSON.parse(stockoutData);  //変換