本文整理汇总了PHP中tep_get_uprid函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_uprid函数的具体用法?PHP tep_get_uprid怎么用?PHP tep_get_uprid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_uprid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_cart
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();
}
示例2: add_wishlist
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');
}
}
}
示例3: add_cart
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();
}
示例4: update_quantity
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();
}
}
示例5: update_quantity
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();
}
}
示例6: update_quantity
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 . "'");
}
}
}
}
}
示例7: update_quantity
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 . "'");
}
}
}
}
}
示例8: update_quantity
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();
}
}
}
}
}
示例9: tep_redirect
$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'])) {
示例10: tep_redirect
}
}
$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;
示例11: bts_select
// 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';
示例12: substr
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);
}
示例13: explode
$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'])) {
示例14: tep_redirect
}
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'])) {
示例15: tep_redirect
} 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;