Refactor ShopCategory class and grid.js to improve nested field handling and code readability
This commit is contained in:
@@ -190,6 +190,7 @@ class ShopCategory
|
||||
foreach ( $title as $key => $val )
|
||||
{
|
||||
if ( $translation_id = $mdb -> get( 'pp_shop_categories_langs', 'id', [ 'AND' => [ 'category_id' => $category_id, 'lang_id' => $key ] ] ) )
|
||||
{
|
||||
$mdb -> update( 'pp_shop_categories_langs', [
|
||||
'lang_id' => $key,
|
||||
'title' => $title[$key] != '' ? $title[$key] : null,
|
||||
@@ -205,6 +206,7 @@ class ShopCategory
|
||||
], [
|
||||
'id' => $translation_id
|
||||
] );
|
||||
}
|
||||
else
|
||||
$mdb -> insert( 'pp_shop_categories_langs', [
|
||||
'category_id' => (int)$category_id,
|
||||
|
||||
Reference in New Issue
Block a user