backend_product

Adds custom content to product viewing screen in the old interface (1.3).

Shop-Script

Input (passed by reference)

$product shopProduct Instance of product entity class.
… your plugin code …

Output

{$backend_product.title_suffix}
Custom content displayed to the right of product name at page top.
{$backend_product.action_button}
Custom content displayed to the right of the “Edit” button at page top.
{$backend_product.toolbar_section}
Custom content displayed under "Delete product" link at the bottom of the right-hand sidebar.
{$backend_product.info_section}
Custom content displayed under the list of product’s storefront links.
{$backend_product.edit_section_li}
Custom element for the main menu of product-editing screen.
{$backend_product.category_action_li}
Custom content displayed under the list of product categories in product-editing mode.
Shop-Script

Plugin code example

PHP

public function backendProduct(&$product)
{
    return [
        'title_suffix'    => shopMyPluginHelper::getProductCustomData($params['data']['id']),
        'action_button'   => '<a href="" class="button blue" >' . _wp('Product action button') . '</a>',
        'toolbar_section' => '<ul class="menu-v">'
            . '<li><a href="">' . _wp('link 1') . '</a></li>'
            . '<li><a href="">' . _wp('link 2') . '</a></li>'
            . '<li><a href="">' . _wp('link 3') . '</a></li>'
            . '</ul>',
        'edit_section_li' => '<li><a href="">' . _wp('My extra edit link') . '</a></li>',
        'category_action_li' => waHtmlControl::getControl(waHtmlControl::INPUT, 'myplugin_field', [
            'value'               => isset($params['data']['myplugin_field']) ? isset($params['data']['myplugin_field']) : null,
            'title'               => _wp('My custom field'),
            'description'         => _wp('Useful hint for users.'),
            'title_wrapper'       => '%s',
            'control_wrapper'     => '<hr><h5>%s</h5>%s%s<hr>',
            'description_wrapper' => '<br><span class="hint">%s</span>',
        ]),
    ];
}