Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change attributes in shopping cart


sopinon

Recommended Posts

Hi all,

 

is it possible, to allow customers changing product attributes in the shopping cart?

(without deleting the product first, go back to product overview, select an other attribute and put the product in the cart again...)

 

It would be great, if the attributes in the cart are also represented with a drop down list. So the customers can select an other attribute an checkout directly...

 

Are there some contributions existing for this claim?

Link to comment
Share on other sites

  • 2 weeks later...
i've solved it by myself...

 

Here is the Contribution for it:

http://www.oscommerce.com/community/contributions,4890

 

Good contribution.

 

Only one problem. If you have items that have no attributes they can't be added to the shopping cart. Any ideas anyone on a solution because this is a brilliant contri that just needs to have a small tweak somwhere?.

 

Andy

Link to comment
Share on other sites

Good contribution.

 

Only one problem. If you have items that have no attributes they can't be added to the shopping cart. Any ideas anyone on a solution because this is a brilliant contri that just needs to have a small tweak somwhere?.

 

Andy

 

 

Just seen the problem.

 

Instructions (edited) are:

 

STEP 1: Find in shopping_cart.php following lines:

##################################################

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . (int)$products[$i]['id'] . "'

and pa.options_id = '" . (int)$option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . (int)$value . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . (int)$languages_id . "'

and poval.language_id = '" . (int)$languages_id . "'");

$attributes_values = tep_db_fetch_array($attributes);

 

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['options_values_id'] = $value;

$products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];

$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];

##################

replace them with:

##################

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, poval.products_options_values_id, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . (int)$products[$i]['id'] . "'

and pa.options_id = '" . (int)$option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . (int)$languages_id . "'

and poval.language_id = '" . (int)$languages_id . "'");

 

$products[$i][$option]['form_name'] = 'id[' . $products[$i]['id'] . '][' . $option . ']';

$products[$i][$option]['selected_id'] = $value;

 

while($attributes_values = tep_db_fetch_array($attributes)){

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['products_options_values_name'][] = array('id' => $attributes_values['products_options_values_id'], 'text' => $attributes_values['products_options_values_name']);

$products[$i][$option]['options_values_price'][] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'][] = $attributes_values['price_prefix'];

}

 

 

BUT SHOULD BE:

 

STEP 1: Find in shopping_cart.php following lines:

##################################################

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . (int)$products[$i]['id'] . "'

and pa.options_id = '" . (int)$option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . (int)$value . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . (int)$languages_id . "'

and poval.language_id = '" . (int)$languages_id . "'");

$attributes_values = tep_db_fetch_array($attributes);

 

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['options_values_id'] = $value;

$products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];

$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];

##################

replace them with:

##################

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, poval.products_options_values_id, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . (int)$products[$i]['id'] . "'

and pa.options_id = '" . (int)$option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . (int)$languages_id . "'

and poval.language_id = '" . (int)$languages_id . "'");

 

$products[$i][$option]['form_name'] = 'id[' . $products[$i]['id'] . '][' . $option . ']';

$products[$i][$option]['selected_id'] = $value;

 

while($attributes_values = tep_db_fetch_array($attributes)){

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['products_options_values_name'][] = array('id' => $attributes_values['products_options_values_id'], 'text' => $attributes_values['products_options_values_name']);

$products[$i][$option]['options_values_price'][] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'][] = $attributes_values['price_prefix'];

}

 

 

 

Andy

Link to comment
Share on other sites

  • 3 months later...

I absolutely LOVE the drop down attribute menu contribution. I've only found one problem. I have the My Wishlist v1.03 contribution installed on my site and noticed when a product gets added to the wishlist and then gets moved over to the cart, the attribute menus do not show when viewing the shopping cart contents. If a product is added directly to the cart from the product info page, then the menus show up fine and work beautifully. Does anyone know how to fix this? Both contributions are great works-I just need them to work together. :) Thanks in advance.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...