This commit is contained in:
2026-04-22 10:17:26 +02:00
parent 253a78e8c8
commit 21e3f4a41d
15 changed files with 993 additions and 22 deletions

View File

@@ -163,12 +163,12 @@ class SupplementalFeed
$labels_updated = self::refresh_bestseller_labels_for_client( $client_id );
$products = $mdb -> query(
"SELECT p.offer_id, p.title, p.description, p.google_product_category, p.custom_label_3, p.custom_label_4
"SELECT p.offer_id, p.title, p.description, p.google_product_category, p.custom_label_1, p.custom_label_3, p.custom_label_4
FROM products p
WHERE p.client_id = :client_id
AND p.offer_id IS NOT NULL
AND p.offer_id <> ''
AND ( p.title IS NOT NULL OR p.description IS NOT NULL OR p.google_product_category IS NOT NULL OR p.custom_label_3 IS NOT NULL OR p.custom_label_4 IS NOT NULL )",
AND ( p.title IS NOT NULL OR p.description IS NOT NULL OR p.google_product_category IS NOT NULL OR p.custom_label_1 IS NOT NULL OR p.custom_label_3 IS NOT NULL OR p.custom_label_4 IS NOT NULL )",
[ ':client_id' => $client_id ]
) -> fetchAll( \PDO::FETCH_ASSOC );
@@ -187,7 +187,7 @@ class SupplementalFeed
throw new \RuntimeException( 'Nie mozna otworzyc pliku: ' . $file_path );
}
fwrite( $fp, "id\ttitle\tdescription\tgoogle_product_category\tcustom_label_3\tcustom_label_4\n" );
fwrite( $fp, "id\ttitle\tdescription\tgoogle_product_category\tcustom_label_1\tcustom_label_3\tcustom_label_4\n" );
$written = 0;
foreach ( $products as $row )
@@ -196,10 +196,11 @@ class SupplementalFeed
$title = self::sanitize_for_tsv( $row['title'] ?? '' );
$description = self::sanitize_for_tsv( $row['description'] ?? '' );
$category = trim( (string) ( $row['google_product_category'] ?? '' ) );
$custom_label_1 = trim( (string) ( $row['custom_label_1'] ?? '' ) );
$custom_label_3 = trim( (string) ( $row['custom_label_3'] ?? '' ) );
$custom_label_4 = trim( (string) ( $row['custom_label_4'] ?? '' ) );
if ( $offer_id === '' || ( $title === '' && $description === '' && $category === '' && $custom_label_3 === '' && $custom_label_4 === '' ) )
if ( $offer_id === '' || ( $title === '' && $description === '' && $category === '' && $custom_label_1 === '' && $custom_label_3 === '' && $custom_label_4 === '' ) )
{
continue;
}
@@ -209,6 +210,7 @@ class SupplementalFeed
$title,
$description,
$category,
$custom_label_1,
$custom_label_3,
$custom_label_4
] ) . "\n" );