public function CartTable::removeFromCart in Basic cart 8
Same name and namespace in other branches
- 8.6 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
- 8.0 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
- 8.2 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
- 8.3 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
- 8.4 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
- 8.5 src/CartTable.php \Drupal\basic_cart\CartTable::removeFromCart()
* Callback function for cart/remove/. * *
Parameters
int $nid: * We are using the node id to remove the node in the shopping cart
Overrides CartInterface::removeFromCart
File
- src/
CartTable.php, line 54
Class
- CartTable
- Class CartTable.
Namespace
Drupal\basic_cartCode
public function removeFromCart($nid) {
$nid = (int) $nid;
if ($nid > 0) {
$param['id'] = $nid;
$param['uid'] = $this->user_id;
$entity = $_SESSION['basic_cart']['cart'][$nid];
$param['entitytype'] = $entity
->getEntityTypeId();
$this->cart_storage
->delete($param);
unset($_SESSION['basic_cart']['cart'][$nid]);
unset($_SESSION['basic_cart']['cart_quantity'][$nid]);
}
}