backend_product

Adds custom content to product viewing and editing screens in backend.

Shop-Script

Input (passed by reference)

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

Output

{$backend_product.%plugin_id%.title_suffix}

Custom content displayed to the right of product name at page top.

{$backend_product.%plugin_id%.action_button}

Custom content displayed to the right of the “Edit” button at page top.

{$backend_product.%plugin_id%.toolbar_section}

Custom content displayed under "Delete product" link at the bottom of the right-hand sidebar.

{$backend_product.%plugin_id%.info_section}

Custom content displayed under the list of product’s storefront links.

{$backend_product.%plugin_id%.edit_section_li}

Custom element for the main menu of product-editing screen.

{$backend_product.%plugin_id%.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 array(
        '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', array(
            '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>',
        )),
    );
}