Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

This is mental!


Guest

Recommended Posts

I have installed my shopping cart, put on some products and added payment modules. All seems ok, but no!

 

Has anyone else got this issue? (If you have not checked then check!)

 

I have put on a product that has an attribute set of +£50 surcharge, and the item is £175.

When I add it to basket it is £225, ok

I add another so the qty is 2 and its £450, ok.

Good so far!

There are only 2 in stock.

If i put in my shopping cart, qty 3 and update, it says Limited stock and takes it down to 2 again. Thats ok!

The problem is, the price goes back to £450 but the sub-total goes down to £350. Its seems to knock off the attributes.

 

I have looked around the forum and dont seem to be able to find anyone who has this issue. Please help me!

 

Thank you in advance for all of your help.

 

Ryan

Link to comment
Share on other sites

This forum is about as much use as an ashtray on a motorbike! I have found my answer on another site. If anyone is also stuck on this, here is the answer.

 

Attributes disappearing when quantity is updated in shopping cart.

 

I just tried to fix my shoping cart by using this contribution ..

And it works with the all option ecept the text field.

 

After that i use this code and it works in all case.

 

File

catalog/includes/classes/shopping_cart.php

Just replace this function

function update_quantity($products_id, $quantity = '', $attributes = '')

{

----

---

}

 

with this new

function update_quantity($products_id, $quantity = '', $attributes = '') {

global $customer_id;

if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true..

 

$this->contents[$products_id]['qty'] = $quantity;

// update database

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

// BOM - Options Catagories

$attr_value = NULL;

if ( !is_array($value) ) {

$this->contents[$products_id]['attributes'][$option] = $value;

$attr_value = $value;

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");

} elseif ( isset($attributes[$option]['t']) && !empty($attributes[$option]['t']) ) {

$this->contents[$products_id]['attributes'][$option] = $value;

$attr_value = htmlspecialchars(stripslashes($attributes[$option]['t']), ENT_QUOTES);

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");

} elseif ( isset($attributes[$option]['c']) ) {

$this->contents[$products_id]['attributes'][$option] = $value;

foreach ($value as $v) {

$attr_value = $v;

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");

}

}

// EOM - Options Catagories

}

}

}

 

Ryan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...