tedbooks Posted January 16, 2005 Posted January 16, 2005 i am trying to enable the customer to recreate an order so he can simply reorder it i found a contribution that does that but it is from ms1 and no support require(DIR_WS_CLASSES . 'order.php'); $restore_order = new order($oID); for ($i=0, $n=sizeof($restore_order->products); $i<$n; $i++) { $pID = $restore_order->products[$i]['id']; $qty = $restore_order->products[$i]['qty']; $attributes = array(); if ( (isset($restore_order->products[$i]['attributes'])) && (sizeof($restore_order->products[$i]['attributes']) > 0) ) { for ($j=0, $n2=sizeof($restore_order->products[$i]['attributes']); $j<$n2; $j++) { $attribute_options_id_query = tep_db_query("select products_options_name, products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $restore_order->products[$i]['attributes'][$j]['option'] . "'and language_id=1"); $attribute_options_id = tep_db_fetch_array($attribute_options_id_query); $soup.=','.$attribute_options_id['products_options_id']; $attribute_options_values_id_query = tep_db_query("select products_options_values_id ,products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_name = '" . $restore_order->products[$i]['attributes'][$j]['value'] . "'"); $attribute_options_values_id = tep_db_fetch_array($attribute_options_values_id_query); $soup.=','.$attribute_options_values_id['products_options_values_id']; $attributes[$attribute_options_id['products_options_name']] = '{' . $attribute_options_id['products_options_id'] . '}' . $attribute_options_values_id['products_options_values_id']; } } $cart->add_cart($pID, ($cart->get_quantity(tep_get_uprid($pID, $attributes))) + $qty, $attributes, false); } it creates the order but without the attributes. seems this line doesn't work $cart->add_cart($pID, ($cart->get_quantity(tep_get_uprid($pID, $attributes))) + $qty, $attributes, false); i have also tried to do it with tep_get_prid($pID))) but that don't work either i have echo $soup which i started to check and it gives me some numbers so i assume that sql queries are working but the cart function is not i have been looking at this file for hours now and cant figure it out but i am not a programmer so please help at least where i can look
tedbooks Posted January 17, 2005 Author Posted January 17, 2005 i have figured out that ($cart->get_quantity(tep_get_prid($pID)) is working since i get a- instead of the attribute and also that the last order is correctly found so i think i have to assume that it is not loading the attributes in the new order so either there is a problem with the array or the problem is with the use of $cart->add_cart any one with an idea of how to proceed ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.