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


PHP Item::getPrice方法代码示例

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


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

示例1: isSatisfiedBy

 /**
  * Checks if Item price falls between bounds
  *
  * @param Item $item
  *
  * @return bool
  */
 public function isSatisfiedBy(Item $item)
 {
     if (!empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) {
         return false;
     }
     if (!empty($this->minPrice) && $item->getPrice() < $this->minPrice) {
         return false;
     }
     return true;
 }
开发者ID:boiler256,项目名称:DesignPatternsPHP,代码行数:17,代码来源:PriceSpecification.php

示例2: isSatisfiedBy

 public function isSatisfiedBy(Item $item) : bool
 {
     if ($this->maxPrice !== null && $item->getPrice() > $this->maxPrice) {
         return false;
     }
     if ($this->minPrice !== null && $item->getPrice() < $this->minPrice) {
         return false;
     }
     return true;
 }
开发者ID:paul-schulleri,项目名称:DesignPatternsPHP,代码行数:10,代码来源:PriceSpecification.php

示例3: test_accessors

 public function test_accessors()
 {
     /** === Test Data === */
     $STOCK_ITEM_REF = 'stock item ref';
     $PRICE = 'price';
     /** === Call and asserts  === */
     $this->obj->setStockItemRef($STOCK_ITEM_REF);
     $this->obj->setPrice($PRICE);
     $this->assertEquals($STOCK_ITEM_REF, $this->obj->getStockItemRef());
     $this->assertEquals($PRICE, $this->obj->getPrice());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_warehouse,代码行数:11,代码来源:Item_Test.php

示例4: canAddItem

 /**
  * Check whether Item can be added
  * 
  * @param Item $item
  * 
  * @return boolean
  */
 public function canAddItem(Item $item)
 {
     if ($this->getTotalPrice() + $item->getPrice() > $this->maxPricePerPackage) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:dermo666,项目名称:shippingCostExercise,代码行数:15,代码来源:Package.php

示例5: testSetGetPrice

 public function testSetGetPrice()
 {
     // Arrange
     $item = new Item();
     $item->setPrice(2.5);
     $expectedResult = 2.5;
     // Act
     $result = $item->getPrice();
     // Assert
     $this->assertEquals($result, $expectedResult);
 }
开发者ID:Owen66,项目名称:KBK-WebSite,代码行数:11,代码来源:ItemTest.php

示例6: create

 /**
  * @param Subcategory $subcategory
  * @param $name
  * @param $descr
  * @param $short_descr
  * @param $price
  * @param $stock
  * @return array
  * @throws Exception
  */
 public function create(Subcategory $subcategory, $name, $descr, $short_descr, $price, $stock)
 {
     $errors = array();
     $item = new Item($this->db);
     try {
         $item->setName($name);
         $item->setDescription($descr);
         $item->setShortDescription($short_descr);
         $item->setPrice($price);
         $item->setStock($stock);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (count($errors) == 0) {
         $name = $this->db->quote($item->getName());
         $description = $this->db->quote($item->getDescription());
         $shortDescription = $this->db->quote($item->getShortDescription());
         $price = $this->db->quote($item->getPrice());
         $stock = $this->db->quote($item->getStock());
         $query = "  INSERT INTO item(id_subcategory, name, descr, short_descr, price, stock)\n                               VALUES(" . $subcategory->getId() . ", " . $name . ", " . $description . ", " . $shortDescription . ", " . $price . ", " . $stock . ")";
         $data = $this->db->exec($query);
         if ($data) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 try {
                     return $this->findById($id);
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                     return $errors;
                 }
             } else {
                 throw new Exception('Last insert error');
             }
         } else {
             throw new Exception('Db error');
         }
     } else {
         return $errors;
     }
 }
开发者ID:CreepingPanda,项目名称:FennecPlusUltra,代码行数:50,代码来源:ItemManager.class.php

示例7: Item

<?php

// Start by assuming the transaction operations will all succeed
$success = TRUE;
// Give the POSTed item ID a friendly variable name
$itemID = filter_var($_POST['itemid'], FILTER_VALIDATE_INT);
//$participant = new Participant();
//$buyerID = $participant->getParticipantKey();
// Retrieve the item seller and price using some fictitious item class
$item = new Item();
$sellerID = $item->getItemOwner($itemID);
$price = $item->getPrice($itemID);
// Instantiate the mysqli class
$db = new mysqli("localhost", "website", "secret", "chapter37");
// Disable the autocommit feature
$db->autocommit(FALSE);
// Debit buyer's account
$stmt = $db->prepare("UPDATE participants SET cash = cash - ? WHERE id = ?");
$stmt->bind_param('di', $price, $buyerID);
$stmt->execute();
if ($db->affected_rows != 1) {
    $success = FALSE;
}
// Credit seller's account
$query = $db->prepare("UPDATE participants SET cash = cash + ? WHERE id = ?");
$stmt->bind_param('di', $price, $sellerID);
$stmt->execute();
if ($db->affected_rows != 1) {
    $success = FALSE;
}
// Update trunk item ownership. If it fails, set $success to FALSE
开发者ID:alannet,项目名称:example,代码行数:31,代码来源:listing37_1.php

示例8: Item

     break;
 case "getItemByName":
     $item = new Item();
     print json_encode($item->getItemByName($_POST["name"]));
     break;
 case "getItemByNameWithPrice":
     $item = new Item();
     print json_encode($item->getItemByNameWithPrice($_POST["idcustomer"], $_POST["name"]));
     break;
 case "getItemLowestCost":
     $item = new Item();
     print $item->getLowestCost($_POST["iditem"]);
     break;
 case "getItemPrice":
     $item = new Item();
     print $item->getPrice($_POST["idPriceList"], $_POST["iditem"]);
     break;
 case "getItemQuantity":
     $item = new Item();
     print $item->getQuantity($_POST["iditem"]);
     break;
 case "saveInventory":
     $item = new Item();
     $max = $_POST["max"];
     $items = array();
     for ($i = 0; $i <= $max; $i++) {
         if (isset($_POST["hidItem" . $i]) && $_POST["hidItem" . $i] != "") {
             //shouldn't be empty
             $items[] = array("iditem" => $_POST["hidItem" . $i], "itemName" => $_POST["txtItem" . $i], "system" => $_POST["hidSystem" . $i], "manual" => $_POST["txtManual" . $i], "virtualStock" => $_POST["virtualStock" . $i]);
         }
     }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:31,代码来源:ItemController.php

示例9: update

    public function update(Item $item)
    {
        $idCategory = $item->getCategory()->getId();
        $id = intval($id);
        $name = $this->db->quote($item->getName());
        $price = $this->db->quote($item->getPrice());
        $stock = $this->db->quote($item->getStock());
        $image = $this->db->quote($item->getImage());
        $description = $this->db->quote($item->getDescription());
        $query = '	UPDATE item
							SET name=' . $name . ',
								price=' . $price . ',
								stock=' . $stock . ',
								image=' . $image . ',
								description=' . $description . ',
								id_category=' . $idCategory . '
							WHERE id=' . $id;
        $res = $this->db->exec($query);
        if ($res) {
            $id = $this->db->lastInsertId();
            if ($id) {
                return $this->findByID($id);
            } else {
                throw new Exception('Internal server Error');
            }
        }
    }
开发者ID:dispxxx,项目名称:leshop,代码行数:27,代码来源:ItemManager.class.php

示例10: testDiscountTotalPriceOver10000

 public function testDiscountTotalPriceOver10000()
 {
     $item = new Item('RedBull', '240', '2011-07', '100');
     $number = 77;
     $item_price = $item->getPrice() * $number;
     $this->cart->addToCart($item, $number);
     $delivery_price = 0;
     $this->cart->setDeliveryType('hurry');
     $expected = $item_price + $delivery_price;
     $this->assertEquals($expected, $this->cart->getTotalPrice());
 }
开发者ID:nishigori,项目名称:tddbc_tokyo_1.7_for_PHP_testCode,代码行数:11,代码来源:ShoppingCartTest.php


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