Skip to content

Commit

Permalink
Add first draft of sales channel helper page
Browse files Browse the repository at this point in the history
  • Loading branch information
jkniest committed Jun 16, 2024
1 parent 525530f commit 74da1a0
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions docs/helpers/sales-channel.md
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]
}
}
```

0 comments on commit 74da1a0

Please sign in to comment.