Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

case 'update_product', case 'add_product' :


tedbooks

Recommended Posts

Posted

can anyone dummy down the part of application top that is here mainly regarding how the attributes are added

and how do i make the attribute array if i can get the option_value_id and option_id from table orders_products_attributes.

i know i can add these two fields to the table and populate it when the order is made

i hope

        case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
                               if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
                                 $cart->remove($HTTP_POST_VARS['products_id'][$i]);
                               } else {
                                 if (PHP_VERSION < 4) {
                                   // if PHP3, make correction for lack of multidimensional array.
                                   reset($HTTP_POST_VARS);
                                   while (list($key, $value) = each($HTTP_POST_VARS)) {
                                     if (is_array($value)) {
                                       while (list($key2, $value2) = each($value)) {
                                         if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
                                           $id2[$var[1]][$var[2]] = $value2;
                                         }
                                       }
                                     }
                                   }
                                   $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
                                 } else {
                                   $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
                                 }
                                 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // customer adds a product from the products page
     case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
//rmh M-S_select begin
                               if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                 $nothing_selected = false;

                                 $products_options_available_query = tep_db_query("select distinct popt.products_options_id 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 order by popt.products_options_id");
                                 while ($products_options_name = tep_db_fetch_array($products_options_available_query)) {
                                   if (!tep_not_null($HTTP_POST_VARS['id'][$products_options_name['products_options_id']])) {
                                     $nothing_selected = true;
                                   }
                                 }     $nothing_selected = false;
                               if ($nothing_selected == true) {
                                   tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'attrib_error=1&products_id=' . $HTTP_GET_VARS['products_id']));
                                 } else {
                                   $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']); //rmh price-schedule
                                 }
                               } else {
                                 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']); //rmh price-schedule
                               }
//rmh M-S_select end
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // performed by the 'buy now' button in product listings and review page
;

Archived

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

×
×
  • Create New...