本文整理汇总了PHP中tep_get_prid函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_prid函数的具体用法?PHP tep_get_prid怎么用?PHP tep_get_prid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_prid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_order_total
function get_order_total()
{
global $order, $cart;
$order_total = $order->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $cart->get_products();
for ($i = 0; $i < sizeof($products); $i++) {
$t_prid = tep_get_prid($products[$i]['id']);
$gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
$gv_result = tep_db_fetch_array($gv_query);
if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
$qty = $cart->get_quantity($t_prid);
$products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax == 'false') {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'], $products_tax)) * $qty;
}
$order_total = $order_total - $gv_amount;
}
}
if ($this->include_tax == 'false') {
$order_total = $order_total - $order->info['tax'];
}
if ($this->include_shipping == 'false') {
$order_total = $order_total - $order->info['shipping_cost'];
}
return $order_total;
}
开发者ID:validoc,项目名称:Pikmas,代码行数:29,代码来源:ot_surcharge.php
示例2: calculate
function calculate()
{
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) {
return 0;
}
foreach (array_keys($this->contents) as $products_id) {
$qty = $this->contents[$products_id]['qty'];
// products price
$Qproduct = $this->db->get('products', ['products_id', 'products_price', 'products_tax_class_id', 'products_weight'], ['products_id' => (int) tep_get_prid($products_id)]);
if ($Qproduct->fetch() !== false) {
$prid = $Qproduct->valueInt('products_id');
$products_tax = tep_get_tax_rate($Qproduct->valueInt('products_tax_class_id'));
$products_price = $Qproduct->value('products_price');
$products_weight = $Qproduct->value('products_weight');
$Qspecials = $this->db->get('specials', 'specials_new_products_price', ['products_id' => $prid, 'status' => '1']);
if ($Qspecials->fetch() !== false) {
$products_price = $Qspecials->value('specials_new_products_price');
}
$this->total += tep_add_tax($products_price, $products_tax) * $qty;
$this->weight += $qty * $products_weight;
// attributes price
if (isset($this->contents[$products_id]['attributes'])) {
foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
$Qattribute = $this->db->get('products_attributes', ['options_values_price', 'price_prefix'], ['products_id' => $prid, 'options_id' => (int) $option, 'options_values_id' => (int) $value]);
if ($Qattribute->value('price_prefix') == '+') {
$this->total += $qty * tep_add_tax($Qattribute->value('options_values_price'), $products_tax);
} else {
$this->total -= $qty * tep_add_tax($Qattribute->value('options_values_price'), $products_tax);
}
}
}
}
}
}
开发者ID:haraldpdl,项目名称:oscommerce2,代码行数:36,代码来源:shopping_cart.php
示例3: before_process
function before_process()
{
global $customer_id, $order, $order_totals, $sendto, $billto, $payment, $currencies;
global ${$payment};
$pass = false;
if (isset($_GET['transaction_id']) && isset($_GET['msid'])) {
if ($_GET['transaction_id'] == substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1)) {
if ($_GET['msid'] == strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_MERCHANT_ID . $_GET['transaction_id'] . strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD))))) {
$pass = true;
}
}
} elseif (isset($_GET['osig']) && $_GET['osig'] == md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD . $GLOBALS[$this->_mbcartID])) {
$pass = true;
}
if ($pass == true) {
$order_id = substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1);
$check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
if (tep_db_num_rows($check_query)) {
$check = tep_db_fetch_array($check_query);
if ($check['orders_status'] == MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID) {
$sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
}
}
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
$sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
// initialized for the email confirmation
$products_ordered = '';
$subtotal = 0;
$total_tax = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n FROM " . TABLE_PRODUCTS . " p\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n ON p.products_id=pa.products_id\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n ON pa.products_attributes_id=pad.products_attributes_id\n WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
$products_attributes = $order->products[$i]['attributes'];
if (is_array($products_attributes)) {
$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
}
$stock_query = tep_db_query($stock_query_raw);
} else {
$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
if (tep_db_num_rows($stock_query) > 0) {
$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
} else {
$stock_left = $stock_values['products_quantity'];
}
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
}
}
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1';
for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'";
$attributes = tep_db_query($attributes_query);
} else {
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
}
$attributes_values = tep_db_fetch_array($attributes);
$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
}
}
//------insert customer choosen option eof ----
$total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}
// lets start with the email confirmation
$email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";
}
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\n";
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object(${$payment})) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
$payment_class = ${$payment};
//.........这里部分代码省略.........
开发者ID:atmediacom,项目名称:oscommerce2,代码行数:101,代码来源:moneybookers.php
示例4: tep_db_fetch_array
if (tep_db_num_rows($stock_query) > 0) {
$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
} else {
$stock_left = $stock_values['products_quantity'];
}
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
}
}
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
// Let's get all the info together for the email
$total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;
// Let's get the attributes
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
$products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value'];
}
}
// Let's format the products model
$products_model = '';
if (!empty($order->products[$i]['model'])) {
$products_model = ' (' . $order->products[$i]['model'] . ')';
开发者ID:digideskio,项目名称:oscmax2,代码行数:31,代码来源:ipn.php
示例5: _process
function _process()
{
global $osC_Database, $osC_Session, $osC_Customer, $osC_Currencies, $cart, $order, $payment_modules, $shipping_modules, $order_total_modules;
// load selected payment module
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($osC_Session->value('payment'));
// load the selected shipping module
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping($osC_Session->value('shipping'));
$order = new order();
// load the before_process function from the payment modules
$payment_modules->before_process();
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_totals = $order_total_modules->process();
$Qorder = $osC_Database->query('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_country, :customers_telephone, :customers_email_address, :customers_address_format_id, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_country, :delivery_address_format_id, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_country, :billing_address_format_id, :payment_method, :cc_type, :cc_owner, :cc_number, :cc_expires, :date_purchased, :orders_status, :currency, :currency_value)');
$Qorder->bindTable(':table_orders', TABLE_ORDERS);
$Qorder->bindInt(':customers_id', $osC_Customer->id);
$Qorder->bindValue(':customers_name', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
$Qorder->bindValue(':customers_company', $order->customer['company']);
$Qorder->bindValue(':customers_street_address', $order->customer['street_address']);
$Qorder->bindValue(':customers_suburb', $order->customer['suburb']);
$Qorder->bindValue(':customers_city', $order->customer['city']);
$Qorder->bindValue(':customers_postcode', $order->customer['postcode']);
$Qorder->bindValue(':customers_state', $order->customer['state']);
$Qorder->bindValue(':customers_country', $order->customer['country']['title']);
$Qorder->bindValue(':customers_telephone', $order->customer['telephone']);
$Qorder->bindValue(':customers_email_address', $order->customer['email_address']);
$Qorder->bindInt(':customers_address_format_id', $order->customer['format_id']);
$Qorder->bindValue(':customers_ip_address', tep_get_ip_address());
$Qorder->bindValue(':delivery_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']);
$Qorder->bindValue(':delivery_company', $order->delivery['company']);
$Qorder->bindValue(':delivery_street_address', $order->delivery['street_address']);
$Qorder->bindValue(':delivery_suburb', $order->delivery['suburb']);
$Qorder->bindValue(':delivery_city', $order->delivery['city']);
$Qorder->bindValue(':delivery_postcode', $order->delivery['postcode']);
$Qorder->bindValue(':delivery_state', $order->delivery['state']);
$Qorder->bindValue(':delivery_country', $order->delivery['country']['title']);
$Qorder->bindInt(':delivery_address_format_id', $order->delivery['format_id']);
$Qorder->bindValue(':billing_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']);
$Qorder->bindValue(':billing_company', $order->billing['company']);
$Qorder->bindValue(':billing_street_address', $order->billing['street_address']);
$Qorder->bindValue(':billing_suburb', $order->billing['suburb']);
$Qorder->bindValue(':billing_city', $order->billing['city']);
$Qorder->bindValue(':billing_postcode', $order->billing['postcode']);
$Qorder->bindValue(':billing_state', $order->billing['state']);
$Qorder->bindValue(':billing_country', $order->billing['country']['title']);
$Qorder->bindInt(':billing_address_format_id', $order->billing['format_id']);
$Qorder->bindValue(':payment_method', $order->info['payment_method']);
$Qorder->bindValue(':cc_type', $order->info['cc_type']);
$Qorder->bindValue(':cc_owner', $order->info['cc_owner']);
$Qorder->bindValue(':cc_number', $order->info['cc_number']);
$Qorder->bindValue(':cc_expires', $order->info['cc_expires']);
$Qorder->bindRaw(':date_purchased', 'now()');
$Qorder->bindValue(':orders_status', $order->info['order_status']);
$Qorder->bindValue(':currency', $order->info['currency']);
$Qorder->bindValue(':currency_value', $order->info['currency_value']);
$Qorder->execute();
$insert_id = $osC_Database->nextID();
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
$Qtotals = $osC_Database->query('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
$Qtotals->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
$Qtotals->bindInt(':orders_id', $insert_id);
$Qtotals->bindValue(':title', $order_totals[$i]['title']);
$Qtotals->bindValue(':text', $order_totals[$i]['text']);
$Qtotals->bindValue(':value', $order_totals[$i]['value']);
$Qtotals->bindValue(':class', $order_totals[$i]['code']);
$Qtotals->bindInt(':sort_order', $order_totals[$i]['sort_order']);
$Qtotals->execute();
}
$Qstatus = $osC_Database->query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, :date_added, :customer_notified, :comments)');
$Qstatus->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
$Qstatus->bindInt(':orders_id', $insert_id);
$Qstatus->bindInt(':orders_status_id', $order->info['order_status']);
$Qstatus->bindRaw(':date_added', 'now()');
$Qstatus->bindInt(':customer_notified', SEND_EMAILS == 'true' ? '1' : '0');
$Qstatus->bindValue(':comments', $order->info['comments']);
$Qstatus->execute();
// initialized for the email confirmation
$products_ordered = '';
$subtotal = 0;
$total_tax = 0;
$total_weight = 0;
$total_cost = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
$Qstock = $osC_Database->query('select products_quantity, pad.products_attributes_filename from :table_products p left join :table_products_attributes pa on (p.products_id = pa.products_id) left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where p.products_id = :products_id');
$Qstock->bindTable(':table_products', TABLE_PRODUCTS);
$Qstock->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
$Qstock->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
$Qstock->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
// Will work with only one option for downloadable products otherwise, we have to build the query dynamically with a loop
$products_attributes = $order->products[$i]['attributes'];
if (is_array($products_attributes)) {
$Qstock->appendQuery('and pa.options_id = :options_id and pa.options_values_id = :options_values_id');
$Qstock->bindInt(':options_id', $products_attributes[0]['option_id']);
$Qstock->bindInt(':options_values_id', $products_attributes[0]['value_id']);
}
//.........这里部分代码省略.........
开发者ID:itnovator,项目名称:oscommerce_cvs,代码行数:101,代码来源:process.php
示例6: before_process
function before_process()
{
/* ** Altered for CCGV **
global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID, $$payment, $HTTP_GET_VARS, $HTTP_POST_VARS, $messageStack;
$result = false;
*/
global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID, ${$payment}, $HTTP_GET_VARS, $HTTP_POST_VARS, $messageStack, $order_total_modules;
$result = false;
$order_total_modules->apply_credit();
/* **EOF alteration for CCGV ** */
if (isset($HTTP_POST_VARS['receiver_email']) && ($HTTP_POST_VARS['receiver_email'] == MODULE_PAYMENT_PAYPAL_STANDARD_ID || defined('MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID') && tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID) && $HTTP_POST_VARS['receiver_email'] == MODULE_PAYMENT_PAYPAL_STANDARD_PRIMARY_ID)) {
$parameters = 'cmd=_notify-validate';
foreach ($HTTP_POST_VARS as $key => $value) {
$parameters .= '&' . $key . '=' . urlencode(stripslashes($value));
}
$result = $this->sendTransactionToGateway($this->form_action_url, $parameters);
}
if ($result != 'VERIFIED') {
if (defined('MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_INVALID_TRANSACTION')) {
$messageStack->add_session('header', MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_INVALID_TRANSACTION);
}
$this->sendDebugEmail($result);
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
$this->verifyTransaction();
$order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-') + 1);
$check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "' and customers_id = '" . (int) $customer_id . "'");
if (!tep_db_num_rows($check_query) || $order_id != $HTTP_POST_VARS['invoice'] || $customer_id != $HTTP_POST_VARS['custom']) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
}
$check = tep_db_fetch_array($check_query);
$new_order_status = DEFAULT_ORDERS_STATUS_ID;
if ($check['orders_status'] != MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
$new_order_status = $check['orders_status'];
}
if (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 && $check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID) {
$new_order_status = MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID;
}
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (int) $new_order_status . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
$sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => (int) $new_order_status, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
// initialized for the email confirmation
$products_ordered = '';
$subtotal = 0;
$total_tax = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n FROM " . TABLE_PRODUCTS . " p\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n ON p.products_id=pa.products_id\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n ON pa.products_attributes_id=pad.products_attributes_id\n WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
$products_attributes = $order->products[$i]['attributes'];
if (is_array($products_attributes)) {
$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
}
$stock_query = tep_db_query($stock_query_raw);
} else {
$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
if (tep_db_num_rows($stock_query) > 0) {
$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
} else {
$stock_left = $stock_values['products_quantity'];
}
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
}
}
}
// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1';
for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $languages_id . "'\n and poval.language_id = '" . $languages_id . "'";
$attributes = tep_db_query($attributes_query);
} else {
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
}
$attributes_values = tep_db_fetch_array($attributes);
$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
}
}
//------insert customer choosen option eof ----
$total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}
// lets start with the email confirmation
//.........这里部分代码省略.........
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:101,代码来源:paypal_standard.php
示例7: 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();
}
}
开发者ID:tiansiyuan,项目名称:oscommerce2,代码行数:36,代码来源:shopping_cart.php
示例8: count_contents_virtual
function count_contents_virtual()
{
// get total number of items in cart disregard gift vouchers
$total_items = 0;
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$no_count = false;
$gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
$gv_result = tep_db_fetch_array($gv_query);
if (ereg('^GIFT', $gv_result['products_model'])) {
$no_count = true;
}
if (defined('NO_COUNT_ZERO_WEIGHT') && NO_COUNT_ZERO_WEIGHT == 1) {
$gv_query = tep_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($products_id) . "'");
$gv_result = tep_db_fetch_array($gv_query);
if ($gv_result['products_weight'] <= MINIMUM_WEIGHT) {
$no_count = true;
}
}
if (!$no_count) {
$total_items += $this->get_quantity($products_id);
}
}
}
return $total_items;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:27,代码来源:shopping_cart.php
示例9: _build_attributes_combinations
function _build_attributes_combinations($attributes, $showoos, $markoos, &$combinations, &$selected_combination, $oidindex = 0, $comb = array(), $id = "", $text = '', $isselected = true)
{
global $cart;
foreach ($attributes[$oidindex]['ovals'] as $attrib) {
$newcomb = $comb;
$newcomb[$attributes[$oidindex]['oid']] = $attrib['id'];
$newid = $id . ',' . $attributes[$oidindex]['oid'] . '-' . $attrib['id'];
$newtext = $text . ", " . $attrib['text'];
if (isset($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']])) {
$newisselected = $cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']] == $attrib['id'] ? $isselected : false;
} else {
$newisselected = false;
}
if (isset($attributes[$oidindex + 1])) {
$this->_build_attributes_combinations($attributes, $showoos, $markoos, $combinations, $selected_combination, $oidindex + 1, $newcomb, $newid, $newtext, $newisselected);
} else {
$is_out_of_stock = tep_check_stock(tep_get_prid($this->products_id), 1, $newcomb);
if (!$is_out_of_stock | $showoos == true) {
switch ($markoos) {
case 'Left':
$newtext = ($is_out_of_stock ? TEXT_OUT_OF_STOCK . ' - ' : '') . substr($newtext, 2);
break;
case 'Right':
$newtext = substr($newtext, 2) . ($is_out_of_stock ? ' - ' . TEXT_OUT_OF_STOCK : '');
break;
default:
$newtext = substr($newtext, 2);
break;
}
$combinations[] = array('comb' => $newcomb, 'id' => substr($newid, 1), 'text' => $newtext);
if ($newisselected) {
$selected_combination = sizeof($combinations) - 1;
}
}
}
}
}
开发者ID:digideskio,项目名称:oscmax2,代码行数:37,代码来源:pad_base_orig.php
示例10: get_rectricted_product_price_for_coupon
function get_rectricted_product_price_for_coupon($restrict_to_products)
{
global $order;
$i_get_rectricted_product_price_for_coupon = 0;
$pr_ids = explode(",", $restrict_to_products);
//print("<br><br>************************************<br><br>");
for ($io = 0; $io < count($order->products); $io++) {
$pr_c = $this->product_price(tep_get_prid($order->products[$io]['id']));
//print('order-products_id : '.$order->products[$io]['id'].'<br>');
//print('<xmp>');
//print_r($pr_ids);
//print('</xmp>');
//print('order-products_price :: pr_c : '.$pr_c.'<br>');
//print('i_get_rectricted_product_price_for_coupon :: pr_c : '.$i_get_rectricted_product_price_for_coupon.'<br>');
if (in_array($order->products[$io]['id'], $pr_ids)) {
//print(' pr_c : '.$pr_c.'<br>');
//print(' qty : '.$order->products[$io]['qty'].'<br>');
//print(' i_get_rectricted_product_price_for_coupon : '.$i_get_rectricted_product_price_for_coupon.'<br>');
$i_get_rectricted_product_price_for_coupon += $pr_c;
//print(' i_get_rectricted_product_price_for_coupon : '.$i_get_rectricted_product_price_for_coupon.'<br>');
}
}
//print("<br><br>************************************<br><br>");
return $i_get_rectricted_product_price_for_coupon;
}
开发者ID:resultsonlyweb,项目名称:loaded6-template,代码行数:25,代码来源:ot_coupon.php
示例11: 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);
$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' => $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 . "'");
}
}
}
}
}
开发者ID:jobw0110,项目名称:lascolinasobgyn,代码行数:33,代码来源:shopping_cart.php
示例12: while
<td class="productListing-heading"><?php
echo BOX_TEXT_PRICE;
?>
</td>
<td class="productListing-heading" align="center"><?php
echo BOX_TEXT_SELECT;
?>
</td>
</tr>
<?php
/*******************************************************************
***** LOOP THROUGH EACH PRODUCT ID TO DISPLAY IN THE WISHLIST ******
*******************************************************************/
$i = 0;
while ($wishlist = tep_db_fetch_array($wishlist_query)) {
$wishlist_id = tep_get_prid($wishlist['products_id']);
$products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_status, p.products_price, p.products_tax_class_id, IF(s.status = '1' and s.customers_group_id = '" . $customer_group_id . "', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd) left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) where pd.products_id = '" . $wishlist_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by products_name");
$products = tep_db_fetch_array($products_query);
if ($i / 2 == floor($i / 2)) {
$class = "productListing-even";
} else {
$class = "productListing-odd";
}
?>
<tr class="<?php
echo $class;
?>
">
<td valign="top" class="productListing-data-list" align="left"><a href="<?php
echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $wishlist['products_id'], 'NONSSL');
?>
开发者ID:digideskio,项目名称:oscmax2,代码行数:31,代码来源:wishlist_public.tpl.php
-
宝宝鼻子不通气,如果不是病毒感冒的话建议不要吃药,多喝温开水,注意观察体温。保持
阅读:942|2022-07-30
-
dphi-official/Machine_Learning_Bootcamp
阅读:1361|2022-08-18
-
juven/maven-bash-completion: Maven Bash Auto Completion
阅读:816|2022-08-16
-
win7系统电脑使用过程中有不少朋友表示遇到过win7系统注册表编辑器打开的状况,当出现
阅读:760|2022-11-06
-
route101/mastoinker: Quick image view assistant for Mastodon client
阅读:920|2022-08-18
-
Delphi获取当前鼠标下的控件内容主要函数:GetCursorPos;//获取鼠标的位置WindowFrom
阅读:1117|2022-07-18
-
Performance Counters for Windows Elevation of Privilege Vulnerability.
阅读:1193|2022-07-29
-
0e0w · GitHub
阅读:427|2022-08-15
-
tgreyuk/typedoc-plugin-markdown: A plugin for TypeDoc that enables TypeScript AP
阅读:757|2022-08-18
-
台湾人的方言是“台湾话”,官方是“国语”,和普通话一样。小编一直觉得,大连话和台
阅读:315|2022-11-06
|
请发表评论