promo_rules

Allows providing of custom promo campaigns for product export plugins. A product export plugin must call method shopImportexportHelper->getPromoRules() to obtain the list of available promo campaigns.

Shop-Script

Input (passed by reference)

$params array Product export plugins’s parameters.
$params['plugin'] string Plugin ID.
… your plugin code …

Output

Shop-Script

Plugin code example

PHP

public function promoRules($params)
{
    $importexport_plugin = $params['plugin'];

    if ($importexport_plugin == 'yandexmarket') {
        return [
            [
                'type'           => shopImportexportHelper::PROMO_TYPE_PROMO_CODE,
                'promo_code'     => 'mypluginpromocode',
                'discount_unit'  => '%',
                'discount_value' => 20,
                'name'           => _wp('My promo’s public name'),
                'description'    => _wp('My promo’s public description'),
                'source'         => _wp('My promo’s backend name'),
                'hint'           => _wp('My promo’s backend description'),
                'settings'       => 'myplugin/promo/settings',
                'url'            => 'mypluginpromourl',
                'start_datetime' => time(),
                'end_datetime'   => time() + 3600 * 24 * 7,
                'hash'           => '*',
            ],
        ];
    }
}