PDA

View Full Version : Product Attributes - Option Type Feature



michael_s
04-21-2009, 10:00 AM
I can't take credit for this but user sirspongey sent me his code that fixed this issue and it worked perfectly for me as well. I also noticed that the same issue was occurring in the confirmation emails that went out...the fix for that is listed below as well.

In the paypal_standard.php file do the following:

SEARCH FOR (at about line 245):
$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
'products_options' => $attr_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);

REPLACE WITH:

// BOF Option Type Feature
$attr_name = $attributes_values['products_options_name'];

if ($attributes_values['products_options_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
$attr_name_sql_raw = 'SELECT po.products_options_name FROM ' .
TABLE_PRODUCTS_OPTIONS . ' po, ' .
TABLE_PRODUCTS_ATTRIBUTES . ' pa WHERE ' .
' pa.products_id="' . tep_get_prid($order->products[$i]['id']) . '" AND ' .
' pa.options_id="' . $order->products[$i]['attributes'][$j]['option_id'] . '" AND ' .
' pa.options_id=po.products_options_id AND ' .
' po.language_id="' . $languages_id . '" ';
$attr_name_sql = tep_db_query($attr_name_sql_raw);
if ($arr = tep_db_fetch_array($attr_name_sql)) {
$attr_name = $arr['products_options_name'];
}
}
//EOF Option Type Feature

$sql_data_array = array('orders_id' => $insert_id,
'orders_products_id' => $order_products_id,
// BOF Option Type Feature
//'products_options' => $attributes_values['products_options_name'],
//'products_options_values' => $attributes_values['products_options_values_name'],
'products_options' => $attr_name,
'products_options_values' => $order->products[$i]['attributes'][$j]['value'],
// EOF Option Type Feature
'options_values_price' => $attributes_values['options_values_price'],
'price_prefix' => $attributes_values['price_prefix']);
tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

SEARCH FOR in the "before_process()" also in paypal_standard.php:

$products_ordered_attributes .= "nt" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

REPLACE WITH:

//$products_ordered_attributes .= "nt" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
$products_ordered_attributes .= "nt" . $attributes_values['products_options_name'] . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);

More... (http://addons.oscommerce.com/info/160)