feat: Update product name handling in API and Cron classes to improve data consistency

This commit is contained in:
2026-03-10 15:30:48 +01:00
parent 595bb574f0
commit ab1f682806
3 changed files with 4 additions and 24 deletions

View File

@@ -9,8 +9,8 @@
},
"api.php": {
"type": "-",
"size": 14061,
"lmtime": 1773062440871,
"size": 18156,
"lmtime": 1773088345243,
"modified": false
},
"autoload": {
@@ -302,8 +302,8 @@
"docs": {
"api-public-product-management.md": {
"type": "-",
"size": 9285,
"lmtime": 1773062594801,
"size": 12452,
"lmtime": 1773088360435,
"modified": false
},
"class-methods.md": {

View File

@@ -415,13 +415,6 @@ class Api
else
{
$offer_id = $mdb -> get( 'products', 'id', [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
$offer_current_name = $mdb -> get( 'products', 'name', [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
if ( $offer_current_name != $offer['ProductTitle'] and $data['date'] == date( 'Y-m-d', strtotime( '-1 days', time() ) ) )
{
$mdb -> update( 'products', [ 'name' => $offer['ProductTitle'] ], [ 'AND' => [ 'client_id' => $data['client_id'], 'offer_id' => $offer['OfferId'] ] ] );
}
}
if ( $offer_id )
@@ -539,12 +532,6 @@ class Api
else
{
$product_id = $mdb -> get( 'products', 'id', [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
$offer_current_name = $mdb -> get( 'products', 'name', [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
if ( $offer_current_name != $product_title and $date == date( 'Y-m-d', strtotime( '-1 days', time() ) ) )
{
$mdb -> update( 'products', [ 'name' => $product_title ], [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
}
}
if ( !$product_id )

View File

@@ -1379,13 +1379,6 @@ class Cron
else
{
$product_id = (int) ( $existing_product['id'] ?? 0 );
$offer_current_name = (string) ( $existing_product['name'] ?? '' );
if ( $offer_current_name != $product_title and $date == date( 'Y-m-d', strtotime( '-1 days' ) ) )
{
$mdb -> update( 'products', [ 'name' => $product_title ], [ 'AND' => [ 'client_id' => $client_id, 'offer_id' => $offer_external_id ] ] );
$products_by_offer_id[ $offer_external_id ]['name'] = $product_title;
}
}
if ( !$product_id )