本文整理汇总了PHP中wpsc_have_cart_items函数的典型用法代码示例。如果您正苦于以下问题:PHP wpsc_have_cart_items函数的具体用法?PHP wpsc_have_cart_items怎么用?PHP wpsc_have_cart_items使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpsc_have_cart_items函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: submenu_items
/**
* Add Menu Cart to menu
*
* @return menu items including cart
*/
public function submenu_items()
{
global $wpsc_cart, $options;
$get_cart = wpsc_cart_item_count();
$submenu_items = '';
//see jigoshop/widgets/cart.php
if (count($get_cart) > 0) {
//foreach ( $get_cart as $cart_item_key => $values ) {
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
//$_product = $values['data'];
if (wpsc_cart_item_count() > 0) {
global $wpsc_cart, $options;
$item_thumbnail = '<img src=' . wpsc_cart_item_image() . '>';
$item_name = wpsc_cart_item_name();
$item_quantity = wpsc_cart_item_quantity();
$item_price = wpsc_cart_item_price();
// Item permalink
$item_permalink = wpsc_cart_item_url();
$submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink);
}
//}
}
} else {
$submenu_items = '';
}
return $submenu_items;
}
开发者ID:Atlas-Solutions-Group,项目名称:wp-menu-cart-pro,代码行数:33,代码来源:wpmenucart-wpec-pro.php
示例2: while
<td><?php
echo TXT_WPSC_PRODUCT;
?>
:</td>
<td><?php
echo TXT_WPSC_QUANTITY;
?>
:</td>
<td><?php
echo TXT_WPSC_PRICE;
?>
:</td>
<td></td>
</tr>
<?php
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
?>
<?php
//this displays the confirm your order html
?>
<tr class="product_row">
<td class="firstcol"><img src='<?php
echo wpsc_cart_item_image(48, 48);
?>
' alt='<?php
echo wpsc_cart_item_name();
?>
' title='<?php
开发者ID:papayalabs,项目名称:htdocs,代码行数:31,代码来源:shopping_cart_page.php
示例3: __
//echo "<pre>".print_r($wpsc_cart,true)."</pre>";
if(wpsc_cart_item_count() > 0) :
?>
<p><?php echo __('Please review your order', 'wpsc'); ?></p>
<table class="productcart">
<tr class="firstrow">
<td class='firstcol'></td>
<td><?php echo __('Product', 'wpsc'); ?>:</td>
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>
<?php if(wpsc_uses_shipping()): ?>
<td><?php echo __('Shipping', 'wpsc'); ?>:</td>
<?php endif; ?>
<td><?php echo __('Price', 'wpsc'); ?>:</td>
<td></td>
</tr>
<?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
<?php //this displays the confirm your order html ?>
<tr class="product_row">
<td class="firstcol"><img src='<?php echo wpsc_cart_item_image(48,48); ?>' alt='<?php echo wpsc_cart_item_name(); ?>' title='<?php echo wpsc_cart_item_name(); ?>' /></td>
<td class="firstcol">
<a href='<?php echo wpsc_cart_item_url();?>'><?php echo wpsc_cart_item_name(); ?></a>
</td>
<td>
<form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
<input type="text" name="quantity" size="2" value="<?php echo wpsc_cart_item_quantity(); ?>"/>
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
<input type="hidden" name="wpsc_update_quantity" value="true"/>
<input type="submit" value="<?php echo __('Update', 'wpsc'); ?>" name="submit"/>
</form>
开发者ID:nerdfiles,项目名称:sideshowtramps.com,代码行数:31,代码来源:shopping_cart_page.php
示例4: Usecase
function Usecase($seperator, $sessionid, $fromcheckout)
{
global $wpdb, $wpsc_cart;
$purchase_log_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1";
$purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
$cart_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='" . $purchase_log[0]['id'] . "'";
$wp_cart = $wpdb->get_results($cart_sql, ARRAY_A);
$merchant_id = get_option('google_id');
$merchant_key = get_option('google_key');
$server_type = get_option('google_server_type');
$currency = get_option('google_cur');
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
$transact_url = get_option('transact_url');
$returnURL = $transact_url . $seperator . "sessionid=" . $sessionid . "&gateway=google";
$cart->SetContinueShoppingUrl($returnURL);
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
$no = 1;
//exit("<pre>".print_r($wpsc_cart,true)."</pre>");
//new item code
$no = 0;
// $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
// foreach($wpsc_cart->cart_items as $item){
//google prohibited items not implemented
$curr = new CURRENCYCONVERTER();
$currency_code = $wpdb->get_results("SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option('currency_type') . "' LIMIT 1", ARRAY_A);
$local_currency_code = $currency_code[0]['code'];
// exit('<pre>'.print_r($_REQUEST,true).'</pre>');
$google_curr = get_option('google_cur');
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
if ($google_curr != $local_currency_code) {
$google_currency_productprice = $curr->convert(wpsc_cart_item_price(false) / wpsc_cart_item_quantity(), $google_curr, $local_currency_code);
$google_currency_shipping = $curr->convert($wpsc_cart->selected_shipping_amount, $google_curr, $local_currency_code);
} else {
$google_currency_productprice = wpsc_cart_item_price(false) / wpsc_cart_item_quantity() + wpsc_cart_item_shipping(false);
$google_currency_shipping = $wpsc_cart->selected_shipping_amount;
}
// exit('<pre>'.print_r(wpsc_cart_item_name(),true).'</pre>');
$cartitem["{$no}"] = new GoogleItem(wpsc_cart_item_name(), '', wpsc_cart_item_quantity(), $google_currency_productprice);
$cart->AddItem($cartitem["{$no}"]);
$no++;
}
//If there are coupons applied add coupon as a product with negative price
if ($wpsc_cart->coupons_amount > 0) {
if ($google_curr != $local_currency_code) {
$google_currency_productprice = $curr->convert($wpsc_cart->coupons_amount, $google_curr, $local_currency_code);
} else {
$google_currency_productprice = $wpsc_cart->coupons_amount;
}
$cartitem[$no] = new GoogleItem('Discount', 'Discount Price', 1, '-' . $google_currency_productprice);
// Unit price
$cart->AddItem($cartitem[$no]);
}
// }
// Add shipping options
if (wpsc_uses_shipping() && $google_currency_shipping > 0) {
$Gfilter = new GoogleShippingFilters();
$google_checkout_shipping = get_option("google_shipping_country");
$googleshippingcountries = count($google_checkout_shipping);
//exit('<pre>'.print_r($googleshipping, true).'</pre>');
if ($googleshippingcountries == 242) {
$Gfilter->SetAllowedWorldArea(true);
} else {
if (is_array($google_checkout_shipping)) {
$google_shipping_country_ids = implode(",", $google_checkout_shipping);
}
$google_shipping_country = $wpdb->get_col("SELECT `isocode` FROM " . WPSC_TABLE_CURRENCY_LIST . " WHERE id IN (" . $google_shipping_country_ids . ")");
foreach ($google_shipping_country as $isocode) {
//exit($isocode);
$Gfilter->AddAllowedPostalArea($isocode);
if ($isocode == 'US') {
$Gfilter->SetAllowedCountryArea('ALL');
}
}
}
$Gfilter->SetAllowUsPoBox(false);
$ship_1 = new GoogleFlatRateShipping('Flat Rate Shipping', $google_currency_shipping);
$ship_1->AddShippingRestrictions($Gfilter);
$cart->AddShipping($ship_1);
}
//wpsc_google_shipping_quotes();
// Add tax rules
//if ($_SESSION['wpsc_selected_country']=='US'){
//set default tax
//exit('<pre>'.print_r($_SESSION,true).'</pre>');
$sql = "SELECT `name`, `tax` FROM " . WPSC_TABLE_REGION_TAX . " WHERE id='" . $_SESSION['wpsc_selected_region'] . "'";
//exit('<pre>'.print_r($sql, true).'</pre>');
$state_name = $wpdb->get_row($sql, ARRAY_A);
//exit('<pre>'.print_r($state_name, true).'</pre>');
$defaultTax = $state_name['tax'] / 100;
$tax_rule = new GoogleDefaultTaxRule($defaultTax);
$sql = "SELECT `code` FROM " . WPSC_TABLE_REGION_TAX . " WHERE `country_id`='136' AND `tax` = " . $state_name['tax'];
$states = $wpdb->get_col($sql);
//exit('<pre>'.print_r($states, true).'</pre>');
$tax_rule->SetStateAreas((array) $states);
$cart->AddDefaultTaxRules($tax_rule);
//get alternative tax rates
$sql = "SELECT DISTINCT `tax` FROM " . WPSC_TABLE_REGION_TAX . " WHERE `tax` != 0 AND `tax` !=" . $state_name['tax'] . " AND `country_id`='136' ORDER BY `tax`";
$othertax = $wpdb->get_col($sql);
$i = 1;
//.........这里部分代码省略.........
开发者ID:Jonathonbyrd,项目名称:wp-ecommerce,代码行数:101,代码来源:GoogleCheckout-XML.php
示例5: checkout_form
/**
* Checkout Form
* @since 1.3
* @version 1.1
*/
function checkout_form()
{
$output = '';
if (!is_user_logged_in()) {
$output .= '<tr><td>' . $this->core->template_tags_general($this->prefs['visitor']) . '</td></tr>';
return $output;
}
$output .= '<tr><td><table width="100%"><thead><th class="cart-item">' . __('Item', 'mycred') . '</th><th class="cart-item-qt"></th><th class="cart-item-cost">' . $this->core->plural() . '</th></thead><tbody>';
$total = 0;
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
$price = wpsc_cart_item_price(false);
if ($this->prefs['rate'] != 1) {
$price = $this->prefs['rate'] * $price;
}
$total = $total + $price;
}
$output .= '<tr><td colspan="2">' . __('Total Cost', 'mycred') . '</td><td class="cart-item-cost">' . $this->core->format_creds($total) . '</td></tr>';
$balance = $this->core->get_users_cred(get_current_user_id(), $this->mycred_type);
if ($balance < $total) {
$highlight = ' style="color:red;"';
} else {
$highlight = '';
}
$output .= '<tr><td class="cart-item" colspan="2">' . __('Your current balance', 'mycred') . '</td><td class="cart-item-cost"' . $highlight . '>' . $this->core->format_creds($balance) . '</td></tr></tdody></table></tr>';
if (!empty($this->prefs['message'])) {
$output .= '<tr><td>' . $this->core->template_tags_general($this->prefs['message']) . '</td></tr>';
}
return apply_filters('mycred_wpecom_form', $output);
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:35,代码来源:mycred-wpecommerce.php
示例6: Usecase
function Usecase($separator, $sessionid, $fromcheckout)
{
global $wpdb, $wpsc_cart;
$purchase_log_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid` = %s LIMIT 1", $sessionid);
$purchase_log = $wpdb->get_results($purchase_log_sql, ARRAY_A);
$cart_sql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid` = %d", $purchase_log[0]['id']);
$wp_cart = $wpdb->get_results($cart_sql, ARRAY_A);
$merchant_id = get_option('google_id');
$merchant_key = get_option('google_key');
$server_type = get_option('google_server_type');
$currency = get_option('google_cur');
$transact_url = get_option('transact_url');
$returnURL = $transact_url . $separator . "sessionid=" . $sessionid . "&gateway=google";
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $currency);
$cart->SetContinueShoppingUrl($returnURL);
$cart->SetEditCartUrl(get_option('shopping_cart_url'));
//google prohibited items not implemented
$currency_converter = new CURRENCYCONVERTER();
$currency_code = $wpdb->get_results("SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . get_option('currency_type') . "' LIMIT 1", ARRAY_A);
$local_currency_code = $currency_code[0]['code'];
$google_curr = get_option('google_cur');
$currentcy_rate = 1;
if ($google_curr != $local_currency_code) {
$currentcy_rate = $currency_converter->convert(1, $local_currency_code, $google_curr);
}
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
$google_currency_productprice = $currentcy_rate * (wpsc_cart_item_price(false) / wpsc_cart_item_quantity());
$cart_item = new GoogleItem(wpsc_cart_item_name(), '', wpsc_cart_item_quantity(), $google_currency_productprice);
$cart->AddItem($cart_item);
}
//If there are coupons applied add coupon as a product with negative price
if ($wpsc_cart->coupons_amount > 0) {
$google_currency_productprice = $currentcy_rate * $wpsc_cart->coupons_amount;
$coupon = new GoogleItem('Discount', 'Discount Price', 1, '-' . $google_currency_productprice);
$cart->AddItem($coupon);
}
$shipping_country = $purchase_log[0]['shipping_country'];
$shipping_region = $purchase_log[0]['shipping_region'];
if ($shipping_country == "UK") {
$shipping_country = "GB";
}
// Add shipping options
if (wpsc_uses_shipping()) {
$shipping_name = ucfirst($wpsc_cart->selected_shipping_method) . " - " . $wpsc_cart->selected_shipping_option;
if ($shipping_name == "") {
$shipping_name = "Calculated";
}
$shipping = new GoogleFlatRateShipping($shipping_name, $wpsc_cart->calculate_total_shipping() * $currentcy_rate);
if (!empty($shipping_country)) {
$shipping_filter = new GoogleShippingFilters();
if (!empty($shipping_region) && is_numeric($shipping_region)) {
$shipping_filter->AddAllowedPostalArea($shipping_country, wpsc_get_state_by_id($shipping_region, "code"));
$shipping_filter->AddAllowedStateArea(wpsc_get_state_by_id($shipping_region, "code"));
} else {
$shipping_filter->AddAllowedPostalArea($shipping_country);
}
$shipping->AddShippingRestrictions($shipping_filter);
}
$cart->AddShipping($shipping);
}
// Add tax rules
if (!empty($shipping_country)) {
$tax_rule = new GoogleDefaultTaxRule(wpsc_cart_tax(false) / $wpsc_cart->calculate_subtotal());
$tax_rule->AddPostalArea($shipping_country);
$cart->AddDefaultTaxRules($tax_rule);
}
// Display Google Checkout button
if (get_option('google_button_size') == '0') {
$google_button_size = 'BIG';
} elseif (get_option('google_button_size') == '1') {
$google_button_size = 'MEDIUM';
} elseif (get_option('google_button_size') == '2') {
$google_button_size = 'SMALL';
}
echo $cart->CheckoutButtonCode($google_button_size);
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:77,代码来源:GoogleCheckout-XML.php
示例7: checkout_ids
public function checkout_ids()
{
if (wpsc_cart_item_count() > 0) {
global $wpsc_cart;
$line_items = array();
while (wpsc_have_cart_items()) {
wpsc_the_cart_item();
$current_item = $wpsc_cart->cart_item;
$parent = $this->get_parent_post($current_item->product_id);
if ($parent) {
$product_id = $parent->ID;
$product_name = $parent->post_title;
} else {
$product_id = wpsc_cart_item_product_id();
$product_name = wpsc_cart_item_name();
}
$line_item = (int) $product_id;
$line_items[] = $line_item;
}
echo '<script type="text/javascript">
var _ra = _ra || {};
_ra.checkoutIdsInfo =' . json_encode($line_items, JSON_PRETTY_PRINT) . '
if (_ra.ready !== undefined) {
_ra.checkoutIds(_ra.checkoutIdsInfo);
}
</script>';
}
}
开发者ID:retargeting,项目名称:WP-eCommerce,代码行数:28,代码来源:wpec-retargeting.php
注:本文中的wpsc_have_cart_items函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论