M
M
Mikhail Shatilov2015-08-10 15:53:57
opencart
Mikhail Shatilov, 2015-08-10 15:53:57

How to implement kits correctly?

There was a task to implement a system of kits (cheaper together). In the admin panel, the admin can add several related products to the product, there can only be 2 elements in the bundle: the product itself and the discounted product.
A pair is stored in the system in the session: the key of the product and the quantity (options are still possible).
I came up with 2 solutions myself:
1. Rewrite the $this->cart logic where everything will be "measured" by containers. For example, the user added an iphone to the cart, a container with a product and quantity is added to $this->cart. Then the user adds a set. A container with 2 products is added to $this->cart with a mark that this is a set.
Pros: no confusion if you add items from the kit not together (go to the cards and add each one separately).
Cons: complex implementation and rewriting of the standard operation of the basket, which is fraught if you need to connect a third-party module.
2. Add, as usual, a product with a note in the options that this is a kit with a link to additional. item in the cart.
Pros: easy implementation.
Cons: plus point 1. goes into minus; not convenient output in the basket and other places of order output.
I don't really like both solutions
. Solutions of modules that can be found in Google are also not suitable (there is a recalculation of the order amount), because you need to organize the output in this form:.
bmooKv3tY4P7my.png
I would be grateful if the community would suggest an idea.
ps System: Opencart 1.5.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Shatilov, 2015-08-11
@iproger

I decided to make a 3rd option, combining the 2 previous ones. There is $this->cart, there will also be $this->kits, in the baskets at the beginning there will be an output of simple goods, then sets, the amount will be calculated based on 2 values.
Pros: medium complexity implementation. No rewriting of standard logic.
Cons: average flexibility.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question