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


PHP get_cart函数代码示例

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


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


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