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

[Order] Implementation of OrderItemQuantityModifier #3795

Merged
merged 12 commits into from
Jan 19, 2016

Conversation

Zales0123
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets #3524
License MIT
Doc PR Sylius/Sylius-Docs#400

This PR is based on #3771 and correspond with @michalmarcinkowski work in #3786.

In this PR there is OrderItemQuantityModifier implemented, that handles item units management. The idea is, to change OrderItem quantity only by adding/removing units.

Possible improvements/modifications

  • it will be better to remove backordered units first, then sold ones

UPDATE

I've applied commits from #3808, as they're necessary to make behat scenarios green.

UPDATE vol.2

Docs PR mentioned.

@@ -15,6 +15,7 @@
use Doctrine\Common\Collections\Collection;
use Sylius\Component\Cart\Model\Cart;
use Sylius\Component\Channel\Model\ChannelInterface as BaseChannelInterface;
use Sylius\Component\Inventory\Model\InventoryUnitInterface;
Copy link
Member

Choose a reason for hiding this comment

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

Is it used?

Copy link
Member

Choose a reason for hiding this comment

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

yes, it is. My bad.

@pjedrzejewski pjedrzejewski added the Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). label Dec 30, 2015
@Zales0123 Zales0123 force-pushed the order-item-quantity-modifier branch 2 times, most recently from a0e45d8 to aa0949e Compare January 5, 2016 14:00
} else if ($targetQuantity < $itemQuantity) {
$this->decreaseUnitsNumber($orderItem, $itemQuantity - $targetQuantity);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant blank line

Zales0123 and others added 10 commits January 18, 2016 09:27
OrderItemUnit recalculations enhancements
OrderItem recalculations enhancements
Added get adjustments total recursively method

Conflicts:
	src/Sylius/Component/Order/Model/OrderItem.php
	src/Sylius/Component/Order/spec/Model/OrderItemSpec.php
Also deleted unnecessary methods (setTotal and setItemsTotal in Order, setQuantity in OrderItem).
@@ -410,6 +410,7 @@
<service id="sylius.promotion_action.add_product" class="%sylius.promotion_action.add_product.class%">
<argument type="service" id="sylius.factory.order_item" />
<argument type="service" id="sylius.repository.product_variant" />
<argument type="service" id="sylius.modifier.order_item_quantity" />
Copy link
Member

Choose a reason for hiding this comment

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

I think we should name it just sylius.order_item_quantity_modifier. Why? Because we should only group services, which really do the same thing. It is true for factory, repository, manager, controller etc. But Modifier in Sylius terms is very vague. We don't have any other modifiers and I doubt we will have anytime soon and if yes, then there is a low chance that they will be doing similar thing to this one. :) WDYT? /cc @michalmarcinkowski

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 I totally agree with this argumentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

pjedrzejewski pushed a commit that referenced this pull request Jan 19, 2016
[Order] Implementation of OrderItemQuantityModifier
@pjedrzejewski pjedrzejewski merged commit 4207f04 into Sylius:master Jan 19, 2016
@pjedrzejewski
Copy link
Member

Thank you Mateusz! 👍 We are rocking this thing! ;)

@Zales0123 Zales0123 deleted the order-item-quantity-modifier branch October 28, 2016 13:47
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…ifier

[Order] Implementation of OrderItemQuantityModifier
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…ifier

[Order] Implementation of OrderItemQuantityModifier
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…ifier

[Order] Implementation of OrderItemQuantityModifier
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
…ifier

[Order] Implementation of OrderItemQuantityModifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants