Skip to content

Commit c238ea3

Browse files
committed
Merge branch 'master' of github.com:modmore/Docs
2 parents 32b610a + 3fd9675 commit c238ea3

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

en/01_Commerce/v1/75_Developer/03_Products/Pricing.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Other notable methods on the `ProductPricing` object:
276276
- `getRegularPrice() : PriceInterface`
277277
- `addPriceType(PriceTypeInterface $priceType) : void`
278278

279-
## Updating product pricing programmatically
279+
## Adding price types programmatically
280280

281281
If you're looking to import product prices, you'll need to interact with the classes mentioned in this document to make that work. The rough workflow would look like this:
282282

@@ -347,11 +347,11 @@ $pricing->addPriceType(
347347
```
348348

349349

350-
## Removing a PriceType from a Pricing instance
350+
## Updating or removing price types
351351

352-
It's not natively possible to remove a PriceType directly, as it does not have an ID or another unique key to target them by.
352+
It's not natively possible to update, remove or replace a PriceType directly, as it does not have an ID or another unique key to target them by.
353353

354-
If you programmatically want to remove a PriceType, create a new ProductPricing input, add the PriceType's you want to keep, and save that to the product.
354+
To programmatically update/remove/replace a PriceType, create a new (empty) ProductPricing instance, add the PriceType's you want to keep, and save that to the product.
355355

356356
```php
357357
$currency = $commerce->getCurrency('EUR');
@@ -370,6 +370,16 @@ foreach ($currentPricing->getPriceTypes() as $priceType) {
370370
$product->savePricing($newPricing);
371371
```
372372

373+
If you want to find a specific price type, you can use instanceof to test the price type inside the `foreach` loop. For example to only keep a Sale price type:
374+
375+
```php
376+
foreach ($currentPricing->getPriceTypes() as $priceType) {
377+
if ($priceType instanceof \modmore\Commerce\Pricing\PriceType\Sale) {
378+
$newPricing->addPriceType($priceType);
379+
}
380+
}
381+
```
382+
373383
## Loading Price Types in a custom product
374384

375385
Prior to 1.0, you would override `getPrice` and return a simple price object. That has been deprecated and will be removed in 1.3.

en/50_Open_Source/Gitify/01_Installation/01_Windows.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ c:\xampp\php\php.exe
1616
<ampps root>\php\php.exe
1717
````
1818

19+
## MAMP Pro
20+
21+
If you use MAMP Pro make sure to enable "[Make this version available on the command line](https://documentation.mamp.info/en/MAMP-PRO-Windows/Languages/PHP/)":
22+
23+
> Check this option to add the current PHP version to the system path. You verify this by checking your System PATH in Advanced System Settings > Environment Variables > System Variables.
24+
1925
### Additional Dependencies
2026

2127
Here are the Windows dependencies in order to get the script to execute properly. They must be installed and their bin folders have to be added to the Windows PATH environment variable in the Advanced System Settings screen:
@@ -29,4 +35,4 @@ Here are the Windows dependencies in order to get the script to execute properly
2935
* windows composer support (https://getcomposer.org)
3036
* Binary download - https://getcomposer.org/Composer-Setup.exe
3137

32-
Once those are completed, the rest of the instructions do work.
38+
Once those are completed, the rest of the instructions do work.

0 commit comments

Comments
 (0)