[Discussion] Best approach to handle bundle products/packages
Hello Guys, I was wondering what is the best way to create bundle of existing products. what approach do you follow. do you create a separate bundles table or you just handle everything in blade view or you just add new columns to the existing product table.
I create a bundle_product pivot table and put the price on the bundle table. No logic should be in blade files. To blade files you only send what it needs to display.
Hey @bugsysha .. thanks for your input but i am kinda confused .. can u plz elaborate more .. so you would have 1- product table .. 2- bundle table .. 3 - bundle-product table ?? .. what would be stored in the bundle table and the pivot one
We approach it slightly differently, our products table has a bunch of flags, one of which is can_be_bundled, we use that to apply a bundle discount to the product when it's added to the cart with something else.
Just as Snapey suggested, a "bundle" table with some fields such as description, price, discounts, etc relevant information will be enough, but I would probably use a json, array to store the list of product id in this bundle instead of a pivot table and "isBundle" flag in product table may and may not necessary, it depend on how you design it.