Beispiel #1
0
<?php

if (isset($_SESSION['order_id'])) {
    $order_id = $_SESSION['order_id'];
    unset($_SESSION['order_id']);
    db_query('DELETE FROM orders WHERE id = ' . $order_id);
    $ids = db_query_to_list('SELECT id FROM campaign_orders WHERE order_id = ' . $order_id, 'id');
    $ids_str = '';
    if ($ids) {
        $ids_str = implode(',', $ids);
    }
    db_query('DELETE FROM campaign_orders WHERE order_id = ' . $order_id);
    if ($ids_str) {
        db_query('DELETE FROM campaign_orders_items WHERE parent_id IN (' . $ids_str . ')');
    }
    db_query('DELETE FROM additional_orders_items WHERE order_id = ' . $order_id);
}
header('location: /');
exit;
Beispiel #2
0
/**
 * Gets all possible product features
 *
 * @param boolean $list if we want a list with PRODUCT_FEATURE_ID-s only
 * @return array list with product features
 */
function product_feature_all($list = false)
{
    $query = "SELECT PRODUCT_FEATURE_ID, PRODUCT_FEATURE_TYPE_ID, DESCRIPTION\n\t\t\t  FROM product_feature\n\t\t\t  ORDER BY PRODUCT_FEATURE_ID ASC";
    if ($list) {
        return db_query_to_list($query, 'PRODUCT_FEATURE_ID');
    }
    return db_query_to_array($query);
}
Beispiel #3
0
/**
 * getting user last additional order details
 * @param int $user_id
 * @param int $type
 * @return array $additional_orders or false
 */
function get_last_additional_banner_order($user_id, $type)
{
    $query = 'SELECT o.id FROM `orders` as o INNER JOIN additional_orders_items as a ON a.order_id=o.id WHERE o.user_id = ' . $user_id . ' AND a.type = ' . $type . ' ORDER BY o.id DESC LIMIT 1';
    $order = db_query_to_list($query, 'id');
    if ($order) {
        $additional_orders = get_additional_orders_by_type($order[0], $type);
        if ($additional_orders) {
            return $additional_orders;
        }
    }
    return false;
}
Beispiel #4
0
}
$store = db_query_to_row("SELECT * FROM `stores` WHERE id = {$id}");
if (!$store) {
    die('store not found');
}
import('store');
if (isset($_POST['shop_name'])) {
    $update = array();
    if (!store_validate($update)) {
        $error_msg = 'All fields must be filled';
    } else {
        $hanging_methods = $update['hanging_methods'];
        unset($update['hanging_methods']);
        if (update_in_db('stores', $update, '`id`=' . $id)) {
            delete_from_db('stores_hanging_methods', '`store_id`=' . $id);
            $store_hanging_methods = array();
            foreach ($hanging_methods as $value) {
                $store_hanging_methods[] = array('store_id' => $id, 'hanging_method_id' => $value);
            }
            insert_multi_to_db('stores_hanging_methods', $store_hanging_methods);
            $_SESSION['edit_store_msg'] = 'Store Successfully Updated';
            header('location: /store/edit/' . $id);
            die;
        }
    }
}
$hanging_methods = get_hanging_methods();
$store_hanging_methods = db_query_to_list('SELECT `hanging_method_id` FROM `stores_hanging_methods` WHERE `store_id`=' . $id, 'hanging_method_id');
$template = set_template('store', 'edit');
$link = THEME . 'template2.php';
require_once $link;