backend_prod_dialog

Allows adding of custom content to various dialogs in the new product editor, which are used when a product is deleted or extra categories are selected, or a product is added to sets, or when an SKU is deleted.

Shop-Script

Input (passed by reference)

$params['product'] shopProduct Product properties object.
$params['dialog_id'] string Dialog identifier.
$params['sku_id'] int Numeric SKU ID. Available on for the 'sku_delete' dialog.
… your plugin code …

Output

{$backend_prod_dialog.top}

HTML code of custom content to be added to the top of the dialog.

{$backend_prod_dialog.bottom}

HTML code of custom content to be added to the bottom of the dialog.

{$backend_prod_dialog.add_form}

HTML code of custom fields to be added to the dialog’s web form. Used only in the product categories selection dialog.

Shop-Script

Plugin code example

PHP

public function backendProdDialog($params)
{
    /** @var shopProduct $product */
    $product = $params['product'];
    $dialog_id = $params['dialog_id'];

    if ($dialog_id == 'select_category') {
        $some_value = shopMyPlugin::getSomeValue($product->id);
        $add_form_html = <<<HTML
            <input type="hidden" name="myplugin[select_category]" value="{$some_value}">
HTML;
    }

    return [
        // 'top' => '',
        // 'bottom' => '',
        'add_form' => ifset($add_form_html),
    ];
}