update
This commit is contained in:
@@ -132,6 +132,23 @@ class Cron
|
||||
$products_temp_rows_total += (int) self::rebuild_products_temp_for_client( (int) $client['id'] );
|
||||
}
|
||||
|
||||
$xml_feed_report = null;
|
||||
if ( !empty( $client['xml_feed_url'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$xml_feed_report = \services\XmlFeedImporter::import_for_client( (int) $client['id'] );
|
||||
if ( !empty( $xml_feed_report['errors'] ) )
|
||||
{
|
||||
$products_errors = array_merge( $products_errors, (array) $xml_feed_report['errors'] );
|
||||
}
|
||||
}
|
||||
catch ( \Throwable $e )
|
||||
{
|
||||
$products_errors[] = 'XML feed import: ' . $e -> getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$errors = array_merge( $campaign_errors, $products_errors );
|
||||
|
||||
self::output_cron_response( [
|
||||
@@ -152,6 +169,7 @@ class Cron
|
||||
'products_fetch_skipped_reasons' => array_keys( $products_fetch_skipped_reasons ),
|
||||
'history_30_products' => $history_30_products_total,
|
||||
'products_temp_rows' => $products_temp_rows_total,
|
||||
'xml_feed' => $xml_feed_report,
|
||||
'errors' => $errors
|
||||
] );
|
||||
}
|
||||
@@ -934,7 +952,7 @@ class Cron
|
||||
}
|
||||
|
||||
$not_found_rows = $mdb -> query(
|
||||
"SELECT id AS product_id, offer_id, name, title
|
||||
"SELECT id AS product_id, offer_id, title, title_gmc
|
||||
FROM products
|
||||
WHERE client_id = :client_id
|
||||
AND TRIM( COALESCE( offer_id, '' ) ) <> ''
|
||||
@@ -950,10 +968,10 @@ class Cron
|
||||
{
|
||||
$offer_id = trim( (string) ( $row['offer_id'] ?? '' ) );
|
||||
$product_id = (int) ( $row['product_id'] ?? 0 );
|
||||
$product_name = trim( (string) ( $row['title'] ?? '' ) );
|
||||
$product_name = trim( (string) ( $row['title_gmc'] ?? '' ) );
|
||||
if ( $product_name === '' )
|
||||
{
|
||||
$product_name = trim( (string) ( $row['name'] ?? '' ) );
|
||||
$product_name = trim( (string) ( $row['title'] ?? '' ) );
|
||||
}
|
||||
if ( $product_name === '' )
|
||||
{
|
||||
@@ -1109,7 +1127,7 @@ class Cron
|
||||
}
|
||||
|
||||
$existing_products_rows = $mdb -> query(
|
||||
'SELECT id, offer_id, name, title, product_url
|
||||
'SELECT id, offer_id, title, title_gmc, product_url
|
||||
FROM products
|
||||
WHERE client_id = :client_id
|
||||
ORDER BY id ASC',
|
||||
@@ -1127,8 +1145,8 @@ class Cron
|
||||
|
||||
$products_by_offer_id[ $offer_id ] = [
|
||||
'id' => (int) ( $row['id'] ?? 0 ),
|
||||
'name' => (string) ( $row['name'] ?? '' ),
|
||||
'title' => (string) ( $row['title'] ?? '' ),
|
||||
'title_gmc' => (string) ( $row['title_gmc'] ?? '' ),
|
||||
'product_url' => (string) ( $row['product_url'] ?? '' )
|
||||
];
|
||||
}
|
||||
@@ -1366,14 +1384,14 @@ class Cron
|
||||
$mdb -> insert( 'products', [
|
||||
'client_id' => $client_id,
|
||||
'offer_id' => $offer_external_id,
|
||||
'name' => $product_title
|
||||
'title' => $product_title
|
||||
] );
|
||||
|
||||
$product_id = $mdb -> id();
|
||||
|
||||
$products_by_offer_id[ $offer_external_id ] = [
|
||||
'id' => (int) $product_id,
|
||||
'name' => $product_title,
|
||||
'title' => $product_title,
|
||||
'product_url' => ''
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user