Ejemplo n.º 1
0
function insert_cart_data()
{
    $cart = get_cart_data();
    $list = $cart['goods_list'];
    $total = $cart_goods['total'];
    $str = '';
    if ($list) {
        $total_price = 0;
        $str .= '<ul id="JS_header_cart" class="cartUL">';
        foreach ($list as $item) {
            if ($item['extension_code'] == 'package_buy') {
                $index = 1;
                foreach ($item['package_goods_list'] as $packitem) {
                    if ($index == 1) {
                        $img_src = get_goods_thumb($packitem['goods_id']);
                    }
                    $index = $index + 1;
                }
            } else {
                $img_src = $item['goods_thumb'] == '' ? 'themes/meilele/images/blank.gif' : $item['goods_thumb'];
            }
            $str .= '<li id="JS_cart_list_index_0">
              <div class="tImg"><a href="goods.php?id=' . $item['goods_id'] . '" target="_blank" title="' . $item['short_name'] . '"><img src="' . $img_src . '" alt="' . $item['short_name'] . '" height="86" width="86"></a></div>
              <div class="gInfo">
                <p class="gn"><a href="goods.php?id=' . $item['goods_id'] . '" target="_blank" title="' . $item['short_name'] . '">' . $item['short_name'] . '</a></p>
                <p class="gt"><strong class="Left"><span class="cl yen"><span id="JS_danjia0">' . $item['goods_price'] . '</span></span>×' . $item['goods_number'] . '</strong><a class="Right" href="javascript:drop_cart_goods(\'' . $item['rec_id'] . '\');" data-index="0" data-recid="9136371" data-num="1">删除</a></p>

              </div>
            </li>';
            $total_price = $total_price + $item['total_price'];
        }
        $total_price = price_format($total_price, false);
        $str .= '</ul>
				<div class="cartDiv clearfix">
            <p class="totaoFee">共<strong class="red f14" id="JS_num">' . insert_cart_count() . '</strong>件商品,共计<strong class="yen red num"><span id="JS_total">' . $total_price . '</span></strong></p>
            <div class="clearfix"><a class="toPay" href="flow.php">立刻购买</a></div>
          </div>';
    } else {
        $str = '<div class="loadLay" style="color:#626262;">您的购物车中还没有商品,先去选购吧!</div>';
    }
    return $str;
}
Ejemplo n.º 2
0
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo $page_title;
?>
</title>
    <meta charset="UTF-8">
</head>
<body>

<?php 
$cart = get_cart_data();
?>
<div>
    <h4><a href="./?action=cart">Корзина</a></h4>
    <?php 
echo $cart['quantity'];
?>
 товаров на сумму <?php 
echo $cart['cost'];
?>
р.
</div>

<div>
    <?php 
if (is_logged_in()) {
    ?>
        <p>Привет, <?php 
    echo $_SESSION['user']['name'];
Ejemplo n.º 3
0
<?php

include 'model.php';
include 'functions.php';
echo embed('tpl/home.tpl.php', array('header' => embed('tpl/header.tpl.php', array()), 'sidebar_first' => embed('tpl/category.tpl.php', array('result' => get_category())), 'body' => embed('tpl/cart.tpl.php', array('result' => get_cart_data())), 'sidebar_second' => embed('tpl/top_last_added.tpl.php', array('result' => last_added()))));