Welcome Guest, Not a member yet? Register   Sign In
Alternative for CI cart library?
#1

Since CI cart library is going to be removed in future version. 

What would be a good up-to-date alternative that offer the basics like CI cart does. Not full blown ecommerece backend framework.
Reply
#2

(09-08-2016, 08:20 AM)codenoob Wrote: Since CI cart library is going to be removed in future version. 

What would be a good up-to-date alternative that offer the basics like CI cart does. Not full blown ecommerece backend framework.

https://github.com/Sylius/Cart
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply
#3

my brief cart lecture 101. A cart is responsible for only two things - the product ID and the quantity. Anything else - like price, product name, etc, can be stored in the cart but its for display only. Anytime the cart is refreshed, a product added to it, and during the final checkout - it should check the product database for the price and inventory.

Why? Because inventory changes all the time and products go out of stock. Prices change all the time up or down. If someone puts an item in their cart that the merchant does not have - it costs the merchant a lot of money in lost customer service time trying to change the order, and possibly losing the order. If a customer puts a product in their cart and comes back a week later to finally complete the order - and in the meanwhile the price of that product has gone up - the merchant loses money. Or if the product has gone down in price - and the customer finds out - the customer will be very angry, the merchant will lose customer service time, and possibly the sale.

Therefore - your cart is going to be very simple. It takes the product id and gets the product information from the product db table. This also means you never pass the price from the product page as part of the buy button. Because if you do that then anyone could create their own price for the products. And you want to have a separate db table that is holding the running totals for the shopping session - the product total, shipping total, tax total, grand total, sales, discounts, etc etc. Then things like shipping or tax can change based on the final destination, and the cart items stay the same.
Reply
#4

(This post was last modified: 09-08-2016, 02:17 PM by ivantcholakov. Edit Reason: grammar )

@codenoob

If CI_Cart gets removed, I suppose, in the future CI 3.2.x versions it could be brought back by you. You could take the last known code of this library (MIT license) and you can place it within your application/libraries/ Probably the class would need to be renamed CI_Cart -> Cart, but I am lazy to check this right now. You could do this when the time comes.

I don't expect something quite radical to happen in the architecture of CI3 in the future, probably porting forward of the deprecated libraries would be trivial. Also, rewriting this particular library for CI4 seems to be an easy task.
Reply
#5

A quick gotcha on carts if you are coding any sort of online shop.

You need to handle the fact that prices change over time for particular products.

If you are just linking to direct products in your orders, the historical information, over time, will become wrong.

When saving an order I save the product price and other details at the time of the order. This resolves this problem.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB