Skip to content
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

[Inventory] Decrease quantity of items when order is paid #5935

Merged
merged 6 commits into from
Sep 6, 2016

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Aug 31, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Related tickets #5870
License MIT

{
$indexOfVariant = $product->getVariants()->indexOf($variant);
$product->getVariants()->get($indexOfVariant)->setTracked(true);
$product->getVariants()->get($indexOfVariant)->setOnHand($quantity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use already existing transformer to obtain specific variant of a specific product. Then we can simply do:

$variant->setTracted(true);
$variant->setOnHand($quantity);

@GSadee GSadee force-pushed the decrease-quantity branch 3 times, most recently from 3f124e9 to 804c13d Compare August 31, 2016 10:46
*/
public function theCustomerBoughtSeveralProducts($quantity, ProductInterface $product)
{
$this->addProductVariantToOrder($this->variantResolver->getVariant($product), $product->getPrice(), $quantity);
$variant = $this->variantResolver->getVariant($product);
$this->addProductVariantToOrder($variant, $product->getPrice(), $quantity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$product->getPrice() -> $variant->getPrice()

@michalmarcinkowski michalmarcinkowski merged commit c2de8d8 into Sylius:master Sep 6, 2016
@michalmarcinkowski
Copy link
Contributor

Thank you Ania and Grzegorz! Please apply my comments in a separate PR.

And the product "T-shirt banana" has "Yellow" variant priced at "€20.54"
And the product "T-shirt banana" has "Green" variant priced at "€5.54"
And there are 5 items of "Yellow" variant of product "T-shirt banana" available in the inventory
And there are 5 items of "Green" variant of product "T-shirt banana" available in the inventory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...there are 5 units items... (see #5934)

@GSadee GSadee deleted the decrease-quantity branch September 22, 2017 08:26
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
[Inventory] Decrease quantity of items when order is paid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants