- Created XmlFiles control class for handling XML file views and regeneration. - Implemented method to retrieve clients with XML feeds in the factory class. - Added database migration to include google_merchant_account_id in clients table. - Created migrations for products_keyword_planner_terms and products_merchant_sync_log tables. - Added campaign_keywords table migration for managing campaign keyword data. - Developed main view template for displaying XML files and their statuses. - Introduced a debug script for analyzing product URLs and their statuses.
39 lines
818 B
PHP
39 lines
818 B
PHP
<?php
|
|
namespace controls;
|
|
|
|
class XmlFiles
|
|
{
|
|
static public function main_view()
|
|
{
|
|
return \Tpl::view( 'xml_files/main_view', [
|
|
'rows' => \factory\XmlFiles::get_clients_with_xml_feed()
|
|
] );
|
|
}
|
|
|
|
static public function regenerate()
|
|
{
|
|
$client_id = (int) \S::get( 'client_id' );
|
|
|
|
if ( $client_id <= 0 )
|
|
{
|
|
\S::alert( 'Nie podano ID klienta.' );
|
|
header( 'Location: /xml_files' );
|
|
exit;
|
|
}
|
|
|
|
$result = \controls\Cron::generate_custom_feed_for_client( $client_id, true );
|
|
|
|
if ( ( $result['status'] ?? '' ) === 'ok' )
|
|
{
|
|
\S::alert( 'Plik XML zostal wygenerowany: ' . ( $result['url'] ?? '' ) );
|
|
}
|
|
else
|
|
{
|
|
\S::alert( $result['message'] ?? 'Nie udalo sie wygenerowac pliku XML.' );
|
|
}
|
|
|
|
header( 'Location: /xml_files' );
|
|
exit;
|
|
}
|
|
}
|