diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 540a36a..46b4757 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -167,9 +167,9 @@ }, "product_history.php": { "type": "-", - "size": 10080, - "lmtime": 1755699713875, - "modified": true + "size": 10103, + "lmtime": 1764629661097, + "modified": false } }, "site": { diff --git a/autoload/controls/class.Products.php b/autoload/controls/class.Products.php index 2e5fc6a..3ca467e 100644 --- a/autoload/controls/class.Products.php +++ b/autoload/controls/class.Products.php @@ -176,7 +176,8 @@ class Products $roasCellHtml, '', '', - '' + '', + 'Usuń' ]; } @@ -184,6 +185,16 @@ class Products exit; } + static public function delete_product() { + $product_id = \S::get( 'product_id' ); + + if ( \factory\Products::delete_product( $product_id ) ) + echo json_encode( [ 'status' => 'ok' ] ); + else + echo json_encode( [ 'status' => 'error' ] ); + exit; + } + static public function save_min_roas() { $product_id = \S::get( 'product_id' ); diff --git a/autoload/factory/class.Products.php b/autoload/factory/class.Products.php index 79ed6b8..267ecaa 100644 --- a/autoload/factory/class.Products.php +++ b/autoload/factory/class.Products.php @@ -2,6 +2,12 @@ namespace factory; class Products { + static public function delete_product( $product_id ) { + global $mdb; + $mdb -> delete( 'products', [ 'id' => $product_id ] ); + return true; + } + static public function get_product_comments( $product_id ) { global $mdb; diff --git a/templates/products/main_view.php b/templates/products/main_view.php index 6404017..3a14a5c 100644 --- a/templates/products/main_view.php +++ b/templates/products/main_view.php @@ -46,6 +46,7 @@