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

[Cart][Inventory] Fix cart inventory validation #6712

Merged
merged 7 commits into from
Nov 21, 2016

Conversation

Arminek
Copy link
Contributor

@Arminek Arminek commented Nov 14, 2016

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related tickets Sylius/Sylius-Standard#135
License MIT

@Arminek Arminek changed the title [Cart][Inventory] Fix cart inventory validation [WIP][Cart][Inventory] Fix cart inventory validation Nov 14, 2016
@Arminek Arminek changed the title [WIP][Cart][Inventory] Fix cart inventory validation [Cart][Inventory] Fix cart inventory validation Nov 14, 2016
@@ -293,7 +293,7 @@ public function iAddQuantityOfProductsToTheCart($quantity, ProductInterface $pro

/**
* @Given /^I have(?:| added) (\d+) (products "([^"]+)") (?:to|in) the cart$/
* @When /^I add(?:|ed) (\d+) (products "([^"]+)") to the cart$/
* @When /^I(?:| again) add(?:|ed) (\d+) (products "([^"]+)") to the cart$/
Copy link
Contributor

Choose a reason for hiding this comment

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

This syntax just does not look right :<

public function __construct(AvailabilityCheckerInterface $availabilityChecker, CartContextInterface $cartContext)
{
$this->availabilityChecker = $availabilityChecker;
$this->cartContext = $cartContext;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just use $orderItem->getOrder().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case Order has not been assigned yet.

@Arminek Arminek force-pushed the fix-cart-validaiton branch 8 times, most recently from 9c7b884 to cda19fe Compare November 17, 2016 11:47
@@ -165,5 +165,11 @@
<argument type="service" id="form.registry" />
<tag name="form.type" alias="sylius_product_variant" />
</service>

<service id="sylius.form.type.add_cart_item" class="Sylius\Bundle\CoreBundle\Form\Type\Order\AddCartItemType">
Copy link
Member

Choose a reason for hiding this comment

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

Let's move this to OrderBundle.

@@ -45,7 +45,7 @@ sylius_shop_cart_item_add:
method: createForProduct
arguments: [expr:service('sylius.repository.product').find($productId)]
form:
type: sylius_cart_item
type: sylius_add_cart_item
Copy link
Member

Choose a reason for hiding this comment

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

sylius_add_to_cart :)

@michalmarcinkowski
Copy link
Contributor

Does it also fix #6635?

@@ -13,6 +13,8 @@ sylius:
customer:
currency_code:
not_valid: The currency code you entered is invalid.
cart_item:
not_available: 'name does not have sufficient stock.'
Copy link
Contributor

Choose a reason for hiding this comment

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

That message seems wrong 😄

@Arminek Arminek force-pushed the fix-cart-validaiton branch 2 times, most recently from c431107 to c5e547a Compare November 21, 2016 11:36
@michalmarcinkowski michalmarcinkowski merged commit bece895 into Sylius:master Nov 21, 2016
@michalmarcinkowski
Copy link
Contributor

Great job Arek! 👍

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

4 participants