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

Store checkout and validation updates #3213

Merged
merged 54 commits into from May 18, 2018

Conversation

3 participants
@notbakaneko
Contributor

notbakaneko commented May 16, 2018

  • fixes #3147; no longer tries to remove items from a locked cart when loading it.
  • more frequent cart content validations instead of just at checkout.
  • added some more strings for i18n.
  • fixes a bug with Order::updateItem

Some of the view parts and styles need consolidating but that's a different mess to be done separately.

@notbakaneko notbakaneko added the store label May 16, 2018

}
if ($item->quantity > $item->product->max_quantity) {
$messages[] = [trans_choice('model_validation/store/product.too_many', $item->product->max_quantity)];

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

plain trans.

}
foreach ($messages as $array) {
// merge with existing errors, if any.

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

not sure in which case this happen (duplicated... primary key?).

This comment has been minimized.

@notbakaneko

notbakaneko May 17, 2018

Contributor

made more sense before when there could be an existing message inside :best:

@@ -1,65 +0,0 @@
<?php

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

no replacement? ?_?

This comment has been minimized.

@notbakaneko

notbakaneko May 17, 2018

Contributor

nope, at least not yet

switch ($order->status) {
case 'checkout':
case 'processing':
return 'You cannot modify your order while it is being processed.';

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

i18n?

@@ -78,7 +78,7 @@ public function show()
// using $errors will conflict with laravel's default magic MessageBag/ViewErrorBag that doesn't act like
// an array and will cause issues in shared views.
$flash = session('checkout.error.errors') ?? [];
$flash = session('checkout.error.errors') ?? $checkout->validate();

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

just noticed why is it not called $validationErrors and be part of return's compact instead of its own View::share.

This comment has been minimized.

@notbakaneko

notbakaneko May 17, 2018

Contributor

I think this was originally supposed to go into middleware and then didn't because of how it didn't work so great with the current structure ?_?

padding: 10px;
margin: 0 0 5px;
// flex-wrap: wrap;

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

what

@@ -587,6 +528,7 @@ private function newOrderItem(array $params)
}
$item = new OrderItem();
$item->order_id = $this->order_id;

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

or

$item = $this->items()->make([
  'quantity' => ...,
  ...
])

?

return $this->order;
}
private static function buildMessage(Order $order)

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

does it need to be static or can use $this->order?

@@ -464,27 +421,11 @@ public function switchItems($orderItem, $newProduct)
public static function cart($user)
{
$cart = static::query()
return static::query()

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

maybe add relation to User so we can do $user->storeOrders() here and Auth::user()->storeOrders()->make() for new cart.

@@ -23,11 +23,29 @@
'warehouse' => 'Warehouse',
],
'cart' => [
'errors_no_checkout' => [

This comment has been minimized.

@nanaya

nanaya May 17, 2018

Collaborator

Array after strings?

@peppy peppy added this to the May 2018 milestone May 18, 2018

@peppy peppy removed this from the May 2018 milestone May 18, 2018

@peppy peppy removed the store label May 18, 2018

@nanaya

nanaya approved these changes May 18, 2018

@nanaya nanaya merged commit d60fef1 into ppy:master May 18, 2018

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@notbakaneko notbakaneko deleted the notbakaneko:feature/store-cart-validation-update branch Jun 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment