PHP code example of magendoo / module-product-labels
1. Go to this page and download the library: Download magendoo/module-product-labels library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
magendoo / module-product-labels example snippets
class LowStockMatcher implements \Magendoo\ProductLabels\Model\Indexer\RuleMatcher\MatcherInterface
{
public function getMatchingProductIds(int $storeId, ?array $productIds = null): array
{
// return the matching product entity IDs for this store view
}
}
xml
<type name="Magendoo\ProductLabels\Model\Indexer\LabelAssignment">
<arguments>
<argument name="matchers" xsi:type="array">
<item name="low_stock" xsi:type="object">Vendor\Module\Model\Indexer\RuleMatcher\LowStockMatcher</item>
</argument>
</arguments>
</type>