backend_marketing_promo
Allows modification of, or adding custom content to, promo-viewing pages in the “Marketing” section.
Shop-Script
Input (passed by reference)
$params['options'] string Value if the GET parameter 'options'.
$params['promo'] array Promo’s properties.
$params['overall_totals'] array Total statistical values relating to orders received from all storefronts included in the promo.
$params['promo_totals'] array Total statistical values relating to orders matching the promo’s settings.
$params['chart_data'] array Values used to draw the chart on the promo-viewing page.
$params['storefronts'] array The list of storefronts selected in the promo’s settings.
$params['rule_types'] array The list of tools available in the promo’s settings.
$params['promo'] array Promo’s properties.
$params['overall_totals'] array Total statistical values relating to orders received from all storefronts included in the promo.
$params['promo_totals'] array Total statistical values relating to orders matching the promo’s settings.
$params['chart_data'] array Values used to draw the chart on the promo-viewing page.
$params['storefronts'] array The list of storefronts selected in the promo’s settings.
$params['rule_types'] array The list of tools available in the promo’s settings.
… your plugin code …
Output
{$backend_marketing_promo.action_link}
Extra content next to promo actions’ links. E.g., HTML code of additional action links.
{$backend_marketing_promo.info_section}
Extra content under the list of promo settings fields. E.g., HTML code of extra settings fields.
{$backend_marketing_promo.button}
Extra content next to the promo saving button. E.g., HTML code of additional buttons.
{$backend_marketing_promo.bottom}
Extra content at the bottom of the promo-viewing page. E.g., an information block or a JavaScript code snippet.
Shop-Script
Plugin code example
PHP
public function backendMarketingPromo($params) { $promo_settings = $params['promo']; return [ 'action_link' => '<span id="' . $this->id . '-action" class="button light-gray rounded custom-ml-16"><i class="fas fa-user text-blue"></i> ' . _wp('Custom promo action') . '</span>', 'info_section' => waHtmlControl::getControl(waHtmlControl::INPUT, 'custom_field', [ 'namespace' => $this->id, 'title' => _wp('My custom field'), 'control_wrapper' => '<div class="field"><div class="name">%s</div><div class="value">%s%s</div></div>', 'title_wrapper' => '%s', 'value' => $promo_settings['name'], ]), 'button' => '<button class="button blue outlined">' . _wp('My plugin’s button') . '</button>', 'bottom' => '<div class="box highlighted custom-p-8">' . _wp('My plugin’s bottom block.') . '</div>', ]; }