Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Return totals for Multiple Rows in orders_products ?


jbretel

Recommended Posts

Posted

Hi all,

 

I have the following problem that I'm hoping someone with greater coding ability than me can assist with.

 

I have an additional field in orders_products called package_number (this is because we send out multiple packets and need to identify which product went out in each package number 1, 2 etc).

 

And I need to find the total value of each package (where it contains multiple products and quantities of products).

 

so:

 

I would reallly like to build an array returning the following values

 

Totals:

 

Package 1 - £14.92

Package 2 - £54.58

Package 3 - £225.69

 

 

Where the (abridged) orders_products table entries are as follow (sorry the numbers should line up below the headings - but I can't build a table)

orders_products_id / orders_id / products_id / final_price / products_quantity / package_number

 

12457 / 158623 / 156 / 14.52 / 1 / 1

12458 / 158623 / 123 / 2.45 / 2 / 2

12459 / 158623 / 2158 / 18 / 1 / 2

12460 / 158623 / 15342 / 2.45 / 2 / 2

12461 / 158623 / 65 / 13.39 / 2 / 2

12642 / 158623 / 857 / 46.25 / 1 / 3

12643 / 158623 / 468 / 179.44 / 1 / 3

 

I've been trolling the PHP forums and php.org but have not really made much progress (last 4 days) so am resorting to posting here (I'm not a help vamp - really !) - in the hope that someone will be kind enought to give me a heads-up !!

 

Many thanks,

 

Jeremy

Archived

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

×
×
  • Create New...