Skip to content

Commit

Permalink
Added 1 as default minimum quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-kuendig committed Aug 23, 2024
1 parent 56f88cf commit ea43772
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions components/product/addtocart.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<input type="number"
id="quantity"
class="mall-input"
min="{{ item.quantity_min }}" max="{{ item.quantity_max }}"
name="quantity" value="{{ item.quantity_default | default(1) }}">
min="{{ item.quantity_min | default(1) }}"
max="{{ item.quantity_max }}"
name="quantity"
value="{{ item.quantity_default | default(1) }}">
<div data-validate-for="quantity"></div>
</div>
<button type="submit" class="mall-add-to-cart-button" data-attach-loading>
Expand Down
2 changes: 1 addition & 1 deletion models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function __construct(array $attributes = [])
});

$this->bindEvent('model.relation.detach', function ($relationName, $detachedIdList) {
if ($relationName === 'categories') {
if ($relationName === 'categories' && is_array($detachedIdList)) {
foreach ($detachedIdList as $detachedId) {
$category = Category::find($detachedId);
UniquePropertyValue::updateUsingCategory($category);
Expand Down

0 comments on commit ea43772

Please sign in to comment.