Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tricky attributes code for display in cart contents


Al66

Recommended Posts

Hi,

 

Does anyone know how to insert a colon (:) in between the name of an attribute and its value where these are displayed on the shopping cart contents page?

 

Does that make sense? Basically, the attribute and its value (that the user has selected) should be separated by a colon as it is displayed in cart contents -but it isn't. The exact same info IS displayed separated by a colon on all the subsequent checkout confirmation pages -just not the cart contents page.

 

I'm assuming it has to go somewhere in here (in shopping_cart.php):

 

<?php

if ($cart->count_contents() > 0) {

?>

<tr>

<td><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

$any_out_of_stock = 0;

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

// Push all attributes information in an array

if (isset($products[$i]['attributes'])) {

while (list($option, $value) = each($products[$i]['attributes'])) {

// dogu 2003-02-28 hidden fields are used later

// 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 = '" . $products[$i]['id'] . "'

and pa.options_id = '" . $option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $value . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

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

$attributes_values = tep_db_fetch_array($attributes);

 

// dogu 2003-02-28 BEGIN determine if attribute is a text attribute and assign to $attr_value temporarily

if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {

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

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

} else {

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

$attr_value = $attributes_values['products_options_values_name'];

}

// dogu 2003-02-28 END determine if attribute is a text attribute

 

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

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

// dogu 2003-02-28 assign $attr_value

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

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

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

}

}

}

 

require(DIR_WS_MODULES. 'order_details.php');

?>

 

Can anyone solve this conundrum for me -my PHP isn't up to the job! :(

 

Thanks

Alastair

Link to comment
Share on other sites

In catalog/includes/modules/order_details.php,

look for

// Product options names

 

and within that

 

go to the line

 

echo '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

 

the space after ['products_options_name'] . ' is where you put your colon.

 

 

Hope that helps.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...