Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Options


AndrewC

Recommended Posts

<?php

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

echo '<table border="0" cellpadding="0" cellspacing"0"><tr>';

 

$rows = 0;

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$rows++;

$cPath_new = tep_get_path($categories['categories_id']);

$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

 

if (($rows / 2) == floor($rows / 2)) {

$align = 'right';

}else {

$align = 'left';

}

 

echo '

<td align="'.$align.'" class="catholder" style="width: ' . $width . '" valign="top">

 

<table border="0" width="200" cellspacing="0" cellpadding="0">

<tr>

<td width="100%" height="14" class="menu-grey">? ' . $products_options_name['products_options_name'] . '</td>

</tr>

<tr>

<td class="menu-darkgrey">';

 

$selected = 0;

 

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

while ($products_options = tep_db_fetch_array($products_options_query)) {

echo '<input type="checkbox" name="id[' . $products_options_name['products_options_id'] . ']" value="'. $products_options['products_options_values_id'].'"> ' . $products_options['products_options_values_name'].

' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')<br> ';

}

 

 

echo '</td>

</tr></table></td>' . "\n";

if ((($rows / 2) == floor($rows / 2)) && ($rows != tep_db_num_rows($products_options_name_query)))

{

echo ' </tr>' . "\n";

echo ' <tr>' . "\n";

}

}

echo '</tr>

</table>

</div>';

}

?>

Link to comment
Share on other sites

Just for my info...

<?php 
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
echo '<table border="0" cellpadding="0" cellspacing"0"><tr>';

$rows = 0;
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$rows++;
$cPath_new = tep_get_path($categories['categories_id']);
$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

if (($rows / 2) == floor($rows / 2)) {
$align = 'right';
}else {
$align = 'left';
}

echo ' 
<td align="'.$align.'" class="catholder" style="width: ' . $width . '" valign="top">

<table border="0" width="200" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="14" class="menu-grey">? ' . $products_options_name['products_options_name'] . '</td>
</tr>
<tr>
<td class="menu-darkgrey">';

$selected = 0;

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
while ($products_options = tep_db_fetch_array($products_options_query)) {
echo '<input type="checkbox" name="id[' . $products_options_name['products_options_id'] . ']" value="'. $products_options['products_options_values_id'].'"> ' . $products_options['products_options_values_name'].
' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')<br> ';
}


echo '</td>
</tr></table></td>' . "\n";
if ((($rows / 2) == floor($rows / 2)) && ($rows != tep_db_num_rows($products_options_name_query))) 
{
echo ' </tr>' . "\n";
echo ' <tr>' . "\n";
}
}
echo '</tr>
</table>
</div>';
}
?>

--------------------------------

Link to comment
Share on other sites

Man i think u should improve the way you write the code..

 

But can i ask u something? this code is to show the checkboxes, which it works fine?

 

I think the problem is when you view the cart items, right?

 

peace,

--------------------------------

Link to comment
Share on other sites

Can u check in ur database if both options were added it, or only 1..

 

Maybe the mistake (i think) is viewing the added options, not entering them

 

peace,

--------------------------------

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...