Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

hi i am trying to make two contributions to work with each other

restore order

attributes option type

there is a conflict between the two and when the cart is restored with the first contribution the attributes are not shown

here is a part of the code that gets the attributes in my account_history_info.php with modification for option type and it is working

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
   echo '          <tr>' . "\n" .
        '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
        '            <td class="main" valign="top">' . $order->products[$i]['name'];

   if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
     }
   }

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

and this is the part of the code that deals with attributes ib restore_order.php which gives me no value for attributes

 for ($i=0, $n=sizeof($restore_order->products); $i<$n; $i++) {
   $pID = $restore_order->products[$i]['id'];
$qty = $restore_order->products[$i]['qty'];

   $attributes = array();
   if ( (isset($restore_order->products[$i]['attributes'])) && (sizeof($restore_order->products[$i]['attributes']) > 0) ) {
     for ($j=0, $n2=sizeof($restore_order->products[$i]['attributes']); $j<$n2; $j++) {
       $attribute_options_id_query = tep_db_query("select products_options_name, products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $restore_order->products[$i]['attributes'][$j]['option'] . "'");
       $attribute_options_id = tep_db_fetch_array($attribute_options_id_query);

       $attribute_options_values_id_query = tep_db_query("select products_options_values_id ,products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_name = '" . $restore_order->products[$i]['attributes'][$j]['value'] . "'");
       $attribute_options_values_id = tep_db_fetch_array($attribute_options_values_id_query);

       $attributes[$attribute_options_id['products_options_name']] = '{' . $attribute_options_id['products_options_name'] . '}' . $attribute_options_values_id['products_options_values_name'];
     }
   }
   $cart->add_cart($pID, ($cart->get_quantity(tep_get_uprid($pID, $attributes))) + $qty, $attributes, false);

i know it is a long shot since both are pretty old contribution but they are beautiful work and if i could get this to work it would be great

thanks in advance for any help you can provide

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...