If you could be a little clearer about the requirements that would help...
You mention "main package", "main pack", "extra packs", "addons", "main item", storing main items and addons as items...its very confusing.
Mainly, is "pack" and "package" the same thing? I don't know if a package consists of packs or if pack is just short for package...
Anyways, I'll assume the following:
1. A buyer orders 1 main package along with 0 to many extra packages,
and 0 to many addons.
There is no difference between a "main" package and an "extra" package
aside from the fact that extra packages are optional and a main package is
required.
There is 1 universal set of addons for any order...in other words, packages do not have their own unique set of addons. So for example, a buyer would not select addon(s) for package A, then select addon(s) for package B... instead he would simply just select from a list of addons that is the same no matter
what package(s) are included in the order.
"so in this case how the order table structure should be in your opinion?"
Packages
package_id
package_name
package_price
...etc
Addons
addon_id
addon_name
addon_price
...etc
Orders
order_id
package_id (id of the main/required package)
date_created
...etc
Orders2ExtraPackages (contains orders' extra packages)
order_id
package_id (id of an extra package)
Orders2Addons (contains orders' addons)
order_id
addon_id
"if you would store each addon and main item as a different item on the order, then how the script should know if that row is a main or addon or extra?"
I would probably end up using the table structure above, which would make it obvious in any script which items are which. Otherwise though, your idea of having a column to distinguish them is a common technique and is probably good enough. Maybe you could set the column type to enum('main','extra','addon') so
you don't have to remember what 1,2 and 3 stand for.