-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first draft of sales channel helper page
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Sales Channel Helpers | ||
|
||
This helper provides utility methods to work with sales channels. | ||
|
||
## getStorefrontSalesChannel | ||
|
||
The `getStorefrontSalesChannel` method returns the first sales channel of type `Storefront` or null if it does not exists. | ||
|
||
```php | ||
<?php | ||
|
||
class MyFixture extends Fixture { | ||
public function load(): void { | ||
$salesChannel = $this->helper->SalesChannel()->getStorefrontSalesChannel(); // [!code focus] | ||
} | ||
} | ||
``` | ||
|
||
## getHeadlessSalesChannel | ||
|
||
The `getHeadlessSalesChannel` method returns the first sales channel of type `Headless` or null if it does not exists. | ||
|
||
```php | ||
<?php | ||
|
||
class MyFixture extends Fixture { | ||
public function load(): void { | ||
$salesChannel = $this->helper->SalesChannel()->getHeadlessSalesChannel(); // [!code focus] | ||
} | ||
} | ||
``` | ||
|
||
## getProductComparisonSalesChannel | ||
|
||
The `getProductComparisonSalesChannel` method returns the first sales channel of type `Product Comparison` (in admin it is called Product Feed) or null if it does not exists. | ||
|
||
```php | ||
<?php | ||
|
||
class MyFixture extends Fixture { | ||
public function load(): void { | ||
$salesChannel = $this->helper->SalesChannel()->getProductComparisonSalesChannel(); // [!code focus] | ||
} | ||
} | ||
``` | ||
|
||
## getSalesChannelByType | ||
|
||
The `getSalesChannelByType` method takes a type parameter and returns the first sales channel of that specific type or null if it does not exists. | ||
|
||
```php | ||
<?php | ||
|
||
class MyFixture extends Fixture { | ||
public function load(): void { | ||
$salesChannel = $this->helper->SalesChannel()->getSalesChannelByType( // [!code focus] | ||
Defaults::SALES_CHANNEL_TYPE_PRODUCT_COMPARISON // [!code focus] | ||
); // [!code focus] | ||
} | ||
} | ||
``` |