本文整理汇总了PHP中OrderItem::quantity方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItem::quantity方法的具体用法?PHP OrderItem::quantity怎么用?PHP OrderItem::quantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderItem
的用法示例。
在下文中一共展示了OrderItem::quantity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
function confirm()
{
//Generate a new basket item
$Item = new OrderItem();
$Basket = $this->_fetchBasket();
$Title = array();
foreach ($Basket['items'] as $Option) {
if ($Option->type == 'Style') {
$Item->image($Option->image);
}
$String = $Option->type . ': ' . $Option->title;
if (isset($Option->variant)) {
$String .= ' (' . $Option->variant . ')';
}
$Title[] = $String;
}
$Item->title('Custom Order');
$Item->subtitle(implode($Title, ' & '));
$Item->source('custom:' . substr(md5(time()), 0, 6));
$Item->quantity(1);
$Item->hidden(json_encode($this->basket));
$Item->price($Basket['total']);
$Item->addToOrder();
$this->clear();
redirect('/checkout/');
}
示例2: fromOrderItem
function fromOrderItem(OrderItem $Item)
{
$this->title = $Item->title();
$this->subtitle = $Item->subtitle();
$this->quantity = $Item->quantity();
$this->hidden = $Item->hidden();
$this->price = $Item->price();
$this->image = $Item->image();
list($Source, $ID) = $Item->source();
if ($Source == 'shop') {
$this->storeitem = $ID;
}
}
示例3: addtocart
function addtocart($ProductID)
{
//Generate a new basket item
$Item = new OrderItem();
$Product = new mStoreItem($ProductID);
$Item->title($Product->title);
$Item->source('shop:' . $Product->id());
$Item->subtitle($Product->description);
$Item->quantity(1);
$Item->image($Product->main_image()->filename);
$Item->hidden(json_encode($Product->_data));
$Item->price($Product->price);
$Item->addToOrder();
redirect('/checkout/');
}
示例4: addToOrder
function addToOrder(OrderItem $Item)
{
//Check the item doesnt exist?
$Exist = false;
foreach ($this->items as &$Existing) {
if ($Existing->source() == $Item->source()) {
$Exist = true;
$Existing->quantity($Existing->quantity() + $Item->quantity());
}
}
if (!$Exist) {
$this->items[] = $Item;
}
$this->_saveOrder();
}