update
This commit is contained in:
@@ -925,9 +925,10 @@ class Products
|
||||
$order_name = $_POST['order'][0]['name'] ? $_POST['order'][0]['name'] : 'clicks';
|
||||
$search = trim( (string) \S::get( 'search_text' ) );
|
||||
$filter_cl4 = trim( (string) \S::get( 'filter_cl4' ) );
|
||||
$filter_cl1 = trim( (string) \S::get( 'filter_cl1' ) );
|
||||
|
||||
// ➊ MIN/MAX ROAS dla kontekstu klienta (opcjonalnie z filtrem search)
|
||||
$bounds = \factory\Products::get_roas_bounds( (int) $client_id, $search, $campaign_id, $ad_group_id, $filter_cl4 );
|
||||
$bounds = \factory\Products::get_roas_bounds( (int) $client_id, $search, $campaign_id, $ad_group_id, $filter_cl4, $filter_cl1 );
|
||||
$roas_min = (float)$bounds['min'];
|
||||
$roas_max = (float)$bounds['max'];
|
||||
// zabezpieczenie przed dzieleniem przez 0
|
||||
@@ -962,8 +963,8 @@ class Products
|
||||
</div>';
|
||||
};
|
||||
|
||||
$db_results = \factory\Products::get_products( $client_id, $search, $limit, $start, $order_name, $order_dir, $campaign_id, $ad_group_id, $filter_cl4 );
|
||||
$recordsTotal = \factory\Products::get_records_total_products( $client_id, $search, $campaign_id, $ad_group_id, $filter_cl4 );
|
||||
$db_results = \factory\Products::get_products( $client_id, $search, $limit, $start, $order_name, $order_dir, $campaign_id, $ad_group_id, $filter_cl4, $filter_cl1 );
|
||||
$recordsTotal = \factory\Products::get_records_total_products( $client_id, $search, $campaign_id, $ad_group_id, $filter_cl4, $filter_cl1 );
|
||||
|
||||
// Sredni CR konta — do obliczenia progu klikniec
|
||||
$account_cr = \factory\Products::get_account_conversion_rate( (int) $client_id );
|
||||
@@ -978,6 +979,7 @@ class Products
|
||||
{
|
||||
$custom_class = '';
|
||||
$custom_label_4 = \factory\Products::get_product_data( $row['product_id'], 'custom_label_4' );
|
||||
$custom_label_1 = \factory\Products::get_product_data( $row['product_id'], 'custom_label_1' );
|
||||
$custom_name = \factory\Products::get_product_data( $row['product_id'], 'title' );
|
||||
$product_url = trim( (string) \factory\Products::get_product_data( $row['product_id'], 'product_url' ) );
|
||||
|
||||
@@ -1004,6 +1006,20 @@ class Products
|
||||
else if ( $custom_label_4 == 'paused' )
|
||||
$custom_label_4_color = 'background-color:rgb(143, 143, 143); color: #FFF;';
|
||||
|
||||
$custom_label_1_color = '';
|
||||
if ( $custom_label_1 == 'bestseller' )
|
||||
$custom_label_1_color = 'background-color:rgb(96, 119, 102); color: #FFF;';
|
||||
else if ( $custom_label_1 == 'deleted' )
|
||||
$custom_label_1_color = 'background-color:rgb(255, 0, 0); color: #FFF;';
|
||||
else if ( $custom_label_1 == 'zombie' )
|
||||
$custom_label_1_color = 'background-color:rgb(58, 58, 58); color: #FFF;';
|
||||
else if ( $custom_label_1 == 'pla_single' )
|
||||
$custom_label_1_color = 'background-color:rgb(49, 184, 9); color: #FFF;';
|
||||
else if ( $custom_label_1 == 'pla' )
|
||||
$custom_label_1_color = 'background-color:rgb(74, 63, 136); color: #FFF;';
|
||||
else if ( $custom_label_1 == 'paused' )
|
||||
$custom_label_1_color = 'background-color:rgb(143, 143, 143); color: #FFF;';
|
||||
|
||||
// ➌ ROAS – liczba + pasek performance
|
||||
$roasValue = (float)$row['roas'];
|
||||
$roasDisplay = (int) round( $roasValue, 0 );
|
||||
@@ -1096,7 +1112,7 @@ class Products
|
||||
\S::number_display( $row['conversions_value'] ),
|
||||
$roasCellHtml,
|
||||
'<input type="text" class="form-control min_roas" product_id="' . $row['product_id'] . '" value="' . $row['min_roas'] . '" style="width: 100px;">',
|
||||
htmlspecialchars( (string) ( $row['custom_label_3'] ?? '' ) ),
|
||||
'<input type="text" class="form-control custom_label_1" product_id="' . $row['product_id'] . '" value="' . $custom_label_1 . '" style="' . $custom_label_1_color . '">',
|
||||
'<input type="text" class="form-control custom_label_4" product_id="' . $row['product_id'] . '" value="' . $custom_label_4 . '" style="' . $custom_label_4_color . '">',
|
||||
'<div class="btn-group btn-group-sm products-row-actions" role="group">'
|
||||
. '<button type="button" class="btn btn-primary assign-product-scope" product_id="' . $row['product_id'] . '" title="Dodaj produkt do kampanii/grupy"><i class="fa-solid fa-diagram-project"></i></button>'
|
||||
@@ -1172,6 +1188,29 @@ class Products
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function get_distinct_cl1()
|
||||
{
|
||||
$client_id = (int) \S::get( 'client_id' );
|
||||
$values = \factory\Products::get_distinct_custom_label_1( $client_id );
|
||||
echo json_encode( [ 'status' => 'ok', 'values' => $values ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function save_custom_label_1()
|
||||
{
|
||||
$product_id = \S::get( 'product_id' );
|
||||
$custom_label_1 = \S::get( 'custom_label_1' );
|
||||
|
||||
if ( \factory\Products::set_product_data( $product_id, 'custom_label_1', $custom_label_1 ) )
|
||||
{
|
||||
\factory\Products::add_product_comment( $product_id, 'Zmiana etykiety 1 na: ' . $custom_label_1 );
|
||||
echo json_encode( [ 'status' => 'ok' ] );
|
||||
}
|
||||
else
|
||||
echo json_encode( [ 'status' => 'error' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function product_history()
|
||||
{
|
||||
$client_id = \S::get( 'client_id' );
|
||||
|
||||
Reference in New Issue
Block a user