Instantly share code, notes, and snippets.

Embed
What would you like to do?
EC-CUBE の「商品管理>商品登録(商品規格)」の編集項目の表示順を変更するパッチです。登録済みの項目が先頭に来るようになります。
Index: data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php (リビジョン 23289)
+++ data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php (作業コピー)
@@ -512,6 +512,11 @@
}
}
+ // 登録済みの規格を先頭に並べる。
+ $del_flags = array_map(function ($class) { return (int)$class['del_flg']; }, $arrMergeProductsClass);
+ $indexes = array_keys($arrMergeProductsClass);
+ array_multisort($del_flags, SORT_NUMERIC, SORT_ASC, $indexes, SORT_NUMERIC, SORT_ASC, $arrMergeProductsClass);
+
// 登録済みのデータで上書き
$objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrMergeProductsClass));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment