update
This commit is contained in:
@@ -163,12 +163,13 @@ class SupplementalFeed
|
||||
$labels_updated = self::refresh_bestseller_labels_for_client( $client_id );
|
||||
|
||||
$products = $mdb -> query(
|
||||
"SELECT p.offer_id, p.title_gmc AS title, p.description_gmc AS description, p.google_product_category, p.custom_label_1, p.custom_label_3, p.custom_label_4
|
||||
"SELECT p.offer_id, p.title_gmc AS title, p.description_gmc AS description, p.google_product_category, p.custom_label_1, p.custom_label_3, p.custom_label_4,
|
||||
p.unit_pricing_measure, p.unit_pricing_base_measure
|
||||
FROM products p
|
||||
WHERE p.client_id = :client_id
|
||||
AND p.offer_id IS NOT NULL
|
||||
AND p.offer_id <> ''
|
||||
AND ( p.title_gmc IS NOT NULL OR p.description_gmc 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 )",
|
||||
AND ( p.title_gmc IS NOT NULL OR p.description_gmc 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 OR p.unit_pricing_measure IS NOT NULL OR p.unit_pricing_base_measure IS NOT NULL )",
|
||||
[ ':client_id' => $client_id ]
|
||||
) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
|
||||
@@ -187,7 +188,7 @@ class SupplementalFeed
|
||||
throw new \RuntimeException( 'Nie mozna otworzyc pliku: ' . $file_path );
|
||||
}
|
||||
|
||||
fwrite( $fp, "id\ttitle\tdescription\tgoogle_product_category\tcustom_label_1\tcustom_label_3\tcustom_label_4\n" );
|
||||
fwrite( $fp, "id\ttitle\tdescription\tgoogle_product_category\tcustom_label_1\tcustom_label_3\tcustom_label_4\tunit_pricing_measure\tunit_pricing_base_measure\n" );
|
||||
|
||||
$written = 0;
|
||||
foreach ( $products as $row )
|
||||
@@ -199,8 +200,16 @@ class SupplementalFeed
|
||||
$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'] ?? '' ) );
|
||||
$unit_pricing_measure = trim( (string) ( $row['unit_pricing_measure'] ?? '' ) );
|
||||
$unit_pricing_base_measure = trim( (string) ( $row['unit_pricing_base_measure'] ?? '' ) );
|
||||
|
||||
if ( $offer_id === '' || ( $title === '' && $description === '' && $category === '' && $custom_label_1 === '' && $custom_label_3 === '' && $custom_label_4 === '' ) )
|
||||
if ( $unit_pricing_measure === '' || $unit_pricing_base_measure === '' )
|
||||
{
|
||||
$unit_pricing_measure = '';
|
||||
$unit_pricing_base_measure = '';
|
||||
}
|
||||
|
||||
if ( $offer_id === '' || ( $title === '' && $description === '' && $category === '' && $custom_label_1 === '' && $custom_label_3 === '' && $custom_label_4 === '' && $unit_pricing_measure === '' && $unit_pricing_base_measure === '' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -212,7 +221,9 @@ class SupplementalFeed
|
||||
$category,
|
||||
$custom_label_1,
|
||||
$custom_label_3,
|
||||
$custom_label_4
|
||||
$custom_label_4,
|
||||
$unit_pricing_measure,
|
||||
$unit_pricing_base_measure
|
||||
] ) . "\n" );
|
||||
|
||||
$written++;
|
||||
|
||||
Reference in New Issue
Block a user