Add minimum ROAS functionality to product management; implement saving and display in product listing

This commit is contained in:
2025-01-29 22:53:41 +01:00
parent bd0b5c58c0
commit 575d4aace0
4 changed files with 63 additions and 15 deletions

View File

@@ -58,7 +58,8 @@ class Products
\S::number_display( $row['cpc'] ),
round( $row['conversions'], 2 ),
\S::number_display( $row['conversions_value'] ),
$row['roas'],
$row['roas'] <= $row['min_roas'] ? '<span class="text-danger">' . $row['roas'] . '</span>' : $row['roas'],
'<input type="text" class="form-control min_roas" product_id="' . $row['product_id'] . '" value="' . $row['min_roas'] . '" style="width: 100px;">',
'',
'<input type="text" class="form-control custom_label_4" product_id="' . $row['product_id'] . '" value="' . $custom_label_4 . '">'
];
@@ -68,6 +69,20 @@ class Products
exit;
}
static public function save_min_roas()
{
$product_id = \S::get( 'product_id' );
$min_roas = \S::get( 'min_roas' );
if ( \factory\Products::save_min_roas( $product_id, $min_roas ) )
{
echo json_encode( [ 'status' => 'ok' ] );
}
else
echo json_encode( [ 'status' => 'error' ] );
exit;
}
static public function save_custom_label_4()
{
$product_id = \S::get( 'product_id' );