Can any one point me in the correct direction?
The default way the shopping cart works is when you add an item to your shopping cart it just adds it. If you go back into the store and select the same item again it just updates the quantity in the shopping cart. This behavior is undesirable in my store as I have custom code that allows users to customize their items.
When a user customizes their items it counts as a "new" item as far as pricing goes. But because this is the same item in the shopping cart - zen cart just updates the quantity. Therefor giving them a discount that the customer no longers should receive.
I have tried editing the following.
in includes/classes/shopping_cart.php
changing
Code:
if ($this->in_cart($products_id)) {
to This was an attempt to force this if statement to be false - theoretically forcing a new item in the cart. However, this just failed to add a new item and failed to update the quantity.
I have also tried changing the line below it from
Code:
$this->update_quantity($products_id, $qty, $attributes);
to
Code:
add_cart($products_id, $qty, $attributes, $notify);
But, this just fails as it causes a weird loop and wasn't very smart of me.
I tried adding
Code:
$this->contents[] = array($products_id);
$this->contents[$products_id] = array('qty' => (float)$qty);
// insert into database
if (isset($_SESSION['customer_id'])) {
$sql = "insert into " . TABLE_CUSTOMERS_BASKET . "
(customers_id, products_id, customers_basket_quantity,
customers_basket_date_added)
values ('" . (int)$_SESSION['customer_id'] . "', '" . zen_db_input($products_id) . "', '" .
$qty . "', '" . date('Ymd') . "')";
$db->Execute($sql);
in the "true" side of
Code:
if ($this->in_cart($products_id)) {
But it just caused a white screen.
Not really sure where to go =[