Post by Mark Dyer » Tue Jun 05, 2007 2:55 am

I noticed today that when you view the order history as a customer logged in and when you have purchased 2 or more different options that the summary shows each of the options under each seperate of that item purchased if that makes sense. Example below.

1 x Acne Treatment                $49.90
- Size 45g/1.6oz (2 pack special)
- Size 45g/1.6oz

1 x Infant Eczema                    $99.95
- Size 500g/1lb2oz

1 x Acne Treatment              $29.90
- Size 45g/1.6oz (2 pack special)
- Size 45g/1.6oz
                                                     

User avatar
New member

Posts

Joined
Thu May 31, 2007 10:07 pm

Post by Mark Dyer » Tue Jun 05, 2007 3:34 am

Followup.
After looking at how the order_options are inserted into the database. there is not a link that links the product_options to a order_product_id.. The options are linked to a product which is sort of wrong.. If it's to be linked to a product it also needs to be linked to a order_product_id as a new field, so it doesn't look like a quick fix..  Any suggestions?

User avatar
New member

Posts

Joined
Thu May 31, 2007 10:07 pm

Post by Mark Dyer » Tue Jun 05, 2007 3:46 am

Part Fix: Add a new field to the order_option table called "order_product_id" INT 11

checkout_process.php around line 47 where you insert the order_product row add the following afterwards

$order_product_id = $database->insert_id();

Then where you loop adding the options replace with:

  if ($product['option']) {
    foreach ($product['option'] as $option) {
      $sql = "insert into order_option set order_id = '?', product_id = '?', order_product_id = '?', name = '?', `value` = '?', price = '?', prefix = '?'";
  $database->query($database->safe_query($sql, $insert_id, $product['product_id'], $order_product_id, $option['name'], $option['value'], $product['price'], $option['prefix']));
    }
  }


In account_invoice

change the select query around line 69 to

  $options = $database->rows("select * from order_option where order_id = '" . (int)$order_info['order_id'] . "' and order_product_id = '" . (int)$product['order_product_id'] . "'");


that will fix the public side, I presume admin has the same issue.

User avatar
New member

Posts

Joined
Thu May 31, 2007 10:07 pm

Post by Mark Dyer » Tue Jun 05, 2007 3:51 am

Admin Fix:

order.php line 284ish replace with

    $options = $database->rows("select * from order_option where order_id = '" . (int)$order_info['order_id'] . "' and order_product_id = '" . (int)$product['order_product_id'] . "'");

User avatar
New member

Posts

Joined
Thu May 31, 2007 10:07 pm
Who is online

Users browsing this forum: No registered users and 2 guests