backend_presentation_user_init

Triggered on the first access of each user to the “Products → Catalog” section in the Webasyst 2 mode and allows modifying the default list of available saved views. This event is triggered only once for each user. It does not allow modifying the list of saved views available to a user after the first access to this section.

Shop-Script

Input (passed by reference)

$params['contact_id'] int Current user’s contact ID.
$params['presentation_ids'] array[int] Array of IDs of default saved views.
… your plugin code …

Output

Shop-Script

Plugin code example

PHP

public function backendPresentationUserInit(&$params)
{
    $user_id = $params['contact_id'];
    $default_presentation_ids = &$params['presentation_ids'];

    $presentation_model = new shopPresentationModel();

    array_push($default_presentation_ids, [
        $presentation_model->insert([
            'name' => _wp('Custom extended table'),
            'creator_contact_id' => $user_id,
            'view' => shopPresentation::VIEW_TABLE_EXTENDED,
        ]),
        $presentation_model->insert([
            'name' => _wp('Custom simple table'),
            'creator_contact_id' => $user_id,
            'view' => shopPresentation::VIEW_TABLE,
        ]),
        $presentation_model->insert([
            'name' => _wp('Custom thumbs'),
            'creator_contact_id' => $user_id,
            'view' => shopPresentation::VIEW_THUMBS,
        ]),
    ]);
}