当前位置: 首页>>代码示例>>PHP>>正文


PHP display_cart函数代码示例

本文整理汇总了PHP中display_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP display_cart函数的具体用法?PHP display_cart怎么用?PHP display_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了display_cart函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_start

<?php

include 'book_sc_fns.php';
// The shopping cart needs sessions, so start one
session_start();
do_html_header("Checkout");
// create short variable names
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
// if filled out
if ($_SESSION['cart'] && $name && $address && $city && $zip && $country) {
    // able to insert into database
    if (insert_order($_POST) != false) {
        //display cart, not allowing changes and without pictures
        display_cart($_SESSION['cart'], false, 0);
        display_shipping(calculate_shipping_cost());
        //get credit card details
        display_card_form($name);
        display_button('show_cart.php', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not store data, please try again.';
        display_button('checkout.php', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('checkout.php', 'back', 'Back');
}
do_html_footer();
开发者ID:kmfb21,项目名称:A290CGI-PHP,代码行数:31,代码来源:purchase.php

示例2: unset

            unset($_SESSION['cart'][$isbn]);
        } else {
            $_SESSION['cart'][$isbn] = $_POST[$isbn];
        }
        // Cập nhật số lượng mới
    }
    $_SESSION['total_price'] = calculate_price($_SESSION['cart']);
    $_SESSION['items'] = calculate_items($_SESSION['cart']);
}
?>

<?php 
/*echo "<pre>";
	// print_r($_SESSION);
	echo "</pre>";*/
// Tiếp bài học 19.11.2015
if ($_SESSION['cart']) {
    display_cart($_SESSION['cart']);
} else {
    echo "<p>Giỏ hàng rỗng</p>";
    echo "<hr>";
}
$url = "index.php?dk=loaisach";
if ($new) {
    $detail = get_book_details($new);
    if ($detail[catid]) {
        $url = "index.php?dk=show_cart&catid={$detail['catid']}";
    }
}
display_button($url, 'continue-shopping', 'Continue Shopping');
display_button('index.php?dk=checkout', 'go-to-checkout', 'Go-To-Checkout');
开发者ID:tlcn11,项目名称:MaiTranThuy,代码行数:31,代码来源:show_cart.php

示例3: eshop_cart_callback

 function eshop_cart_callback($array)
 {
     global $eshopoptions, $blog_id;
     if (isset($_SESSION['eshopcart' . $blog_id])) {
         echo display_cart($_SESSION['eshopcart' . $blog_id], false, $eshopoptions['checkout'], 'widget');
     }
     die;
 }
开发者ID:joaosigno,项目名称:dazake-job,代码行数:8,代码来源:public-functions.php

示例4: eshop_checkout


//.........这里部分代码省略.........
                         if (!in_array($opt["pclas"], $shiparray)) {
                             if ($opt["pclas"] != 'F') {
                                 array_push($shiparray, 'A');
                             }
                         }
                         break;
                     case '4':
                         //( weight )
                         if (isset($espost['eshop_shiptype'])) {
                             unset($shiparray);
                             $shiparray = $espost['eshop_shiptype'];
                         }
                         break;
                 }
             }
         }
         //need an extra check
         if ($eshopoptions['shipping'] == '4' && 'no' == $eshopoptions['downloads_only'] && isset($espost['submit']) && !isset($espost['eshop_shiptype']) && !eshop_only_downloads()) {
             $pzone = '';
         }
         //need to check the discount codes here as well:
         if (eshop_discount_codes_check()) {
             $_SESSION['eshop_discount' . $blog_id] = '';
             unset($_SESSION['eshop_discount' . $blog_id]);
             if (isset($espost['eshop_discount']) && $espost['eshop_discount'] != '') {
                 $chkcode = valid_eshop_discount_code($espost['eshop_discount']);
                 if ($chkcode) {
                     $_SESSION['eshop_discount' . $blog_id] = $espost['eshop_discount'];
                 }
             }
         }
         //show the cart
         if (isset($_GET['eshopaction']) && $_GET['eshopaction'] != 'redirect' || !isset($_GET['eshopaction'])) {
             $echoit .= display_cart($_SESSION['eshopcart' . $blog_id], false, $eshopoptions['checkout'], $pzone, $shiparray);
         }
     }
     $error = '';
     if (isset($espost['submit'])) {
         //form handling
         foreach ($espost as $key => $value) {
             $key = $value;
         }
         //setupshipping arrays
         $reqdvalues = array('shipping', 'first_name', 'last_name', 'email', 'phone', 'address', 'city', 'zip', 'pay');
         if ($eshopoptions['shipping'] != '4') {
             if ($eshopoptions['shipping_zone'] == 'country') {
                 $reqdvalues[] = 'country';
             } else {
                 $reqdvalues[] = 'state';
             }
         } else {
             $creqd = '';
             $dtable = $wpdb->prefix . 'eshop_rates';
             $query = $wpdb->get_results("SELECT DISTINCT(area) from {$dtable} where rate_type='ship_weight'");
             foreach ($query as $k) {
                 $reqdvalues[] = $k->area;
             }
         }
         $linkattr = apply_filters('eShopCheckoutLinksAttr', '');
         $reqdarray = apply_filters('eshopCheckoutReqd', $reqdvalues);
         if ($eshopoptions['shipping'] == '4' && 'no' == $eshopoptions['downloads_only'] && !isset($espost['eshop_shiptype']) && !eshop_only_downloads()) {
             $error .= '<li>' . __('<strong>Shipping</strong> - not selected.', 'eshop') . '</li>';
         }
         if (isset($espost['first_name'])) {
             $valid = checkAlpha($espost['first_name']);
             if ($valid == FALSE && eshop_checkreqd($reqdarray, 'first_name')) {
开发者ID:ricasiano,项目名称:mca-site,代码行数:67,代码来源:checkout.php

示例5: session_start

<?php

include 'book_sc_fns.php';
// The shopping cart needs sessions, so start one
session_start();
do_html_header('Checkout');
$card_type = $HTTP_POST_VARS['card_type'];
$card_number = $HTTP_POST_VARS['card_number'];
$card_month = $HTTP_POST_VARS['card_month'];
$card_year = $HTTP_POST_VARS['card_year'];
$card_name = $HTTP_POST_VARS['card_name'];
if ($HTTP_SESSION_VARS['cart'] && $card_type && $card_number && $card_month && $card_year && $card_name) {
    //display cart, not allowing changes and without pictures
    display_cart($HTTP_SESSION_VARS['cart'], false, 0);
    display_shipping(calculate_shipping_cost());
    if (process_card($HTTP_POST_VARS)) {
        //empty shopping cart
        session_destroy();
        echo 'Thankyou for shopping with us.  Your order has been placed.';
        display_button('index.php', 'continue-shopping', 'Continue Shopping');
    } else {
        echo 'Could not process your card. ';
        echo 'Please contact the card issuer or try again.';
        display_button('purchase.php', 'back', 'Back');
    }
} else {
    echo 'You did not fill in all the fields, please try again.<hr />';
    display_button('purchase.php', 'back', 'Back');
}
do_html_footer();
开发者ID:andersonbporto,项目名称:programacao_internet_2015_1,代码行数:30,代码来源:process.php

示例6: session_start

*/
include_once "display_cart.php";
include_once "table.php";
include_once "Catalog/catalog.php";
include_once "customer.php";
session_start();
?>
<html>
<head>
<title>Cart</title>
</head>
<body>
<p>
<?php 
if (isset($_SESSION['cart'])) {
    // pick up the old cart if there is one, else get a new one
    $cart = $_SESSION['cart'];
    echo "<b>Your cart:</b><br/><br/>";
    display_cart($cart);
    display_customer_form();
} else {
    echo "Cart not found </br>";
}
?>

<p>
<a href="welcome.php">Home</a>

</body>
</html>
开发者ID:psagi,项目名称:sdo,代码行数:30,代码来源:checkout.php

示例7: calculate_price

        $_SESSION['items'] = 0;
        $_SESSION['total_price'] = 0.0;
    }
    if (isset($_SESSION['cart'][$new])) {
        $_SESSION['cart'][$new]++;
    } else {
        $_SESSION['cart'][$new] = 1;
    }
    $_SESSION['total_price'] = calculate_price($_SESSION['cart']);
    $_SESSION['items'] = calculate_items($_SESSION['cart']);
}
if ($_POST['submit']) {
    foreach ($_SESSION['cart'] as $isbn => $qty) {
        if ($_POST[$isbn] == '0') {
            unset($_SESSION['cart'][$isbn]);
        } else {
            $_SESSION['cart'][$isbn] = $_POST[$isbn];
        }
    }
    $_SESSION['total_price'] = calculate_price($_SESSION['cart']);
    $_SESSION['items'] = calculate_items($_SESSION['cart']);
}
do_html_header("购物车");
do_html_top();
if ($_SESSION['cart'] && array_count_values($_SESSION['cart'])) {
    display_cart($_SESSION['cart'], true);
    display_button('checkout.php', '结算');
} else {
    echo "还没有商品添加到购物车";
}
do_html_footer();
开发者ID:jimlucn,项目名称:cart,代码行数:31,代码来源:show_cart.php

示例8: widget

 function widget($args, $instance)
 {
     extract($args);
     global $blog_id, $eshopoptions;
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $show = apply_filters('widget_text', $instance['show'], $instance);
     $showwhat = apply_filters('widget_text', $instance['showwhat'], $instance);
     $text = apply_filters('widget_text', $instance['text'], $instance);
     $items = apply_filters('widget_text', $instance['items'], $instance);
     $qty = apply_filters('widget_text', $instance['qty'], $instance);
     $total = apply_filters('widget_text', $instance['total'], $instance);
     //$fc=apply_filters( 'widget_text', $instance['fc'], $instance );
     //$fcimg=apply_filters( 'widget_text', $instance['fcimg'], $instance );
     $currsymbol = $eshopoptions['currency_symbol'];
     if (isset($_SESSION['eshopcart' . $blog_id])) {
         $eshopsize = 0;
         $eshopqty = 0;
         $thetotal = 0;
         if (isset($_SESSION['eshopcart' . $blog_id])) {
             $eshopsize = sizeof($_SESSION['eshopcart' . $blog_id]);
             foreach ($_SESSION['eshopcart' . $blog_id] as $eshopdo => $eshopwop) {
                 $eshopqty += $eshopwop['qty'];
             }
             if (isset($_SESSION['final_price' . $blog_id])) {
                 $thetotal = $_SESSION['final_price' . $blog_id];
             }
             $eshoptotal = sprintf(__('%1$s%2$s', 'eshop'), $currsymbol, number_format_i18n($_SESSION['final_price' . $blog_id], __('2', 'eshop')));
             if ($showwhat == 'full') {
                 $eecho = '<div class="eshopcartwidget"><div class="ajaxcart">' . display_cart($_SESSION['eshopcart' . $blog_id], false, $eshopoptions['checkout'], 'widget') . '';
                 $eecho .= '</div></div>';
             } else {
                 $any = 0;
                 $eecho = '<p class="eshopwidget">';
                 if (isset($items) & $items == '1') {
                     $eecho .= sprintf(_n('<span>%d</span> product in cart.', '<span>%d</span> products in cart.', $eshopsize, 'eshop'), $eshopsize);
                     $any++;
                 }
                 if (isset($qty) & $qty == '1') {
                     if ($any > 0) {
                         $eecho .= '<br />';
                     }
                     $eecho .= sprintf(_n('<span>%d</span> item in cart.', '<span>%d</span> items in cart.', $eshopqty, 'eshop'), $eshopqty);
                     $any++;
                 }
                 if (isset($total) & $total == '1') {
                     if ($any > 0) {
                         $eecho .= '<br />';
                     }
                     $eecho .= sprintf(__('<span>%s</span> cart total.', 'eshop'), $eshoptotal);
                 }
                 $eecho .= '<br /><a class="cartlink" href="' . get_permalink($eshopoptions['cart']) . '">' . __('View Cart', 'eshop') . '</a>';
                 $eecho .= '<br /><a class="checkoutlink" href="' . get_permalink($eshopoptions['checkout']) . '">' . __('Checkout', 'eshop') . '</a>';
                 $eecho .= '</p>';
             }
             echo $before_widget;
             echo $before_title . $title . $after_title;
             echo $eecho;
             echo $after_widget;
         }
     } elseif ($show != 'no') {
         $eecho = '';
         if ($showwhat == 'full') {
             $eecho .= '<div class="ajaxcart">';
         }
         $eecho .= '<div class="eshopcartwidget"><p>' . $text . '</p><p><a class="cartlink" href="' . get_permalink($eshopoptions['cart']) . '">' . __('View Cart', 'eshop') . '</a>';
         $eecho .= '<br /><a class="checkoutlink" href="' . get_permalink($eshopoptions['checkout']) . '">' . __('Checkout', 'eshop') . '</a></p></div>';
         if ($showwhat == 'full') {
             $eecho .= '</div>';
         }
         echo $before_widget;
         echo $before_title . $title . $after_title;
         echo $eecho;
         echo $after_widget;
     } else {
         if ($showwhat == 'full') {
             echo $before_widget;
             //echo $before_title.$title.$after_title;
             echo '<div class="eshopcartwidget"><div class="ajaxcart"></div></div>';
             echo $after_widget;
         }
     }
 }
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:82,代码来源:eshop-widget.php

示例9: eshop_show_cart

function eshop_show_cart()
{
    global $wpdb, $blog_id, $wp_query, $eshopoptions;
    $echo = '';
    include "cart-functions.php";
    //cache
    eshop_cache();
    if (isset($_SESSION['eshopcart' . $blog_id]['error'])) {
        $echo .= $_SESSION['eshopcart' . $blog_id]['error'];
        unset($_SESSION['eshopcart' . $blog_id]['error']);
    }
    if (isset($_SESSION['eshopcart' . $blog_id]['enote'])) {
        $echo .= $_SESSION['eshopcart' . $blog_id]['enote'];
        unset($_SESSION['eshopcart' . $blog_id]['enote']);
    }
    if (isset($_SESSION['eshopcart' . $blog_id])) {
        if (isset($wp_query->query_vars['eshopaction']) && urldecode($wp_query->query_vars['eshopaction']) == 'cancel' && !isset($_POST['save'])) {
            $echo .= "<h3>" . __('The order was cancelled.', 'eshop') . "</h3>";
            $echo .= '<p>' . __('We have not deleted the contents of your shopping cart in case you may want to edit its content.', 'eshop') . '</p>';
        }
        if ($eshopoptions['shop_page'] != '') {
            $return = get_permalink($eshopoptions['shop_page']);
        } elseif (isset($_SESSION['lastproduct' . $blog_id])) {
            $return = get_permalink($_SESSION['lastproduct' . $blog_id]);
        } else {
            $return = get_permalink($eshopoptions['cart']);
        }
        $echo .= display_cart($_SESSION['eshopcart' . $blog_id], 'true', $eshopoptions['checkout']);
        $echo .= '<ul class="continue-proceed eshopcp0"><li class="rtnshopping"><a href="' . $return . '">' . __('&laquo; Continue Shopping', 'eshop') . '</a></li>
		<li class="gotocheckout"><a href="' . get_permalink($eshopoptions['checkout']) . '">' . __('Proceed to Checkout &raquo;', 'eshop') . '</a></li></ul>';
    } else {
        //can be altered as desired.
        $echo .= '<p><strong class="eshoperror error">' . __('Your shopping cart is currently empty.', 'eshop') . '</strong></p>';
    }
    return $echo;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:36,代码来源:eshop-shortcodes.php

示例10: catch

$order_id = $_POST['orderid'];
?>
<html>
<title>
Status for order: <?php 
$order_id;
?>
</title>
<body>
<?php 
$order_processing = SCA::getService("../OrderProcessingService/OrderProcessingService.php");
try {
    $order = $order_processing->getOrder($order_id);
} catch (WarehouseOrderNotFoundException $e) {
    echo "<b>No order with order id {$order_id} was found</b><br/><br/>";
    echo '<p><a href="welcome.php">Home</a></p>';
    exit;
}
echo "<b>Order details: {$order_id}</b><br/><br/>";
display_cart($order);
echo "<b>Status:</b><br/><br/>";
$event_log = SCA::getService('../EventLogService/EventLogService.php');
$events = $event_log->getEvents($order_id);
display_events($events);
?>

<p><a href="welcome.php">Home</a></p>

</body>
</html>
开发者ID:psagi,项目名称:sdo,代码行数:30,代码来源:order_status.php

示例11: display_cart

		<meta http-equiv="Content-Type" content="text/html; charset= utf-8" />
		<title>Shopping Cart</title>
		<link rel="icon" type="image" href="images/cart.png" />
		
	</head>
	<body>
		<header id="heading">
				<!--img id="logo" src="images/1.png" height="65" width="140" />
				<h1>TheProgrammingNerd1</h1-->
		</header>
			<div id="main_div">
				<h3>Shopping Cart</h3>
					<div id="division">
								<section id="main_section">
									<?php 
display_cart();
?>
								
								</section>
								<aside id="side">
									<span class="your_cart">Your Cart</span>&nbsp;<br>
									<?php 
product();
?>
								
								</aside>
					</div>
			</div>
		
		
		</header>
开发者ID:shivampesitbng,项目名称:simplePHPcart,代码行数:31,代码来源:index.php


注:本文中的display_cart函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。