get( 'pp_shop_coupon', '*', [ 'id' => $coupon_id ] ); } public static function coupon_delete( $coupon_id ) { global $mdb; return $mdb -> delete( 'pp_shop_coupon', [ 'id' => $coupon_id ] ); } public static function save( $coupon_id, $name, $status, $send, $used, $type, $amount, $one_time, $include_discounted_product, $categories ) { global $mdb; if ( !$coupon_id ) { if ( $mdb -> insert( 'pp_shop_coupon', [ 'name' => $name, 'status' => $status, 'used' => $used, 'type' => $type, 'amount' => $amount, 'one_time' => $one_time, 'send' => $send, 'include_discounted_product' => $include_discounted_product, 'categories' => $categories ] ) ) return $mdb -> id(); } else { $mdb -> update( 'pp_shop_coupon', [ 'name' => $name, 'status' => $status, 'used' => $used, 'type' => $type, 'amount' => $amount, 'one_time' => $one_time, 'send' => $send, 'include_discounted_product' => $include_discounted_product, 'categories' => $categories ], [ 'id' => $coupon_id ] ); return true; } } }