本文整理汇总了PHP中Cart::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::remove方法的具体用法?PHP Cart::remove怎么用?PHP Cart::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart
的用法示例。
在下文中一共展示了Cart::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShouldRemoveFromQuantity
function testShouldRemoveFromQuantity()
{
$cart = new Cart();
$cart->add(5);
$cart->remove(5);
$this->assertEquals(0, $cart->quantity(5), 'should remove from quantity');
}
示例2: removeCart
public function removeCart($image_id)
{
$row = Cart::search(array('id' => $image_id));
if ($row) {
//print_r($row);exit;
Cart::remove($row[0]);
}
return Redirect::route('order-cart');
}
示例3: testCartCanRemove
public function testCartCanRemove()
{
Cart::add(1, 'test', 1, 10.0, array('size' => 'L'));
Cart::add(2, 'test', 1, 10.0, array('size' => 'L'));
$rowId = Cart::content()->first()->rowid;
Cart::remove($rowId);
$this->assertEquals(Cart::count(), 1);
$this->assertNull(Cart::get($rowId));
$this->assertInstanceOf('Gloudemans\\Shoppingcart\\CartCollection', Cart::content());
}
示例4: dropItem
public function dropItem()
{
if (Request::ajax()) {
$id = Input::get('id');
$cart = Cart::get($id);
Cart::remove($id);
$count = Cart::count();
$total = Cart::total();
return Response::json(array('type' => 'success', 'id' => $cart->id, 'count' => $count, 'total' => $total));
}
}
示例5: ajaxCartRemove
public function ajaxCartRemove()
{
Cart::remove(Input::get('idRow'));
$cartContentObj = Cart::content();
$cartContentArr = [];
$cartCount = Cart::count();
foreach ($cartContentObj as $item) {
$item->options['thumbnail'] = $item->ware->thumbnail;
$item->options['slug'] = $item->ware->slug;
$cartContentArr[] = $item;
}
return compact('cartContentArr', 'cartCount');
}
示例6: borrarProducto
public static function borrarProducto($input)
{
$respuesta = array();
$reglas = array('id' => array('integer'));
$validator = Validator::make($input, $reglas);
if ($validator->fails()) {
$respuesta['mensaje'] = $validator;
$respuesta['error'] = true;
} else {
if (is_null(Session::get('carrito'))) {
Carrito::agregar($input);
}
$producto = Producto::find($input['producto_id']);
$carrito = Carrito::find(Session::get('carrito'));
$datos[$producto->id] = array('fecha_baja' => date("Y-m-d H:i:s"), 'estado' => 'B');
$carrito->productos()->sync($datos, false);
Cart::remove($input['rowId']);
$respuesta['mensaje'] = 'Producto carrito borrado.';
$respuesta['error'] = false;
$respuesta['data'] = $carrito;
}
}
示例7: remove
function remove()
{
// Removing all cart itens
$carItem = $this->cart[0]["Id"];
$objItemCart = new Cart($this->bd);
$objItemCart->remove($this->sessKey);
}
示例8: minusCart
public function minusCart($deal_id)
{
$cart = \Cart::get($deal_id);
$newQuantity = --$cart->quantity;
if ($newQuantity <= 0) {
\Cart::remove($deal_id);
} else {
\Cart::update($deal_id, ['quantity' => $newQuantity]);
}
return redirect('/gio-hang');
}
示例9: deleteItemGaji
public function deleteItemGaji($rowId, $id)
{
Cart::remove($rowId);
$url = URL::action("MasterKaryawanController@addGaji", ['id' => $id]) . "#datatable";
return Redirect::to($url);
}
示例10: action_remove_cart_item
public function action_remove_cart_item($uid = false)
{
$item = \Cart::item($uid);
if ($item) {
if ($unique_id = $item->get('unique_id')) {
// Set artwork for delete
if ($artworks = \Order\Model_Artwork::find(array('where' => array('unique_id' => $unique_id)))) {
foreach ($artworks as $artwork) {
$artwork->deleted_at = time();
$artwork->save();
}
}
}
\Cart::remove($uid);
\Messages::success('Product successfully deleted from cart.');
} else {
\Messages::error('There was an error while trying to delete product from cart.');
}
\Response::redirect(\Uri::create('order/checkout/cost'));
}
示例11: function
});
Route::post('/product/{id?}/deletecart', function () {
if (Request::ajax()) {
$product_id = Request::get('id');
//Cart::remove($product_id);
//Cart::clear();
$cartData = Cart::getContent();
return $cartData->toArray();
} else {
return "not ajax";
}
});
Route::post('/product/deletecart', function () {
if (Request::ajax()) {
$product_id = Request::get('id');
Cart::remove($product_id);
//Cart::clear();
$cartData = Cart::getContent();
return $cartData->toJson();
} else {
return "not ajax";
}
});
Route::post('product/add_to_cart', function () {
if (Request::ajax()) {
$i = 0;
$data = Input::all();
//return $data[];
//dd($fonts);
foreach ($data['dataArr'] as $val) {
echo $val['color'];
示例12: postSearch
public function postSearch($item = "")
{
if (Request::ajax()) {
if (isset($_POST['buypid'])) {
$optionprice = $name = DB::table('products_options')->where('product_id', $_POST['buypid'])->where("option_value", $_POST['buyoption'])->pluck('price');
return $optionprice;
exit;
}
if (isset($_POST['pid'])) {
$item = Product::find($_POST['pid']);
Cart::add(array('id' => $item->id, 'name' => $item->title, 'qty' => 1, 'price' => $item->price, 'options' => array('size' => Input::get("size"), 'buying' => Input::get('buying'), 'volume' => Input::get("volume"), 'optionid' => Input::get("optid"), 'weight' => Input::get("weight"))));
$content = Cart::content();
Session::put("cartItems", $content);
$total = Cart::total();
$itemHtml = "";
$itemHtml .= "<div class='beta-select'><i class='fa fa-shopping-cart'></i><span id='cart-count'> Cart (" . Cart::count() . ")</span> <i class='fa fa-chevron-down'></i></div>\n <div class='beta-dropdown cart-body'>";
if ($content) {
foreach ($content as $itemRow) {
$product = Product::find($itemRow->id);
if ($itemRow->options->has('buying') && $itemRow->options->buying != "") {
$itemRow->price = DB::table('products_options')->where("product_option_value_id", $itemRow->optionid)->pluck('price');
}
if (public_path()) {
$source_folder = public_path() . '/uploads/images/';
$destination_folder = public_path() . '/uploads/images/';
} else {
$source_folder = '/home/medicalng/public_html/uploads/images/';
$destination_folder = '/home/medicalng/public_html/uploads/images/';
}
$image_info = pathinfo($source_folder . $product->image);
$image_extension = strtolower($image_info["extension"]);
//image extension
$image_name_only = strtolower($image_info["filename"]);
//file name only, no extension
$imgName = $image_name_only . "-50x50" . "." . $image_extension;
$itemHtml .= "<div class='cart-item'>\n <!--<a class='cart-item-edit' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-pencil'></i></a>-->\n <a class='cart-item-delete' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-times'></i></a>\n <div class='media'>\n <a class='pull-left' href=\"javascript:void(0);\"><img src='" . url() . "/uploads/images/thumbs/{$imgName}' alt=''></a>\n <div class='media-body'>\n <span class='cart-item-title'>" . $itemRow->name . "</span>\n ";
$itemHtml .= "<span class='cart-item-options'>";
$itemHtml .= $itemRow->options->has('size') ? " - Size: " . $itemRow->options->size : '';
$itemHtml .= $itemRow->options->has('buying') ? " - Buying Option: " . $itemRow->options->buying : '';
$itemHtml .= $itemRow->options->has('volume') ? " - Volume: " . $itemRow->options->volume : '';
$itemHtml .= "</span>";
$itemHtml .= "\n <span class='cart-item-amount'>{$itemRow->qty}*<span>₦" . number_format($itemRow->price, 2, '.', ',') . "</span>\n </div>\n </div>\n </div>\n\n ";
}
$itemHtml .= "<div class='cart-caption'>\n <div class='cart-total text-right'>Subtotal: <span class='cart-total-value'>₦" . number_format($total, 2, ".", ",") . "</span></div>\n <div class='clearfix'></div>\n\n <div class='center'>\n <div class='space10'> </div>\n <a href='" . url() . "/cart' class='beta-btn primary text-center'>Checkout <i class='fa fa-chevron-right'></i></a>\n </div>\n </div>";
} else {
$itemHtml .= "Cart is empty";
}
$itemHtml .= "</div>";
echo $itemHtml;
}
if (isset($_POST['delid'])) {
//$item = Product::find($_POST['delid']);
Cart::remove($_POST['delid']);
//(array('id' => $item->id, 'name' => $item->title, 'qty' => 1, 'price' => $item->price));
$content = Cart::content();
Session::put("cartItems", $content);
$total = Cart::total();
$itemHtml = "";
$itemHtml .= "<div class='beta-select'><i class='fa fa-shopping-cart'></i><span id='cart-count'> Cart (" . Cart::count() . ")</span> <i class='fa fa-chevron-down'></i></div>\n <div class='beta-dropdown cart-body'>";
if ($content) {
foreach ($content as $itemRow) {
$product = Product::find($itemRow->id);
if ($itemRow->options->has('buying') && $itemRow->options->buying != "") {
$itemRow->price = DB::table('products_options')->where("product_option_value_id", $itemRow->optionid)->pluck('price');
}
$image_info = pathinfo($source_folder . $product->image);
$image_extension = strtolower($image_info["extension"]);
//image extension
$image_name_only = strtolower($image_info["filename"]);
//file name only, no extension
$imgName = $image_name_only . "-50x50" . "." . $image_extension;
$itemHtml .= "<div class='cart-item'>\n <!--<a class='cart-item-edit' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-pencil'></i></a>-->\n <a class='cart-item-delete' pid='" . $itemRow->rowid . "' href=\"javascript:void(0);\"><i class='fa fa-times'></i></a>\n <div class='media'>\n <a class='pull-left' href=\"javascript:void(0);\"><img src='" . url() . "/uploads/images/thumbs/{$imgName}' alt=''></a>\n <div class='media-body'>\n <span class='cart-item-title'>" . $itemRow->name . "</span>\n ";
$itemHtml .= "<span class='cart-item-options'>";
$itemHtml .= $itemRow->options->has('size') ? " - Size: " . $itemRow->options->size : '';
$itemHtml .= $itemRow->options->has('buying') ? " - Buying Option: " . $itemRow->options->buying : '';
$itemHtml .= $itemRow->options->has('volume') ? " - Volume: " . $itemRow->options->volume : '';
$itemHtml .= "</span>";
$itemHtml .= "\n <span class='cart-item-amount'>{$itemRow->qty}*<span>₦" . number_format($itemRow->price, 2, '.', ',') . "</span>\n </div>\n </div>\n </div>\n\n ";
}
$itemHtml .= "<div class='cart-caption'>\n <div class='cart-total text-right'>Subtotal: <span class='cart-total-value'>₦" . number_format($total, 2, ".", ",") . "</span></div>\n <div class='clearfix'></div>\n\n <div class='center'>\n <div class='space10'> </div>\n <a href='" . url() . "/cart' class='beta-btn primary text-center'>Checkout <i class='fa fa-chevron-right'></i></a>\n </div></div>";
} else {
$itemHtml .= "Cart is empty";
}
$itemHtml .= "</div>";
echo $itemHtml;
}
}
}
示例13: action_remove_cart_item
public function action_remove_cart_item($uid = false)
{
$item = \Cart::item($uid);
if ($item) {
if ($unique_id = $item->get('unique_id')) {
// Set artwork for delete
if ($artworks = \Order\Model_Artwork::find(array('where' => array('unique_id' => $unique_id)))) {
foreach ($artworks as $artwork) {
$artwork->set(array('deleted_at' => time()));
$artwork->save();
}
}
}
\Cart::remove($uid);
\Messages::success('Product successfully deleted from cart.');
} else {
\Messages::error('There was an error while trying to delete product from cart.');
}
echo \Messages::display();
}
示例14: removeToCart
public function removeToCart()
{
$product = Product::where('code', '=', Input::get('product'))->firstOrFail();
$rowId = Cart::search(array('id' => $product->code));
Cart::remove($rowId[0]);
Session::flash('message', 'Successfully ' . $product->name . ' deattached to the basket');
return Redirect::to('product');
}
示例15: removeItem
public function removeItem($rowid)
{
$rem = Cart::remove($rowid);
return Redirect::route('store.cart')->with('cartContent', Cart::content())->with('message', 'berhasil menghapus item dari keranjang');
}