Пример #1
0
        case 'notify_remove':
            if (isset($_SESSION['customer_id']) && isset($_GET['products_id'])) {
                $Qcheck = $OSCOM_Db->get('products_notifications', 'products_id', ['customers_id' => $_SESSION['customer_id'], 'products_id' => $_GET['products_id']]);
                if ($Qcheck->fetch() !== false) {
                    $OSCOM_Db->delete('products_notifications', ['customers_id' => $_SESSION['customer_id'], 'products_id' => $_GET['products_id']]);
                    $messageStack->add_session('product_action', sprintf(PRODUCT_UNSUBSCRIBED, tep_get_products_name((int) $_GET['products_id'])), 'warning');
                }
                OSCOM::redirect($PHP_SELF, tep_get_all_get_params(array('action')));
            } else {
                $_SESSION['navigation']->set_snapshot();
                OSCOM::redirect('login.php', '', 'SSL');
            }
            break;
        case 'cust_order':
            if (isset($_SESSION['customer_id']) && isset($_GET['pid'])) {
                if (tep_has_product_attributes($_GET['pid'])) {
                    OSCOM::redirect('product_info.php', 'products_id=' . $_GET['pid']);
                } else {
                    $_SESSION['cart']->add_cart($_GET['pid'], $_SESSION['cart']->get_quantity($_GET['pid']) + 1);
                }
            }
            OSCOM::redirect($goto, tep_get_all_get_params($parameters));
            break;
    }
}
// include the who's online functions
require 'includes/functions/whos_online.php';
tep_update_whos_online();
// include the password crypto functions
require 'includes/functions/password_funcs.php';
// include validation functions (right now only email address)
        case 'notify_remove':
            if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
                $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                $check = tep_db_fetch_array($check_query);
                if ($check['count'] > 0) {
                    tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                }
                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
            } else {
                $navigation->set_snapshot();
                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
            }
            break;
        case 'cust_order':
            if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                    tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                } else {
                    $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid']) + 1);
                }
            }
            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
            break;
    }
}
// include the who's online functions
require DIR_WS_FUNCTIONS . 'whos_online.php';
tep_update_whos_online();
// include the password crypto functions
require DIR_WS_FUNCTIONS . 'password_funcs.php';
// include validation functions (right now only email address)
Пример #3
0
 function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)
 {
     $OSCOM_Db = Registry::get('Db');
     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);
     if (defined('MAX_QTY_IN_CART') && MAX_QTY_IN_CART > 0 && (int) $qty > MAX_QTY_IN_CART) {
         $qty = MAX_QTY_IN_CART;
     }
     $attributes_pass_check = true;
     if (is_array($attributes) && !empty($attributes)) {
         foreach ($attributes as $option => $value) {
             if (!is_numeric($option) || !is_numeric($value)) {
                 $attributes_pass_check = false;
                 break;
             } else {
                 $Qcheck = $OSCOM_Db->prepare('select products_attributes_id from :table_products_attributes where products_id = :products_id and options_id = :options_id and options_values_id = :options_values_id limit 1');
                 $Qcheck->bindInt(':products_id', $products_id);
                 $Qcheck->bindInt(':options_id', $option);
                 $Qcheck->bindInt(':options_values_id', $value);
                 $Qcheck->execute();
                 if ($Qcheck->fetch() === false) {
                     $attributes_pass_check = false;
                     break;
                 }
             }
         }
     } elseif (tep_has_product_attributes($products_id)) {
         $attributes_pass_check = false;
     }
     if (is_numeric($products_id) && is_numeric($qty) && $attributes_pass_check == true) {
         $Qcheck = $OSCOM_Db->prepare('select products_id from :table_products where products_id = :products_id and products_status = 1');
         $Qcheck->bindInt(':products_id', $products_id);
         $Qcheck->execute();
         if ($Qcheck->fetch() !== false) {
             if ($notify == true) {
                 $_SESSION['new_products_id_in_cart'] = $products_id;
             }
             if ($this->in_cart($products_id_string)) {
                 $this->update_quantity($products_id_string, $qty, $attributes);
             } else {
                 $this->contents[$products_id_string] = array('qty' => (int) $qty);
                 // insert into database
                 if (isset($_SESSION['customer_id'])) {
                     $OSCOM_Db->save('customers_basket', ['customers_id' => $_SESSION['customer_id'], 'products_id' => $products_id_string, 'customers_basket_quantity' => $qty, 'customers_basket_date_added' => date('Ymd')]);
                 }
                 if (is_array($attributes)) {
                     foreach ($attributes as $option => $value) {
                         $this->contents[$products_id_string]['attributes'][$option] = $value;
                         // insert into database
                         if (isset($_SESSION['customer_id'])) {
                             $OSCOM_Db->save('customers_basket_attributes', ['customers_id' => $_SESSION['customer_id'], 'products_id' => $products_id_string, 'products_options_id' => (int) $option, 'products_options_value_id' => (int) $value]);
                         }
                     }
                 }
             }
             $this->cleanup();
             // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
             $this->cartID = $this->generate_cart_id();
         }
     }
 }
Пример #4
0
 function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)
 {
     global $new_products_id_in_cart, $customer_id;
     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);
     if (defined('MAX_QTY_IN_CART') && MAX_QTY_IN_CART > 0 && (int) $qty > MAX_QTY_IN_CART) {
         $qty = MAX_QTY_IN_CART;
     }
     $attributes_pass_check = true;
     if (is_array($attributes) && !empty($attributes)) {
         reset($attributes);
         while (list($option, $value) = each($attributes)) {
             if (!is_numeric($option) || !is_numeric($value)) {
                 $attributes_pass_check = false;
                 break;
             } else {
                 $check_query = tep_db_query("select products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "' and options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "' limit 1");
                 if (tep_db_num_rows($check_query) < 1) {
                     $attributes_pass_check = false;
                     break;
                 }
             }
         }
     } elseif (tep_has_product_attributes($products_id)) {
         $attributes_pass_check = false;
     }
     if (is_numeric($products_id) && is_numeric($qty) && $attributes_pass_check == true) {
         $check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
         $check_product = tep_db_fetch_array($check_product_query);
         if ($check_product !== false && $check_product['products_status'] == '1') {
             if ($notify == true) {
                 $new_products_id_in_cart = $products_id;
                 tep_session_register('new_products_id_in_cart');
             }
             if ($this->in_cart($products_id_string)) {
                 $this->update_quantity($products_id_string, $qty, $attributes);
             } else {
                 $this->contents[$products_id_string] = array('qty' => (int) $qty);
                 // insert into database
                 if (tep_session_is_registered('customer_id')) {
                     tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int) $customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int) $qty . "', '" . date('Ymd') . "')");
                 }
                 if (is_array($attributes)) {
                     reset($attributes);
                     while (list($option, $value) = each($attributes)) {
                         $this->contents[$products_id_string]['attributes'][$option] = $value;
                         // insert into database
                         if (tep_session_is_registered('customer_id')) {
                             tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int) $customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int) $option . "', '" . (int) $value . "')");
                         }
                     }
                 }
             }
             $this->cleanup();
             // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
             $this->cartID = $this->generate_cart_id();
         }
     }
 }
Пример #5
0
<?php

require 'includes/application_top.php';
$navigation->set_snapshot();
$error_str = '';
if ($_GET['action'] == 'add_many_quickie_add_cart') {
    for ($i = 1; $i < count($_POST['quickie_model']) + 1; $i++) {
        if (tep_not_null($_POST['quickie_model'][$i])) {
            $quickie_query = tep_db_query("select p.products_id, p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where products_model = '" . $_POST['quickie_model'][$i] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
            if (tep_db_num_rows($quickie_query) != 1 || !tep_db_num_rows($quickie_query)) {
                $error_str .= Translate('Product') . ' ' . $i . ' ' . Translate('niet gevonden') . '<br>';
            }
            $quickie = tep_db_fetch_array($quickie_query);
            if (tep_has_product_attributes($quickie['products_id'])) {
                if (isset($_POST['quickie_attr'][$i])) {
                    $cart->add_cart($quickie['products_id'], $cart->get_quantity(tep_get_uprid($quickie['products_id'], $_POST['quickie_attr'][$i])) + $_POST['quickie_qty'][$i], $_POST['quickie_attr'][$i]);
                } else {
                    $error_str .= Translate('Product') . ' ' . $i . ' ' . Translate('heeft extra opties en is daardoor niet toegevoegd aan het winkelwagentje. Kies hier de gewenste opties') . ': <a style="text-decoration=underline" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id']) . '" target=_new>' . $quickie['products_name'] . '</a><br>';
                }
            } else {
                $cart->add_cart($quickie['products_id'], $cart->get_quantity($quickie['products_id']) + $_POST['quickie_qty'][$i], false);
            }
        }
    }
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
$breadcrumb->add('Snel-bestellen', tep_href_link(FILENAME_QUICKIE));
require DIR_WS_INCLUDES . 'header.php';
require DIR_WS_INCLUDES . 'column_left.php';
?>
<table  align="center" border="0" width="97%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">