コード例 #1
0
ファイル: CartService.php プロジェクト: hwaunhwan/acashop
 /**
  * Delete the entire shopping cart
  * @throws Exception
  */
 public function nixCart()
 {
     $cartId = $this->getCartId();
     $this->db->delete('aca_cart_product', array('cart_id' => $cartId));
     $this->db->delete('aca_cart', array('cart_id' => $cartId));
     //create a new black cart
     //        $this->getCartId();
 }
コード例 #2
0
 /**
  * Determine if a given address is used elsewhere and remove it if it isn't
  * @param int $addressId
  */
 public function checkIfAddressUsed($addressId)
 {
     // If original address ID existed, check for it being used elsewhere
     if ($addressId != 0) {
         $query = '
             SELECT
               id
             FROM
               aca_user
             WHERE
               shipping_address_id= :addressId
               OR billing_address_id= :addressId';
         $data = $this->db->fetchRowMany($query, array('addressId' => $addressId));
         // If the address isn't used elsewhere, remove it
         if (empty($data)) {
             $this->db->delete('aca_address', array('id' => $addressId));
         }
     }
 }
コード例 #3
0
ファイル: CartService.php プロジェクト: sameg14/acashop-fall
 /**
  * Delete a shopping cart. Because SRP
  * @see https://en.wikipedia.org/wiki/Single_responsibility_principle
  * @throws \Exception
  */
 public function nixCart()
 {
     $cartId = $this->getCartId();
     $this->db->delete('aca_cart_product', array('cart_id' => $cartId));
     $this->db->delete('aca_cart', array('id' => $cartId));
 }
コード例 #4
0
ファイル: CartService.php プロジェクト: jkrusinski/acashop
 /**
  * Deletes an item from the cart.
  * @param int $cartProductID
  * @return bool
  * @throws \Simplon\Mysql\MysqlException
  */
 public function removeProductFromCart($cartProductID)
 {
     return $this->db->delete('aca_cart_product', array('id' => $cartProductID));
 }
コード例 #5
0
ファイル: CartService.php プロジェクト: jorions/acashop
 /**
  * Delete a shopping cart
  * @throws \Exception
  */
 public function removeCart()
 {
     // Delete order from cart
     $this->db->delete('aca_cart_product', array('cart_id' => $this->cartId));
     $this->db->delete('aca_cart', array('id' => $this->cartId));
 }