Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Double attributes in confirmation email


Irin

Recommended Posts

Hello. I wonder if someone can help me find what's causing attributes to show twice in confirmation email. I'm using osc v.2.3.3, Tax Exempt and Organization Discounts and Option Types v2.1.3 add-ons. Below is the code from my checkout_process.php.

//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
 $attributes_exist = '1';
 for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
 if (DOWNLOAD_ENABLED == 'true') {
	 $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
						 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						 left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						 on pa.products_attributes_id=pad.products_attributes_id
						 where pa.products_id = '" . (int)$order->products[$i]['id'] . "'
						 and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "'
						 and pa.options_id = popt.products_options_id
						 and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_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 . "'";
	 $attributes = tep_db_query($attributes_query);
 } else {
	 $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)$order->products[$i]['id'] . "' and pa.options_id = '" . (int)$order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$order->products[$i]['attributes'][$j]['value_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 . "'");
 }
// BEGIN - Tax Exempt and Organization Discounts
 if (tep_db_num_rows($attributes)) {
// END - Tax Exempt and Organization Discounts
 $attributes_values = tep_db_fetch_array($attributes);
 $sql_data_array = array('orders_id' => $insert_id,
						 'orders_products_id' => $order_products_id,
						 'products_options' => $attributes_values['products_options_name'],
						 'products_options_values' => $order->products[$i]['attributes'][$j]['value'],
						 'options_values_price' => $attributes_values['options_values_price'],
						 'price_prefix' => $attributes_values['price_prefix']);
 tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
 if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
	 $sql_data_array = array('orders_id' => $insert_id,
							 'orders_products_id' => $order_products_id,
							 'orders_products_filename' => $attributes_values['products_attributes_filename'],
							 'download_maxdays' => $attributes_values['products_attributes_maxdays'],
							 'download_count' => $attributes_values['products_attributes_maxcount']);
	 tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
 }
 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);
// BEGIN - Tax Exempt and Organization Discounts
 }
 if ($order->products[$i]['attributes'][$j]['option_id'] = "organization_discount") {
 $sql_data_array = array('orders_id' => $insert_id,
						 'orders_products_id' => $order_products_id,
						 'products_options' => $order->products[$i]['attributes'][$j]['option'],
						 'products_options_values' => $order->products[$i]['attributes'][$j]['value'],
						 'options_values_price' => $order->products[$i]['attributes'][$j]['price'],
						 'price_prefix' => $order->products[$i]['attributes'][$j]['prefix']);
 tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
 }
// END - Tax Exempt and Organization Discounts
 }
}
//------insert customer choosen option eof ----
$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}

Thanks in advance.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...