Refactor ShopCategory class and grid.js to improve nested field handling and code readability

This commit is contained in:
2024-11-02 00:20:16 +01:00
parent 83400eda0f
commit 27801d7ce0
2 changed files with 17 additions and 7 deletions

View File

@@ -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,