Esempio n. 1
0
                        continue;
                    }
                }
                if ($isExisted && !$productIds[$product->id]) {
                    $this->remove($product);
                } else {
                    if (!$isExisted && $productIds[$product->id]) {
                        $this->add($product);
                    }
                }
            } else {
                $this->remove($product);
            }
        }
        return true;
    }
    /**
     * Удалить все продукты из корзины покупателя
     * 
     * @return type 
     */
    public function drop()
    {
        return self::$db->query('DELETE FROM Basket WHERE personId=' . self::$db->escape_string($this->person->id));
    }
}
/**
 *  Описание таблицы в БД 
 */
Basket::setTable('Basket', array('id' => 'int', 'personId' => 'int', 'productId' => 'int'));