Skip to content

Commit

Permalink
Merge branch '1.x' into installation_docs
Browse files Browse the repository at this point in the history
* 1.x:
  Feature - Discount editing (lunarphp#1542)
  Update ManageProductShipping.php
  Feature - Prevent delete action on resources with childs (lunarphp#1532)
  Feature - Brand urls and tweaks (lunarphp#1541)
  Chore - Update larastan/larastan (lunarphp#1558)
  chore: fix code style
  Feature - Field translated text (lunarphp#1505)
  Fix tests
  Revert "Quantity break fixes"
  Quantity break fixes
  Feature - Pricing management (lunarphp#1515)
  Improved dashboard KPIs
  • Loading branch information
webpatser committed Feb 15, 2024
2 parents 80786ea + 5daaccf commit 3dff79b
Show file tree
Hide file tree
Showing 119 changed files with 2,682 additions and 781 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
composer.lock
/vendor
.phpunit.result.cache
.phpunit.cache/
/.idea
/.vscode
node_modules/
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"require-dev": {
"laravel/pint": "1.13.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/larastan": "^2.0",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/core/reference/pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ them, first we'll create a standard price model.
$priceModel = \Lunar\Models\Price::create([
// ...
'price' => 1000, // Price is an int and should be in the lowest common denominator
'quantity_break' => 1,
'min_quantity' => 1,
]);

// Lunar\DataTypes\Price
Expand Down
18 changes: 9 additions & 9 deletions docs/core/reference/products.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ front end.
| `price` | A integer value for the price | `null` | yes |
| `compare_price` | For display purposes, allows you to show a comparison price, e.g. RRP. | `null` | no |
| `currency_id` | The ID of the related currency | `null` | yes |
| `quantity_break` | The lower limit to get this price, 1 is the default for base pricing. | `1` | no |
| `min_quantity` | The minimum quantity required to get this price. | `1` | no |
| `customer_group_id` | The customer group this price relates to, leaving as `null` means any customer group | `null` | no |
| `priceable_type` | This is the class reference to the related model which owns the price | `null` | yes |
| `priceable_id` | This is the id of the related model which owns the price | `null` | yes |
Expand All @@ -450,7 +450,7 @@ $price = \Lunar\Models\Price::create([
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'quantity_break' => 1,
'min_quantity' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -476,7 +476,7 @@ relationship method.
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'quantity_break' => 1,
'min_quantity' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -493,24 +493,24 @@ You can specify which customer group the price applies to by setting the `custom
the price will apply to all customer groups. This is useful if you want to have different pricing for certain customer
groups and also different price quantity breaks per customer group.

### Quantity Break Pricing
### Price Break Pricing

Quantity Break pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `quantity_break` column when creating prices. For example:
Price Break pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `min_quantity` column when creating prices. For example:

```php
Price::create([
// ...
'price' => 199,
'compare_price' => 399,
'quantity_break' => 1,
'min_quantity' => 1,
]);

Price::create([
// ...
'price' => 150,
'compare_price' => 399,
'quantity_break' => 10,
'min_quantity' => 10,
]);
```

Expand Down Expand Up @@ -607,7 +607,7 @@ $pricing->base;
/**
* A collection of all the price quantity breaks available for the given criteria.
*/
$pricing->quantityBreaks;
$pricing->priceBreaks;

/**
* All customer group pricing available for the given criteria.
Expand Down
10 changes: 5 additions & 5 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ for further information.
The `position` field has been removed from the `product_options` table and is now found on the `product_product_option`
pivot table. Any position data will be automatically adjusted when running migrations.

#### Tiers renamed to Quantity Breaks
#### Tiers renamed to Price Breaks

The `tier` column on pricing has been renamed to `quantity_break`, any references in code to `tiers` needs to be updated.
The `tier` column on pricing has been renamed to `min_quantity`, any references in code to `tiers` needs to be updated.

##### Price Model

```php
// Old
$priceModel->tier
// New
$priceModel->quantity_break
$priceModel->min_quantity

// Old
$priceModel->tiers
// New
$priceModel->quantityBreaks
$priceModel->priceBreaks
```

##### Lunar\Base\DataTransferObjects\PricingResponse
Expand All @@ -55,7 +55,7 @@ $priceModel->quantityBreaks
// Old
public Collection $tiered,
// New
public Collection $quantityBreaks,
public Collection $priceBreaks,
```

## 0.7
Expand Down
20 changes: 5 additions & 15 deletions packages/admin/resources/dist/lunar-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,11 @@ select {
border-color: rgb(253 186 116 / var(--tw-border-opacity));
}

.border-primary-500 {
--tw-border-opacity: 1;
border-color: rgba(var(--primary-500), var(--tw-border-opacity));
}

.border-sky-300 {
--tw-border-opacity: 1;
border-color: rgb(125 211 252 / var(--tw-border-opacity));
Expand All @@ -1272,16 +1277,6 @@ select {
border-color: rgb(255 255 255 / 0.1);
}

.border-blue-500 {
--tw-border-opacity: 1;
border-color: rgb(59 130 246 / var(--tw-border-opacity));
}

.border-primary-500 {
--tw-border-opacity: 1;
border-color: rgba(var(--primary-500), var(--tw-border-opacity));
}

.bg-gray-200 {
--tw-bg-opacity: 1;
background-color: rgba(var(--gray-200), var(--tw-bg-opacity));
Expand Down Expand Up @@ -1340,11 +1335,6 @@ select {
background-color: rgb(255 255 255 / 0.7);
}

.bg-custom-600 {
--tw-bg-opacity: 1;
background-color: rgba(var(--c-600), var(--tw-bg-opacity));
}

.\!p-0 {
padding: 0px !important;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/attributegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This attribute group can not be deleted as there are attributes associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/brand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This brand can not be deleted as there are products associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/collectiongroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This collection group can not be deleted as there are collections associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/customergroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This customer group can not be deleted as there are customers associated.',
],
],
],
];
Loading

0 comments on commit 3dff79b

Please sign in to comment.