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


PHP Cart::setQuantity方法代码示例

本文整理汇总了PHP中Cart::setQuantity方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::setQuantity方法的具体用法?PHP Cart::setQuantity怎么用?PHP Cart::setQuantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cart的用法示例。


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

示例1: getCart

 public function getCart()
 {
     $carts = array();
     $res = mysql_query("SELECT *,cart.id AS cid FROM cart INNER JOIN food ON cart.food_id=food.id WHERE user_id='" . $_SESSION['user'] . "'");
     if (mysql_num_rows($res) > 0) {
         while ($userRow = mysql_fetch_array($res)) {
             $cart = new Cart();
             $cart->setId($userRow['cid']);
             $cart->setFood($userRow['food']);
             $cart->setPrice($userRow['price']);
             $cart->setQuantity($userRow['quantity']);
             $cart->setFood_id($userRow['food_id']);
             $carts[] = $cart;
         }
     }
     return $carts;
 }
开发者ID:harjotsingh3878,项目名称:JustBite,代码行数:17,代码来源:processcart.php

示例2: doModifyCart

 /**
  * this section is required 
  * to modify items
  */
 public function doModifyCart()
 {
     $basket = new Cart();
     $basket->getContents();
     $newQty = $_POST['newQty'];
     //preg_replace is required to clean up the url variable to numeric value
     $prodID = $_POST['pid'];
     $prodPrice = $_POST['price'];
     $basket->setQuantity($prodID, $newQty, $prodPrice);
     //sets the quantity of the item given the product id and quantity to change
 }
开发者ID:runningjack,项目名称:RobertJohnson,代码行数:15,代码来源:stockin.php

示例3: Cart

    $foods = $processitem->getFoodFromIndex($_GET['home_search']);
} else {
    if (isset($_GET['search'])) {
        $foods = $processitem->getFoodFromFilters($_GET['search']);
    } else {
        if (isset($_GET['input-search'])) {
            $foods = $processitem->getFoodFromSearchBox($_GET['input-search']);
        } else {
            $foods = $processitem->getFood();
        }
    }
}
if (isset($_GET['cart'])) {
    $cart = new Cart();
    $cart->setFood_id($_GET['cart']);
    $cart->setQuantity('1');
    $processitem->addToCart($cart);
}
?>
						
	
	<section>
		<div class="container">
			<div class="row">
				<div class="col-sm-3">
					<div class="left-sidebar">
						<h2>Category</h2>
						<div class="panel-group category-products" id="accordian"><!--category-productsr-->
							<div class="panel panel-default">
								<div class="panel-heading">
									<h4 class="panel-title">
开发者ID:harjotsingh3878,项目名称:JustBite,代码行数:31,代码来源:productList.php

示例4: testShouldTotalPriceForAllItems

 function testShouldTotalPriceForAllItems()
 {
     $cart = new Cart();
     $cart->add(1, 10);
     $cart->add(2, 5);
     $cart->setQuantity(1, 10);
     // $100 worth of item 1
     $cart->setQuantity(2, 5);
     // $25 worth of item 2
     $this->assertEquals(125, $cart->totalPrice(), 'it totals price for all items');
 }
开发者ID:metator,项目名称:cart,代码行数:11,代码来源:CartTest.php

示例5: getQuantity

 public function getQuantity($food_id)
 {
     $cart = new Cart();
     $res2 = mysql_query("SELECT * FROM cart WHERE food_id='" . $food_id . "' AND user_id='" . $_SESSION['user'] . "'");
     while ($userRow2 = mysql_fetch_array($res2)) {
         $cart->setQuantity($userRow2['quantity']);
     }
     return $cart;
 }
开发者ID:harjotsingh3878,项目名称:JustBite,代码行数:9,代码来源:processitems.php

示例6: Foods

    $review->setRday($rday);
    $review->setRtime($rtime);
    $msg = $processitems->addReview($review);
}
if (isset($_GET['id'])) {
    $food = new Foods();
    $food->setId($_GET['id']);
    $objs = $processitems->getProduct($food);
    $f = $objs[0];
    $s = $objs[1];
    $r = $objs[2];
} else {
    if (isset($_POST['id'])) {
        $c = new Cart();
        $c->setFood_id(mysql_real_escape_string($_POST['id']));
        $c->setQuantity(mysql_real_escape_string($_POST['quantity']));
        $processitems->addToCart($c);
    } else {
        header("Location: productList.php");
    }
}
?>

	
	<section>
		<div class="container">
			<?php 
if ($msg == 1) {
    ?>
							<div class="alert alert-success">
							  <strong>Oh Sanp!</strong> Error while updating data.
开发者ID:harjotsingh3878,项目名称:JustBite,代码行数:31,代码来源:product.php


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