Store checkout and validation updates #3213
Merged
Conversation
since it's only 1 line after that
app/Libraries/OrderCheckout.php
Outdated
} | ||
|
||
if ($item->quantity > $item->product->max_quantity) { | ||
$messages[] = [trans_choice('model_validation/store/product.too_many', $item->product->max_quantity)]; |
nanaya
May 17, 2018
Collaborator
plain trans
.
plain trans
.
app/Libraries/OrderCheckout.php
Outdated
} | ||
|
||
foreach ($messages as $array) { | ||
// merge with existing errors, if any. |
nanaya
May 17, 2018
Collaborator
not sure in which case this happen (duplicated... primary key?).
not sure in which case this happen (duplicated... primary key?).
notbakaneko
May 17, 2018
Author
Collaborator
made more sense before when there could be an existing message inside :best:
made more sense before when there could be an existing message inside :best:
@@ -1,65 +0,0 @@ | |||
<?php |
nanaya
May 17, 2018
Collaborator
no replacement? ?_?
no replacement? ?_?
notbakaneko
May 17, 2018
Author
Collaborator
nope, at least not yet
nope, at least not yet
switch ($order->status) { | ||
case 'checkout': | ||
case 'processing': | ||
return 'You cannot modify your order while it is being processed.'; |
nanaya
May 17, 2018
Collaborator
i18n?
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(); |
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
.
just noticed why is it not called $validationErrors
and be part of return
's compact
instead of its own View::share
.
notbakaneko
May 17, 2018
Author
Collaborator
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 ?_?
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; |
nanaya
May 17, 2018
Collaborator
what
what
app/Models/Store/Order.php
Outdated
@@ -587,6 +528,7 @@ private function newOrderItem(array $params) | |||
} | |||
|
|||
$item = new OrderItem(); | |||
$item->order_id = $this->order_id; |
nanaya
May 17, 2018
Collaborator
or
$item = $this->items()->make([
'quantity' => ...,
...
])
?
or
$item = $this->items()->make([
'quantity' => ...,
...
])
?
return $this->order; | ||
} | ||
|
||
private static function buildMessage(Order $order) |
nanaya
May 17, 2018
Collaborator
does it need to be static
or can use $this->order
?
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() |
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.
maybe add relation to User
so we can do $user->storeOrders()
here and Auth::user()->storeOrders()->make()
for new cart.
resources/lang/en/store.php
Outdated
@@ -23,11 +23,29 @@ | |||
'warehouse' => 'Warehouse', | |||
], | |||
|
|||
'cart' => [ | |||
'errors_no_checkout' => [ |
nanaya
May 17, 2018
Collaborator
Array after strings?
Array after strings?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Order::updateItem
Some of the view parts and styles need consolidating but that's a different mess to be done separately.