• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_cart函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deleteItem

function deleteItem($itemId)
{
    $item = new Item($itemId);
    $cart = get_cart();
    $cart->deleteItem($item);
    update_cart($cart);
}
开发者ID:dpecos,项目名称:npshop,代码行数:7,代码来源:cart.php


示例2: updateData

function updateData($userOrig = null)
{
    global $errorMsg;
    $user = null;
    if ($userOrig == null) {
        $user = new User();
    } else {
        $user = new User($userOrig->email, $userOrig->password);
    }
    $objectVars = array_keys(get_object_vars($user));
    foreach ($_REQUEST as $key => $value) {
        if (NP_startsWith("user_", $key)) {
            $path = split("_", $key);
            $property = $path[1];
            if (in_array($property, $objectVars)) {
                if (is_array($user->{$property})) {
                    if (isset($_REQUEST['sameData']) && $_REQUEST['sameData'] == "true") {
                        if ($property == "billingData") {
                            $user->billingData = array_merge($user->billingData, array($path[2] => $value));
                            $user->shippingData = array_merge($user->shippingData, array($path[2] => $value));
                        }
                    } else {
                        $user->{$property} = array_merge($user->{$property}, array($path[2] => $value));
                    }
                } else {
                    $user->{$property} = $value;
                }
            }
        }
    }
    if (isset($_REQUEST['user_password']) && isset($_REQUEST['newPassword1']) && isset($_REQUEST['newPassword2']) && $_REQUEST['newPassword1'] == $_REQUEST['newPassword2']) {
        if ($user->password == $userOrig->password) {
            $user->password = $_REQUEST['newPassword1'];
            $cart = get_cart();
            $cart->user->update($user);
            update_cart($cart);
        } else {
            global $error;
            $errorMsg = _("El password antiguo no es correcto o los nuevos no coinciden.");
            return false;
        }
    } else {
        $cart = get_cart();
        $cart->user->update($user);
        update_cart($cart);
    }
    /*
        $cart = get_cart();
        print_r($cart->user);
    	$cart->user->update();
    */
    // reload data from DDBB
    $cart->user = new User($cart->user->email, $cart->user->password);
    update_cart($cart);
    return true;
}
开发者ID:dpecos,项目名称:npshop,代码行数:56,代码来源:personalData.php


示例3: testSumCart

 public function testSumCart()
 {
     empty_cart();
     $add_to_cart = array('content_id' => 1, 'qty' => 3, 'price' => 300);
     $cart_add = update_cart($add_to_cart);
     $cart_items = get_cart();
     $sum = cart_sum();
     $this->assertEquals($sum, 900);
     $this->assertEquals(isset($cart_add['success']), true);
     $this->assertEquals(!empty($cart_items), true);
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:11,代码来源:CartTest.php


示例4: get_cart_information

function get_cart_information($dbh, $values)
{
    $user_id = $values['user_id'];
    $cart = get_cart(array('user_id' => $user_id));
    //    $details = get_cart_details($dbh, $user_id);
    $cart['shipping_address_id'] = $cart['address_id'];
    //if comments were passed in, append those to the front of the cart comments
    $cart['comments'] = isset($values['comments']) ? $values['comments'] . $cart['comments'] : $cart['comments'];
    //convert values to integers that can be converted to integers
    return $cart;
}
开发者ID:c-topherl,项目名称:brewCom,代码行数:11,代码来源:submit_order.php


示例5: add_to_cart

/**
 * Add an item to the cart 
 * @param $dbname The name of the database (e.g. instance of Omeka)
 * @param $item_id The ID of the item
 * @return false|interger Returns the number of item in the user's cart, otherwhise false
 */
function add_to_cart($dbname, $item_id)
{
    if (isset($dbname) && isset($item_id) && ($user_id = get_connected_user_id())) {
        if (!is_in_cart($dbname, $item_id)) {
            $masterdb = get_master_db();
            $table_name = $masterdb->getConfig()['prefix'] . 'carts';
            $result = $masterdb->insert($table_name, array('user_id' => $user_id, 'dbname' => $dbname, 'item_id' => $item_id));
        }
        return count(get_cart());
    }
    return false;
}
开发者ID:kyfr59,项目名称:cg35,代码行数:18,代码来源:cg35.php


示例6: GetLandingPageContent

function GetLandingPageContent($dbh, $user_id)
{
    $query = "SELECT COUNT(*) count FROM cart_headers where user_id = :user_id";
    $sth = $dbh->prepare($query);
    if (!$sth->execute(array(":user_id" => $user_id))) {
        throw new Exception($sth->errorInfo()[2]);
    }
    $count = (int) $sth->fetch(PDO::FETCH_ASSOC)['count'];
    if ($count > 0) {
        //user has details in cart
        $landing_page = get_cart(array('user_id' => $user_id));
    } else {
        //user does not have cart_details, so return delivery options page
        $landing_page = get_delivery_options();
    }
    //merge user_id to top level of array
    $landing_page = array_merge($landing_page, array('user_id' => $user_id));
    return $landing_page;
}
开发者ID:c-topherl,项目名称:brewCom,代码行数:19,代码来源:verify_user.php


示例7: indexAction

 /**
  * This shows the cart details
  * 
  * @return void
  */
 public function indexAction()
 {
     if ($cart = get_cart()) {
         $db = array();
         $i = 0;
         foreach ($cart as $c) {
             if (!isset($db[$c['dbname']])) {
                 $db[$c['dbname']] = get_instance_db($c['dbname']);
             }
             // Title
             $table_name = $db[$c['dbname']]->getConfig()['prefix'] . 'element_texts';
             $sql = "SELECT text FROM {$table_name} WHERE record_id = " . $c['item_id'] . " AND element_id = 50";
             $items[$i]['text'] = utf8_encode($db[$c['dbname']]->fetchOne($sql));
             // Description
             $table_name = $db[$c['dbname']]->getConfig()['prefix'] . 'element_texts';
             $sql = "SELECT text FROM {$table_name} WHERE record_id = " . $c['item_id'] . " AND element_id = 41";
             $items[$i]['description'] = utf8_encode($db[$c['dbname']]->fetchOne($sql));
             // Date
             $table_name = $db[$c['dbname']]->getConfig()['prefix'] . 'element_texts';
             $sql = "SELECT text FROM {$table_name} WHERE record_id = " . $c['item_id'] . " AND element_id = 40";
             $items[$i]['date'] = utf8_encode($db[$c['dbname']]->fetchOne($sql));
             // Référence
             $table_name = $db[$c['dbname']]->getConfig()['prefix'] . 'element_texts';
             $sql = "SELECT text FROM {$table_name} WHERE record_id = " . $c['item_id'] . " AND element_id = 43";
             $items[$i]['reference'] = utf8_encode($db[$c['dbname']]->fetchOne($sql));
             $items[$i]['id'] = $c['id'];
             $items[$i]['item_id'] = $c['item_id'];
             $items[$i]['dbname'] = $c['dbname'];
             $items[$i]['note'] = $c['note'];
             $items[$i]['url'] = MASTER_URL . $db[$c['dbname']]->getConfig()['url'] . '/items/show/' . $c['item_id'];
             $items[$i]['name'] = $db[$c['dbname']]->getConfig()['name'];
             $i++;
         }
         $this->view->items = $items;
     } else {
         $this->view->empty = true;
     }
     $ariane['panier'] = null;
     $this->view->ariane = $ariane;
 }
开发者ID:kyfr59,项目名称:cg35,代码行数:45,代码来源:CartController.php


示例8: foreach





<?php 
if (isset($orders) and is_array($orders)) {
    ?>
                    <div class="ptab ptab-orders">
                    <h2 class="icon-section-title">Orders</h2>
                    <?php 
    foreach ($orders as $order) {
        ?>


                         <?php 
        $cart = get_cart('order_id=' . $order['id']);
        ?>
                         <?php 
        if (is_array($cart) and !empty($cart)) {
            ?>
<div class="mw-ui-box mw-ui-box-content my-order">
                                <span class="my-order-status">Status:
                                    <?php 
            if ($order['order_status'] == 'completed') {
                ?>
                                        <span class="my-order-status-completed">Completed</span>
                                    <?php 
            } else {
                ?>
                                        <span class="my-order-status-pending">Pending</span>
                                    <?php 
开发者ID:Staalkoper,项目名称:templates,代码行数:27,代码来源:profile.php


示例9: admin_url

</span>
                              <a href="<?php 
            print admin_url();
            ?>
view:shop/action:orders#vieworder=<?php 
            print $item['id'];
            ?>
" class="mw-ui-btn unselectable"><span class="mw-icon-cart"></span><?php 
            _e("Go to order");
            ?>
</a>
                            </div>
                        </div>
                          <div class="mw-ui-box-content mw-accordion-content">
                            <?php 
            $cart_items = get_cart('order_completed=any&order_id=' . $item['id'] . '&no_session_id=1');
            ?>
                            <?php 
            if (is_array($cart_items)) {
                ?>
                            <table cellspacing="0" cellpadding="0" class="mw-ui-table mw-ui-table-basic client-order-table" width="100%">
                              <thead>
                                <tr>
                                  <th></th>
                                  <th><?php 
                _e("Product Name");
                ?>
</th>
                                  <th><?php 
                _e("Price");
                ?>
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:client_inner.php


示例10: get_cart

        <?php 
    }
    ?>

     <?php 
    if (get_option('shop_require_registration', 'website') == 'y' and is_logged() == false) {
        ?>
        <?php 
        include THIS_TEMPLATE_DIR . "signin.php";
        ?>
     <?php 
    } else {
        ?>

        <?php 
        $thecart = get_cart();
        if ($thecart != false) {
            ?>
        <div class="mw-ui-row shipping-and-payment">
            <div class="mw-ui-col" style="width: 33%;">
                <div class="mw-ui-col-container">
                    <div class="well">
                        <?php 
            $user = get_user();
            ?>
                        <h2 style="margin-top:0 " class="edit nodrop" field="checkout_personal_inforomation_title"
                            rel="global" rel_id="<?php 
            print $params['id'];
            ?>
"><?php 
            _e("Personal Information");
开发者ID:Staalkoper,项目名称:templates,代码行数:31,代码来源:default.php


示例11: update_user_total

            if ($action == "update") {
                if (isset($_GET["username"]) && isset($_GET["hours"])) {
                    $username = $_GET["username"];
                    $hours = $_GET["hours"];
                    update_user_total($username, $hours);
                    update_order_total();
                } else {
                    echo json_encode(array("message" => "Error: missing username parameter."));
                }
            } else {
                if ($action == "clear") {
                    clear_cart();
                    update_order_total();
                } else {
                    if ($action == "get") {
                        get_cart();
                    }
                }
            }
        }
    }
}
/**
 * Function to return all cart info - order total and products (selected users/developers)
 */
function get_cart()
{
    if (count($_SESSION["cart"]["products"]) == 0) {
        echo json_encode(array("message" => "Your cart is empty."));
    } else {
        echo json_encode($_SESSION);
开发者ID:sergiowoj,项目名称:developer-shop,代码行数:31,代码来源:cart.php


示例12: cart_logic

<?php

$cart = cart_logic(get_cart());
$products = $pages->find('products')->children()->visible();
snippet('header');
?>

<?php 
if (count($cart) == 0) {
    ?>

<main id="cart" class="main black" role="main">
	<div class="text">
		<h1>Votre panier est vide.</h1>
		<a class="btn-white" href="<?php 
    echo url('products');
    ?>
">Voir les produits</a>
	</div>
</main>

<?php 
} else {
    ?>

<main id="cart" class="main" role="main">
	<div class="text">
		<h1><?php 
    echo $page->title()->html();
    ?>
</h1>
开发者ID:starckio,项目名称:Cartkit,代码行数:31,代码来源:cart.php


示例13: get_option

<script>mw.require("tools.js", true);</script>
<script>mw.require("shop.js", true);</script>

<?php 
$template = get_option('data-template', $params['id']);
$template_css_prefix = '';
$template_file = false;
$module_template = false;
if ($template != false and strtolower($template) != 'none') {
    $template_css_prefix = no_ext($template);
    $template_file = module_templates($params['type'], $template);
} else {
    if ($template == false and isset($params['template'])) {
        $module_template = $params['template'];
        $template_file = module_templates($params['type'], $module_template);
    } else {
        $template_file = module_templates($params['type'], 'default');
    }
}
$sid = mw()->user_manager->session_id();
if ($sid == '') {
    // //session_start();
}
$cart = array();
$cart['session_id'] = mw()->user_manager->session_id();
$cart['order_completed'] = 0;
$data = get_cart($cart);
if (is_file($template_file) and !isset($params['hide-cart'])) {
    include $template_file;
}
开发者ID:minhkiller,项目名称:microweber,代码行数:30,代码来源:index.php


示例14: get_cart

<?php

require_once "npshop/skin.php";
$cart = get_cart();
?>
<html><head><title><?php 
echo _("David Benavente. Estudio de bonsái");
?>
</title>
<link rel=stylesheet href="<?php 
echo SKIN_ROOT;
?>
include/estilos.css"> 
			<script language="javascript">
			<!--
			function doRedirect(myObject) {
			 	if (myObject.options[myObject.selectedIndex].value!="") { 
					top.location.href=myObject.options[myObject.selectedIndex].value; 
				}	else {
					return false;
				}
			}			
            function doPayment() {
                payment = document.getElementById("payment_method");
                top.location.href = "payment.php?method=" + payment.value;
            }
			// -->
			</script>
<script>
    <?php 
include_once 'include/javascript.php';
开发者ID:dpecos,项目名称:npshop,代码行数:31,代码来源:confirmarCompra.php


示例15: TPV_printForm

    function TPV_printForm()
    {
        global $npshop, $_SERVER_DATA;
        $cart = get_cart();
        $tpv = $npshop['tpv'];
        $scriptURL = dirname(dirname($_SERVER["PHP_SELF"]));
        $amount = $cart->getTotal(1) * 100;
        // format: MMDDxxxxxxSS"
        $orderId = date("md") . sprintf("%06d", $cart->orderId) . date("s");
        $signature = __signature($amount, $orderId, $tpv['code'], $tpv['currency'], $tpv['key']);
        ?>
    	<form id="npshop_form" action="<?php 
        echo $tpv['url'];
        ?>
" method="POST">
    		<input type="hidden" name="DS_Merchant_Amount" value="<?php 
        echo $amount;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_Currency" value="<?php 
        echo $tpv['currency'];
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_Order" value="<?php 
        echo $orderId;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_ProductDescription" value="<?php 
        echo $tpv['productDescription'] . " " . $orderId;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_Titular" value="<?php 
        echo $tpv['name'];
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_MerchantCode" value="<?php 
        echo $tpv['code'];
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_Terminal" value="<?php 
        echo $tpv['terminal'];
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_MerchantSignature" value="<?php 
        echo $signature;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_MerchantURL" value="http://<?php 
        echo $_SERVER["HTTP_HOST"] . $scriptURL;
        ?>
/common/modules/payment/TPV_cajamadrid.php?LANG=<?php 
        echo NP_LANG;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_URLOK" value="http://<?php 
        echo $_SERVER["HTTP_HOST"] . $scriptURL;
        ?>
/flows/payment.php?result=ok&LANG=<?php 
        echo NP_LANG;
        ?>
"/>
    		<input type="hidden" name="DS_Merchant_URLKO" value="http://<?php 
        echo $_SERVER["HTTP_HOST"] . $scriptURL;
        ?>
/flows/payment.php?result=error&LANG=<?php 
        echo NP_LANG;
        ?>
"/> 
    		<input type="hidden" name="DS_Merchant_MerchantData" value="<?php 
        echo $cart->orderId;
        ?>
"/> 
    		<input type="hidden" name="DS_Merchant_ConsumerLanguage" value="<?php 
        echo NP_LANG === "es_ES" ? "001" : "002";
        ?>
"/>
    		<!-- 
    		    Castellano-001, Inglés-002, Catalán-003,
                Francés-004, Alemán-005, Holandés-006,
                Italiano-007, Sueco-008, Portugués-009,
                Valenciano-010, Polaco-011, Gallego-012 y
                Euskera-013.
            -->
    	</form>
<?php 
    }
开发者ID:dpecos,项目名称:npshop,代码行数:86,代码来源:TPV_cajamadrid.php


示例16: count

                <div class="content">
                    <a href="http://archives.ille-et-vilaine.fr/fr" target="_blank">ARCHIVES ET PATRIMOINE D'ILLE-VILAINE</a>
                    <p class="right">
                        
                        <?php 
if (get_connected_user_id()) {
    ?>
                            <a href="<?php 
    echo MASTER_URL;
    ?>
/guest-user/user/update-account" class="account">MON COMPTE</a>
                            <a href="<?php 
    echo MASTER_URL;
    ?>
/cart" class="cart">MON PANIER<span id="cart"><?php 
    echo count(get_cart());
    ?>
</span></a>
                            <a href="<?php 
    echo MASTER_URL;
    ?>
/users/logout" class="logout">DECONNEXION</a>
                        <?php 
} else {
    ?>
    
                            <a href="<?php 
    echo MASTER_URL;
    ?>
/users/login" class="connexion">CONNEXION</a>
                            <a href="<?php 
开发者ID:kyfr59,项目名称:cg35,代码行数:31,代码来源:header.php


示例17: switch

switch ($function) {
    case 'add_cart_header':
        include_once __DIR__ . '/orders/add_cart.php';
        add_cart_header($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Cart header created successfully.';
        break;
    case 'add_cart_detail':
        include_once __DIR__ . '/orders/add_cart.php';
        add_cart_detail($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Cart detail added successfully.';
        break;
    case 'get_cart':
        include_once __DIR__ . '/orders/get_cart.php';
        $responseArray['response'] = get_cart($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Here is your cart';
        break;
    case 'update_cart_header':
        include_once __DIR__ . '/orders/update_cart.php';
        $responseArray['response'] = update_cart_header($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Cart successfully updated';
        break;
    case 'delete_cart':
        include_once __DIR__ . '/orders/delete_cart.php';
        $responseArray['response'] = delete_cart($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Successfully deleted cart';
        break;
开发者ID:c-topherl,项目名称:brewCom,代码行数:31,代码来源:order_controller.php


示例18: _e

        print $recart_base . '?recart=' . $item['session_id'];
        ?>
" target="_blank"><?php 
        _e("Recover");
        ?>
</a>
            </div>
          </td>
      </tr>

    </tbody>
  </table><?php 
    }
    ?>
    <?php 
    $abandoned_carts = get_cart('count=1&no_session_id=true&order_completed=0&group_by=session_id');
    $completed_carts = get_orders('count=1&order_completed=1');
    ?>
  <script>mw.lib.require("morris");</script> 
  <script>
      $(document).ready(function(){
         mw.on.moduleReload("<?php 
    print $params['id'];
    ?>
", function(){
             OrdersChart = Morris.Donut({
                element: 'orders_stat',
                data: [
                  {label: "Completed Carts", value: <?php 
    print intval($completed_carts);
    ?>
开发者ID:minhkiller,项目名称:microweber,代码行数:31,代码来源:index.php


示例19: output_html5_header

<?php

require_once 'lib/lib.php';
require_once 'lib/dblibs.php';
output_html5_header('Shopping Cart', array("bootstrap/css/bootstrap.css", "bootstrap/css/bootstrap-theme.css", "css/style.css"), array("js/jquery.min.js", "bootstrap/js/bootstrap.min.js", "js/carousel.js"));
if (array_key_exists('loggedin', $_SESSION)) {
    output_page_menu();
    db_connect();
    $user_id = db_get_user_id($_SESSION['loggedin']);
    $cart = get_cart($user_id);
    ?>

<?php 
    ?>
<h1>Shopping Cart</h1>
<div class="row">
<table class="table table-hover cart_table">
	<thead>
		<th>Product</th>
		<th></th>
		<th>Price</th>
		<th>Quantity</th>
	</thead>
	<tbody>
	<?php 
    $i = 0;
    $s = 's';
    $subtotal = 0;
    if ($cart != NULL) {
        $i = 0;
        $s = 's';
开发者ID:Naisargi1,项目名称:YarnStore,代码行数:31,代码来源:cart_page.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_cart_goods函数代码示例发布时间:2022-05-15
下一篇:
PHP get_carp_status函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap