Closed pveyes closed 10 years ago
Hi,
You could use a custom implementation of the storage driver and inject that into the Cary object. Then sort your items in there and return that to the Cart object.
Take a look at the data method in bye storage drivers.
Sent from my iPhone
On 31 Dec 2013, at 04:10 pm, Fatih Kalifa notifications@github.com wrote:
Is there any way to sort cart items based on item property? In the current implementation, sorting is based on insert time (identifier). Is there any way I could change this behavior?
— Reply to this email directly or view it on GitHubhttps://github.com/moltin/laravel-cart/issues/9 .
Hi,
Thanks for the tips. I'm from CI and in CI to extend a function I just create Extended Class and it will automatically overwrite the old function
As in Laravel, this is implemented using Service Provider. So should I just create my custom Service Provider implementing new Storage driver and then give them alias in app/config/app.php
or is there better way I could implement this?
The service provider approach is probably the best approach for this. Just use your own service provider and implement your own storage driver.
P.S: Sorry for the late response.
I'm going to close this for now. I'll reopen it if we decide to implement sorting in the future.
Is there any way to sort cart items based on item property? In the current implementation, sorting is based on insert time (identifier). Is there any way I could change this behavior?