コード例 #1
0
ファイル: product_options.php プロジェクト: heg-arc-ne/cscart
}
fn_define('KEEP_UPLOADED_FILES', true);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $suffix = '';
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        if ($mode == 'add_exceptions') {
            foreach ($_REQUEST['add_options_combination'] as $k => $v) {
                $_data = array('product_id' => $_REQUEST['product_id'], 'combination' => $v);
                fn_update_exception($_data);
            }
            fn_recalculate_exceptions($_REQUEST['product_id']);
            $suffix = ".exceptions?product_id={$_REQUEST['product_id']}";
        }
        if ($mode == 'm_delete_exceptions') {
            foreach ($_REQUEST['exception_ids'] as $id) {
                fn_delete_exception($id);
            }
            $suffix = ".exceptions?product_id={$_REQUEST['product_id']}";
        }
    }
    if ($mode == 'add_combinations') {
        if (is_array($_REQUEST['add_inventory'])) {
            foreach ($_REQUEST['add_inventory'] as $k => $v) {
                $_data = array('product_id' => $_REQUEST['product_id'], 'combination' => $_REQUEST['add_options_combination'][$k], 'amount' => isset($_REQUEST['add_inventory'][$k]['amount']) ? $_REQUEST['add_inventory'][$k]['amount'] : 0);
                $_data = fn_array_merge($v, $_data);
                fn_update_option_combination($_data);
            }
        }
        $suffix = ".inventory?product_id={$_REQUEST['product_id']}";
    }
    if ($mode == 'update_combinations') {
コード例 #2
0
ファイル: Exceptions.php プロジェクト: askzap/ultimate
 public function delete($id)
 {
     $data = array();
     $status = Response::STATUS_OK;
     $product_id = db_get_field('SELECT product_id FROM ?:product_options_exceptions WHERE exception_id = ?i', $id);
     list($_status, $message) = $this->checkProductId($product_id);
     if ($_status != Response::STATUS_OK) {
         return array('status' => $status, 'data' => array('message' => $message));
     }
     if (fn_delete_exception($id)) {
         $status = Response::STATUS_NO_CONTENT;
         $data = array();
     } else {
         $status = Response::STATUS_NOT_FOUND;
     }
     return array('status' => $status, 'data' => $data);
 }