moltin / cart

Shopping cart composer package
Other
110 stars 62 forks source link

framework implement #3

Closed aliuygur closed 11 years ago

aliuygur commented 11 years ago

how can i implement this library to laravel 4 framework

chrisnharvey commented 11 years ago

Hi there,

If you add "moltin/cart" to your composer.json file, then run "composer update" you will then be able to instantiate the cart.

You can also add it to the Laravel 4 IoC container to make the cart class a singleton. http://laravel.com/docs/ioc#basic-usage

Let me know if there is anything else I can help you with.

dcolumbus commented 11 years ago

Because the Facade isn't working for me, I'm trying to use the Cart with an IoC container, but when I try a "composer update", I get this:

{"error":{"type":"ErrorException","message":"Argument 1 passed to Moltin\Cart\Cart::__construct() must be an instance of Moltin\Cart\StorageInterface, instance of Illuminate\Foundation\Application given, called in \/Applications\/MAMP\/htdocs\/blanketid\/bootstrap\/compiled.php on line 4121 and defined","file":"\/Applications\/MAMP\/htdocs\/myapp\/vendor\/moltin\/cart\/src\/Moltin\/Cart\/Cart.php","line":48}}Script php artisan clear-compiled handling the pre-update-cmd event returned with an error

chrisnharvey commented 11 years ago

This should now be resolved as of my latest commits to moltin/cart and moltin/laravel-cart

cautapchung100 commented 10 years ago

when I composer update ? error Problem 1 - Installation request for moltin/laravel-cart dev-master -> satisfiable by moltin/laravel-cart[dev-master]. - moltin/laravel-cart dev-master requires moltin/cart dev-master -> no matching package found. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see for more details. Read for further common problems. I just have added the requirement in the composer.json file as the tutorial says

... "require": { "laravel/framework": "4.1.*", "intervention/image": "dev-master", "moltin/laravel-cart": "dev-master" }, ... Could anybody tell me how to fix it?

chrisnharvey commented 10 years ago

What is the minimum stability set to in your composer.json file?

Sent from my iPhone

On 5 Feb 2014, at 08:52 am, cautapchung100 notifications@github.com wrote:

when I composer update ? error Problem 1 - Installation request for moltin/laravel-cart dev-master -> satisfiable by moltin/laravel-cart[dev-master]. - moltin/laravel-cart dev-master requires moltin/cart dev-master -> no matching package found. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see for more details. Read for further common problems. I just have added the requirement in the composer.json file as the tutorial says

... "require": { "laravel/framework": "4.1.*", "intervention/image": "dev-master", "moltin/laravel-cart": "dev-master" }, ... Could anybody tell me how to fix it?

Reply to this email directly or view it on GitHubhttps://github.com/moltin/cart/issues/3#issuecomment-34147484 .

cautapchung100 commented 10 years ago

Thanks for your help! I found my error and i fixed it ! => "minimum-stability": "dev" ! thanks

chrisnharvey commented 10 years ago

Great! No problem. v1 of this package will be released very soon. So the current development version is probably not going to change between now and then so you should be good to use this package in production.

thecodecafe commented 10 years ago

Please where do i put this am new to laravel so it could help if your tutorial is a bit more detailing thanks

use Moltin\Cart\Cart; use Moltin\Cart\Storage\Session; use Moltin\Cart\Identifier\Cookie;

$cart = new Cart(new Session, new Cookie);

chrisnharvey commented 10 years ago

Please see the moltin/laravel-cart package/repository. This includes the ServiceProvider and Facade you need to easily implement this package into Laravel. The readme also contains documentation on how to get it working.

Hope this helps. On 14 Mar 2014, at 09:21 am, mrbarde notifications@github.com wrote:

Please where do i put this am new to laravel so it could help if your tutorial is a bit more detailing thanks

use Moltin\Cart\Cart; use Moltin\Cart\Storage\Session; use Moltin\Cart\Identifier\Cookie;

$cart = new Cart(new Session, new Cookie);

— Reply to this email directly or view it on GitHub.

thecodecafe commented 10 years ago

Chris Harvey you're a great guy, thank alot!