Skip to main content

Window

Redirect to another URL

Usage:

sw.window.redirect({
url: 'https://www.shopware.com,
newTab: true
})

Parameters:

NameRequiredDefaultDescription
urltrueThe title of the notification
newTabfalsefalseThe message of the notification

Return value:

Returns a promise without data.

Push to another page

For redirecting to other pages in the admin.

Usage:

The usage matches the Vue Router push capabilities. Here are two examples how to use it for redirecting to your own modules:

sw.window.routerPush({
name: 'sw.extension.sdk.index',
params: {
id: 'the_id_of_the_module' // can be get with context.getModuleInformation
}
})
sw.window.routerPush({
path: `/extension/${the_id_of_the_module}` // id can be get with context.getModuleInformation
})

Parameters:

NameRequiredDefaultDescription
namefalseundefinedThe name of the route
pathfalseundefinedThe path of the route
paramsfalseundefinedAdditional params for the new route
replacefalsefalseShould not change the browser history

Return value:

Returns a promise without data.

Reload page

Useful for development. You can trigger a page reload on file changes.

Usage:

sw.window.reload()

Parameters:

No parameters required.

Return value:

Returns a promise without data.