Git Product home page Git Product logo

basket's People

Contributors

arcadas avatar nwidart avatar philipbrown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basket's Issues

Basket info before reconsiling

It would be nice to have basket information about totals, subtotals, coupons etc. before beginning the reconciling process.

For instance for a current view of the basket, but before processing it to an order. Since there are already methods to get the taxrate and currency, more could be added ?

Basket::add() parameters problem

I do not understand why not use only a simple Product object as parameter instead of $sku, $name, $price, $action...

I store my all products in a database table and my API got a product ID from the frontend, find the product by ID, so I have a product record, in my case a Product eloquent object. I thought, that I wrap this eloquent object and create from it a new PhilipBrown\Basket\Product and add it to the basket. But I can not do this now.

public function add(Product $product)
{
    $this->products->add($product->sku, $product);
}

Have you any idea what is the best solution for my problem?

Thanks in advance!

Discounts

Loved your accompanying articles to this project. Very helpful.

I had a question about how you're handling discounts (and coupons).

At the moment, they are part of the Product object. How would you deal with a discount that should be applied to the basket and not directly related to a product. Something like "$10 off your entire order"?

Idea: Money Presenter

Hello,

Related to the following issue, would a Money presenter be a good idea ? Instead of returning Money\Money instance, returning a presenter from this package, as this would make the formatting easier.

The presenter could basically just have a __toString method

public function __toString()
{
    $formatter = new \NumberFormatter($jurisdiction->locale(), \NumberFormatter::CURRENCY);

    return $formatter->format($this->getAmount() / 100);
}

This would require the presence of a container though. Since we can't just instantiate UnitedKingdom or Belgium jurisdiction. But rather use the implementation bound to the Jurisdiction interface.

Thanks,

General questions concerning Basket

Hello,

This package is looking to be very clean, I'm considering using this package for an e-commerce application. I'm reading your blog on 'Creating a PHP Shopping Basket' which is very nice.

I've got some questions though about the usage in general of the package.

  1. Can products have additional meta data applied to them, and can some of those meta data needs to add an additional cost to the product?
  2. From what I see, and what's pretty nice, is that this package is not dependent on a persistence layer. Could this package be used on an event-sourced application ? (example app)
  3. For a more classical persistance approach, like Doctrine, how would you go about persisting the products, baskets and orders ?

Thank you,

Idea: Adding a basket->itemCount property

It might be nice to have a $basket->itemCount property on the basket class which would just contain the amount of products * their quantity.

At the moment we can only get $basket->products()->count(). But if a product is multiple times in the basket that wouldn't reflect the item count on the global basket.

Obviously both counts are useful.

Edit: I just found the $basket->count() method but which basically is a product count, not an item count.

Idea: Adding basket interface

What do you think of renaming Basket to DefaultBasket, adding a basket interface which is implemented by the DefaultBasket. This would allow binding that in the laravel's IoC container.

Adding same product to basket doesn't increment the product count

Steps:

  • Adding a product to basket
  • Adding that same product to basket again
  • When looping over the products in the basket, dd($product->quantity) is still 1.

I'm aware it can be done like so:

if ($this->productIsInBasket($sku)) {
    $this->basket->update($sku, function(Product $product) {
        $product->increment();
    });
} else {
    $this->basket->add($sku, $request->get('name'), $price);
}

But wouldn't it be easier of the add method can do this already.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.