I’ve recently taken a position for a company designing graphics and websites for them, however I seem to have hit a brick wall. We’re using Oscommerce to create an online store and my boss needs the dropdown menus for the product attributes to be displayed around a graphic and split into steps. There are several contributions out there, but I haven’t been able to find one that will do this or write my own. To give you a better idea of what I need, our store is located at iArtzStore and we want the product pages/checkout feature to be similar to MirrorMate : Mirror Frames.
Here is the code that brings up the dropdown menus :
<?php
$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 = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0" . " order by pov.products_options_values_name");
$list_of_prdcts_attributes_id = '';
$products_options = array(); // makes sure this array is empty again
while ($_products_options = tep_db_fetch_array($products_options_query)) {
$products_options[] = $_products_options;
$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}
if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {
$select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
$pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
while ($pag_array = tep_db_fetch_array($pag_query)) {
$cg_attr_prices[] = $pag_array;
}
// substitute options_values_price and prefix for those for the customer group (if available)
if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
for ($n = 0 ; $n < count($products_options); $n++) {
for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
}
} // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
}
} // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
} // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
for ($n = 0 ; $n < count($products_options); $n++) {
$products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
if ($products_options[$n]['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' ' . $products_options[$n][' '] . $currencies->display_price($products_options[$n][' '], tep_get_tax_rate($product_info['products_tax_class_id'])) .' ';
}
}
// EOF SPPC attributes mod
if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
?>
<tr>
<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
</tr>
<?php
}
?>
</table>





LinkBack URL
About LinkBacks






Bookmarks