This commit is contained in:
2024-11-16 10:57:09 +01:00
parent 144df6abf5
commit f419f693e4
15 changed files with 78 additions and 50 deletions

View File

@@ -829,11 +829,14 @@ if ( $baselinker_settings['enabled'] and $baselinker_settings['sync_orders'] an
$results = $mdb -> select( 'pp_shop_products', [ 'id', 'price_brutto', 'price_brutto_promo' ], [ 'OR' => [ 'price_history_date[!]' => date( 'Y-m-d' ), 'price_history_date' => null ], 'ORDER' => [ 'price_history_date' => 'ASC' ], 'LIMIT' => 100 ] );
foreach ( $results as $row )
{
$mdb -> insert( 'pp_shop_product_price_history', [
'id_product' => $row['id'],
'price' => $row['price_brutto_promo'] > 0 ? $row['price_brutto_promo'] : $row['price_brutto'],
'date' => date( 'Y-m-d' )
] );
if ( $price )
{
$mdb -> insert( 'pp_shop_product_price_history', [
'id_product' => $row['id'],
'price' => $row['price_brutto_promo'] > 0 ? $row['price_brutto_promo'] : $row['price_brutto'],
'date' => date( 'Y-m-d' )
] );
}
$mdb -> update( 'pp_shop_products', [ 'price_history_date' => date( 'Y-m-d' ) ], [ 'id' => $row['id'] ] );