function add_cart($products_id, $qty = '', $attributes = '') { global $new_products_id_in_cart, $customer_id; $products_id = tep_get_uprid($products_id, $attributes); if ($this->in_cart($products_id)) { $this->update_quantity($products_id, $qty, $attributes); } else { if ($qty == '') { $qty = '1'; } // if no quantity is supplied, then add '1' to the customers basket $this->contents[] = array($products_id); $this->contents[$products_id] = array('qty' => $qty); // insert into database if ($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) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')"); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id]['attributes'][$option] = $value; // insert into database if ($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) . "', '" . (int) $option . "', '" . (int) $value . "')"); } } } $new_products_id_in_cart = $products_id; tep_session_register('new_products_id_in_cart'); } $this->cleanup(); }
function add_wishlist($wishlist_id, $attributes_id) { global $customer_id; if (!$this->in_wishlist($wishlist_id)) { $wishlist_id = tep_get_uprid($wishlist_id, $attributes_id); // Insert into session $this->wishID[$wishlist_id] = array($wishlist_id); if (tep_session_is_registered('customer_id')) { // Insert into database tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id) values ('" . $customer_id . "', '" . $wishlist_id . "')"); } // Read array of options and values for attributes in id[] if (is_array($attributes_id)) { reset($attributes_id); while (list($option, $value) = each($attributes_id)) { $this->wishID[$wishlist_id]['attributes'][$option] = $value; // Add to customers_wishlist_attributes table if (tep_session_is_registered('customer_id')) { tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $wishlist_id . "', '" . $option . "', '" . $value . "' )"); } } tep_session_unregister('attributes_id'); } } }
function add_cart($products_id, $qty = '', $attributes = '') { $products_id = tep_get_uprid($products_id, $attributes); if ($this->in_cart($products_id)) { $this->update_quantity($products_id, $qty, $attributes); } else { if ($qty == '') { $qty = '1'; } // if no quantity is supplied, then add '1' to the customers basket $this->contents[$products_id] = array('qty' => $qty); if (is_array($attributes)) { foreach ($attributes as $option => $value) { $this->contents[$products_id]['attributes'][$option] = $value; } } } $this->cleanup(); }
function update_quantity($products_id, $quantity = '', $attributes = '') { global $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) $quantity > MAX_QTY_IN_CART) { $quantity = MAX_QTY_IN_CART; } $attributes_pass_check = true; if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { if (!is_numeric($option) || !is_numeric($value)) { $attributes_pass_check = false; break; } } } if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && $attributes_pass_check == true) { $this->contents[$products_id_string] = array('qty' => (int) $quantity); // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int) $quantity . "' where customers_id = '" . (int) $customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'"); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int) $value . "' where customers_id = '" . (int) $customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int) $option . "'"); } } } // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure $this->cartID = $this->generate_cart_id(); } }
function update_quantity($products_id, $quantity = '', $attributes = '') { $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) $quantity > MAX_QTY_IN_CART) { $quantity = MAX_QTY_IN_CART; } $attributes_pass_check = true; if (is_array($attributes)) { foreach ($attributes as $option => $value) { if (!is_numeric($option) || !is_numeric($value)) { $attributes_pass_check = false; break; } } } if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && $attributes_pass_check == true) { $this->contents[$products_id_string] = array('qty' => (int) $quantity); // update database if (isset($_SESSION['customer_id'])) { $OSCOM_Db->save('customers_basket', ['customers_basket_quantity' => (int) $quantity], ['customers_id' => $_SESSION['customer_id'], 'products_id' => $products_id_string]); } if (is_array($attributes)) { foreach ($attributes as $option => $value) { $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if (isset($_SESSION['customer_id'])) { $OSCOM_Db->save('customers_basket_attributes', ['products_options_value_id' => (int) $value], ['customers_id' => $_SESSION['customer_id'], 'products_id' => $products_id_string, 'products_options_id' => (int) $option]); } } } // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure $this->cartID = $this->generate_cart_id(); } }
function update_quantity($products_id, $quantity = '', $attributes = '') { global $customer_id; $products_id_string = tep_get_uprid($products_id, $attributes); $products_id = tep_get_prid($products_id_string); if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) { $this->contents[$products_id_string] = array('qty' => $quantity); // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int) $quantity . "' where customers_id = '" . (int) $customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'"); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int) $value . "' where customers_id = '" . (int) $customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int) $option . "'"); } } } } }
function update_quantity($products_id, $quantity = '', $attributes = '') { global $customer_id; if (is_numeric($_SESSION['new_customer_id'])) { $cust_id = $_SESSION['new_customer_id']; } else { $cust_id = $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) $quantity > MAX_QTY_IN_CART) { $quantity = MAX_QTY_IN_CART; } $attributes_pass_check = true; if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { if (!is_numeric($option) || !is_numeric($value)) { $attributes_pass_check = false; break; } } } if (is_numeric($products_id) && isset($this->contents[$_REQUEST['project_id']][$products_id_string]) && is_numeric($quantity) && $attributes_pass_check == true) { $this->contents[$_REQUEST['project_id']][$products_id_string] = array('qty' => (int) $quantity); // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET_PR . " set customers_basket_quantity = '" . (int) $quantity . "' where customers_id = '" . (int) $cust_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and project_id='" . $_REQUEST['project_id'] . "'"); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$_REQUEST['project_id']][$products_id_string]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) { tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES_PR . " set products_options_value_id = '" . (int) $value . "' where customers_id = '" . (int) $cust_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and project_id='" . $_REQUEST['project_id'] . "' and products_options_id = '" . (int) $option . "'"); } } } } }
function update_quantity($products_id, $quantity = '', $attributes = '') { global $osC_Database, $osC_Customer; $products_id_string = tep_get_uprid($products_id, $attributes); $products_id = tep_get_prid($products_id_string); if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) { $this->contents[$products_id_string] = array('qty' => $quantity); // update database if ($osC_Customer->isLoggedOn()) { $Qupdate = $osC_Database->query('update :table_customers_basket set customers_basket_quantity = :customers_basket_quantity where customers_id = :customers_id and products_id = :products_id'); $Qupdate->bindTable(':table_customers_basket', TABLE_CUSTOMERS_BASKET); $Qupdate->bindInt(':customers_basket_quantity', $quantity); $Qupdate->bindInt(':customers_id', $osC_Customer->id); $Qupdate->bindValue(':products_id', $products_id_string); $Qupdate->execute(); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if ($osC_Customer->isLoggedOn()) { $Qupdate = $osC_Database->query('update :table_customers_basket_attributes set products_options_value_id = :products_options_value_id where customers_id = :customers_id and products_id = :products_id and products_options_id = :products_options_id'); $Qupdate->bindTable(':table_customers_basket_attributes', TABLE_CUSTOMERS_BASKET_ATTRIBUTES); $Qupdate->bindInt(':products_options_value_id', $value); $Qupdate->bindInt(':customers_id', $osC_Customer->id); $Qupdate->bindValue(':products_id', $products_id_string); $Qupdate->bindInt(':products_options_id', $option); $Qupdate->execute(); } } } } }
$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page // Additional code to allow sample quantity - BBG Design 2011 // customer adds a product from the products page // Additional code to allow sample quantity - BBG Design 2011 case 'add_product': if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id']) && $HTTP_POST_VARS['cart_quantity'] != '0') { $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : ''; $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']); } elseif (isset($HTTP_POST_VARS['products_sample_code']) && is_numeric($HTTP_POST_VARS['products_sample_code']) && $HTTP_POST_VARS['cart_quantity2'] != '0') { $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : ''; $cart->add_cart($HTTP_POST_VARS['products_sample_code'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_sample_code'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity2'], $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer removes a product from their shopping cart // customer removes a product from their shopping cart case 'remove_product': if (isset($HTTP_GET_VARS['products_id'])) { $cart->remove($HTTP_GET_VARS['products_id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($HTTP_GET_VARS['products_id'])) {
} } $attributes = $id2[$_POST['products_id'][$i]] ? $id2[$_POST['products_id'][$i]] : ''; } else { $attributes = $_POST['id'][$_POST['products_id'][$i]] ? $_POST['id'][$_POST['products_id'][$i]] : ''; } $cart->add_cart($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page // customer adds a product from the products page case 'add_product': if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id'])) + 1, $_POST['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($_GET['products_id'])) { if (tep_has_product_attributes($_GET['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id'])); } else { $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id']) + 1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break;
// Most of this file is changed or moved to BTS - Basic Template System - format. // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). // catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change). // (Sub 'fallback' with your current template to see if there is a template specific file.) require 'includes/application_top.php'; require bts_select('language', FILENAME_WISHLIST); if (!isset($_GET['public_id']) && !isset($_POST['add_wishprod'])) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } if (isset($_GET['public_id']) && $_GET['public_id'] == '') { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } $public_id = $_GET['public_id']; // QUERY CUSTOMER INFO FROM ID $customer_query = tep_db_query("select customers_firstname from " . TABLE_CUSTOMERS . " where customers_id = '" . $public_id . "'"); $customer = tep_db_fetch_array($customer_query); // ADD PRODUCT TO SHOPPING CART if (isset($_POST['add_wishprod'])) { if (isset($_POST['add_prod_x'])) { foreach ($_POST['add_wishprod'] as $value) { $product_id = tep_get_prid($value); $cart->add_cart($product_id, $cart->get_quantity(tep_get_uprid($product_id, $_POST['id'][$value])) + 1, $_POST['id'][$value]); } tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } $breadcrumb->add(NAVBAR_TITLE_WISHLIST, tep_href_link(FILENAME_WISHLIST, '', 'SSL')); $content = CONTENT_WISHLIST_PUBLIC; include bts_select('main'); // BTSv1.5 require DIR_WS_INCLUDES . 'application_bottom.php';
if (substr($ids, 0, 1) == '_') { $ids = substr($ids, 1); $cart->add_cart($ids, $cart->get_quantity(tep_get_uprid($ids, $_POST['id'])) + 1, $_POST['id']); } else { if (strstr($ids, '{') && strstr($ids, '}')) { $options = explode('{', $ids); $prodId = $options[0]; $attributes = array(); unset($options[0]); foreach ($options as $option) { $option = explode('}', $option); $attributes['id'][$option[0]] = $option[1]; } $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $attributes['id'])) + 1, $attributes['id']); } else { $cart->add_cart($ids, $cart->get_quantity(tep_get_uprid($ids, '')) + 1, ''); } } } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($_GET['products_id'])) { if (tep_has_product_attributes($_GET['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id'])); } else { $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id']) + 1); }
$attrlist = explode(',', $_POST['attrcomb']); foreach ($attrlist as $attr) { list($oid, $oval) = explode('-', $attr); if (is_numeric($oid) && $oid == (int) $oid && is_numeric($oval) && $oval == (int) $oval) { $attributes[$oid] = $oval; } } } if (isset($_POST['id']) && is_array($_POST['id'])) { foreach ($_POST['id'] as $key => $val) { if (is_numeric($key) && $key == (int) $key && is_numeric($val) && $val == (int) $val) { $attributes = $attributes + $_POST['id']; } } } $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $attributes)) + $_POST['cart_quantity'], $attributes); // EOF: MOD - QT Pro } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($_GET['product_to_buy_id'])) { if (tep_has_product_attributes($_GET['product_to_buy_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['product_to_buy_id'] . '&opts=1')); } else { $cart->add_cart($_GET['product_to_buy_id'], $cart->get_quantity($_GET['product_to_buy_id']) + 1); tep_redirect(tep_href_link($goto, 'products_id=' . $_GET['products_id'])); } } elseif (isset($_GET['products_id'])) {
} tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds multiple products from the products_listing page // customer adds multiple products from the products_listing page case 'add_multiple': while (list($key, $val) = each($_POST)) { if (substr($key, 0, 11) == "Qty_ProdId_" || substr($key, 0, 11) == "Qty_NPrdId_") { $prodId = substr($key, 11); $qty = $val; if ($qty <= 0) { continue; } if (isset($_POST["id_{$prodId}"]) && is_array($_POST["id_{$prodId}"])) { // We have attributes $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $_POST["id_{$prodId}"])) + $qty, $_POST["id_{$prodId}"]); } else { // No attributes $cart->add_cart($prodId, $cart->get_quantity($prodId) + $qty); } } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // EOC Column List View // performed by the 'buy now' button in product listings and review page // EOC Column List View // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($_GET['products_id'])) { if (tep_has_product_attributes($_GET['products_id'])) {
} else { $attributes = $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; } $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page // customer adds a product from the products page case 'add_product': if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + 1, $HTTP_POST_VARS['id']); } if (isset($HTTP_POST_VARS['gift_id']) && is_numeric($HTTP_POST_VARS['gift_id'])) { $cart->add_cart($HTTP_POST_VARS['gift_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['gift_id'], $HTTP_POST_VARS['id'])) + 1, $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($HTTP_GET_VARS['products_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } else { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id']) + 1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break;
for ($i = 0, $n = sizeof($HTTP_POST_VARS['products_id']); $i < $n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array())) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { $attributes = $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page // customer adds a product from the products page case 'add_product': if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : ''; $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes)) + 1, $attributes); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer removes a product from their shopping cart // customer removes a product from their shopping cart case 'remove_product': if (isset($HTTP_GET_VARS['products_id'])) { $cart->remove($HTTP_GET_VARS['products_id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page case 'buy_now': if (isset($HTTP_GET_VARS['products_id'])) {
<?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">
switch ($_GET['action']) { // customer wants to update the product quantity in their shopping cart case 'update_product': for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i++) { $attributes = $_POST['id'][$_POST['products_id'][$i]] ? $_POST['id'][$_POST['products_id'][$i]] : ''; $_SESSION['cart']->add_cart($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, false); $messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, tep_get_products_name((int) $_POST['products_id'][$i])), 'success'); } OSCOM::redirect($goto, tep_get_all_get_params($parameters)); break; // customer adds a product from the products page // customer adds a product from the products page case 'add_product': if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { $attributes = isset($_POST['id']) ? $_POST['id'] : ''; $_SESSION['cart']->add_cart($_POST['products_id'], $_SESSION['cart']->get_quantity(tep_get_uprid($_POST['products_id'], $attributes)) + 1, $attributes); $messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, tep_get_products_name((int) $_POST['products_id'])), 'success'); } OSCOM::redirect($goto, tep_get_all_get_params($parameters)); break; // customer removes a product from their shopping cart // customer removes a product from their shopping cart case 'remove_product': if (isset($_GET['products_id'])) { $_SESSION['cart']->remove($_GET['products_id']); $messageStack->add_session('product_action', sprintf(PRODUCT_REMOVED, tep_get_products_name($_GET['products_id'])), 'warning'); } OSCOM::redirect($goto, tep_get_all_get_params($parameters)); break; // performed by the 'buy now' button in product listings and review page // performed by the 'buy now' button in product listings and review page
function get_products() { global $languages_id, $pfs; // PriceFormatterStore added; // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id global $sppc_customer_group_id; if (!tep_session_is_registered('sppc_customer_group_id')) { $this->cg_id = '0'; } else { $this->cg_id = $sppc_customer_group_id; } // EOF Separate Pricing Per Customer if (!is_array($this->contents)) { return false; } // BOF QPBPP for SPPC $discount_category_quantity = array(); foreach ($this->contents as $products_id => $contents_array) { if (tep_not_null($contents_array['discount_categories_id'])) { if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) { $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty']; } else { $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty']; } } } // end foreach $pf = new PriceFormatter(); // EOF QPBPP for SPPC $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { // BOF QPBPP for SPPC $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to // PriceFormatterStore or gets info from it next if ($products = $pfs->getPriceFormatterData($products_id)) { if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) { $nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']]; $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $this->contents[$products_id]['qty']; } else { $nof_other_items_in_cart_same_cat = 0; } $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat); // EOF QPBPP for SPPC // BOF Attribute Product Codes $attribute_code_array = array(); $attribute_code_query_raw = ''; if (isset($this->contents[$products_id]['attributes']) && is_array($this->contents[$products_id]['attributes'])) { foreach ($this->contents[$products_id]['attributes'] as $option => $value) { if ($attribute_code_query_raw != '') { $attribute_code_query_raw .= ' or '; } $attribute_code_query_raw .= "(options_id = '" . (int) $option . "' and options_values_id = '" . (int) $value . "')"; } $attribute_code_query = tep_db_query("select code_suffix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "' and (" . $attribute_code_query_raw . ") order by suffix_sort_order ASC"); while ($attribute_code = tep_db_fetch_array($attribute_code_query)) { if (tep_not_null($attribute_code['code_suffix'])) { $attribute_code_array[] = $attribute_code['code_suffix']; } } // $separator = '-'; $products_code = $products['products_model'] . CODE_SUFFIX_SEPERATOR . implode(CODE_SUFFIX_SEPERATOR, $attribute_code_array); } else { $products_code = $products['products_model']; } // EOF Attribute Product Codes // BOF indvship 4.5 $products_shipping_query = tep_db_query("select products_ship_price, products_ship_price_two, products_ship_zip, products_ship_methods_id from " . TABLE_PRODUCTS_SHIPPING . " where products_id = '" . $products['products_id'] . "'"); $products_shipping = tep_db_fetch_array($products_shipping_query); // EOF indvship 4.5 // $products_array[] = array('id' => $products_id, $products_array[] = array('id' => tep_get_uprid($products_id, isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), 'name' => isset($products['products_name']) ? $products['products_name'] : '', 'model' => isset($products['products_model']) ? $products['products_model'] : '', 'code' => $products_code, 'image' => isset($products['products_image']) ? $products['products_image'] : '', 'discount_categories_id' => $this->contents[$products_id]['discount_categories_id'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => isset($products['products_weight']) ? $products['products_weight'] : '', 'length' => isset($products['products_length']) ? $products['products_length'] : '', 'width' => isset($products['products_width']) ? $products['products_width'] : '', 'height' => isset($products['products_height']) ? $products['products_height'] : '', 'ready_to_ship' => isset($products['products_ready_to_ship']) ? $products['products_ready_to_ship'] : '', 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => isset($products['products_tax_class_id']) ? $products['products_tax_class_id'] : '', 'products_ship_price' => $products_shipping['products_ship_price'], 'products_ship_price_two' => $products_shipping['products_ship_price_two'], 'products_ship_zip' => $products_shipping['products_ship_zip'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''); } } return $products_array; }