-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Private methods in Vanilo\Cart\Models\Cart #9
Comments
I don't know if I got you correct but as I understand, you have a special item that needs to have exactly 1 as quantity when it is in cart. As |
Thank you for the question. I do not know if I have explained it well. So I have a SKU in inventory. The SKU represents a item that is customisable (let say volume in this example). I do not know which volume the customer will pick. Let's say I have product SKU1 a customer comes into the shop selects he wants SKU1 with volume 1, subsequently he selected SKU1 with volume 2. The target of the logic is to add SKU1 with volume 1 to the cartItems as record 1 and add SKU1 with volume 2 as record 2. Keeping the logic of the code as it is now would add SKU1 volume 1 and SKU1 volume 2 as same record and just increment the quantity to 2 because they are the same product. I need to be able to adjust quantity of SKU1 volume 1 separately of the SKU1 volume 2 quantity in the cart. It is very strange requirement but it is what we need. Lastly, please consider also width of the volume range can be too great to just put it as a property of the item. I am open to suggestions, as I am not sure that this is the best solution, but it is the best solution I have come up with now. |
I would say in general it's the best to use different product entries for different products. SKU is "Stock Keeping Unit" so in case you have different volumes of the same product use different SKUs for them. A common practice is to use SKU suffxing eg. "skuxyz-1kg" skuxyz-5kg" or something like that. |
The methods are now protected on the master/1.0-dev branch. Use composer version |
No worries, thank you |
Vanilo Cart 0.5.1
I have a special type of product in database for which I need to insert the product into the cart from the
product.show
page as new item not to update the quantity every time I insert it like it is standard for inserting the same product. Therefore, I have extended theCart
model to modify theaddItem(Buyable $product, $qty = 1, $params = [])
. The only issue that I had implementing it that there are two methods that are private in theVanilo\Cart\Models\Cart
I just had to copy and paste them around from the parent class. Do you have a particular reason these methods are
private
please? Is it possible that the methods can beprotected
instead? Thank you for help.The text was updated successfully, but these errors were encountered: