@vendure-osct/banner-plugin
v1.0.4
Published
A vendure plugin that allows you to crate banners for your ecommerce.
Downloads
1
Readme
Vendure Banner Plugin
This plugin allows you to create Banners to your
Getting started
npm i @vendure-osct/banner-plugin
- Add the plugin to your
vendure-config.ts
:
...
plugins: [
BannerPlugin,
AdminUiPlugin.init({
port: 3002,
route: 'admin',
app: compileUiExtensions({
outputPath: path.join(__dirname, '__admin-ui'),
extensions: [BannerPlugin.ui],
}),
}),
...
]
...
- Run a DB migration to add the new custom fields: https://docs.vendure.io/guides/developer-guide/migrations/#migration-workflow
- Start the server and login to the admin UI and go to
banners
- On the Banner List page, click
Create Banner
- Add slug and save
- Add new itens
- You should the list of items for your banner.
There are two ways to query your banners:
query Banners($options: BannerListOptions) {
banners(options: $options) {
items {
updatedAt
slug
id
items {
id
link
updatedAt
start
mobile {
Asset
}
end
createdAt
asset {
Asset
}
}
}
}
}
1: Filtering by slug
{
"options": {
"filter": {
"slug": {
"eq": "slug"
}
}
}
}
2: Filtering by id
{
"options": {
"filter": {
"id": {
"eq": "slug"
}
}
}
}
At the client side, do not forget to check for the end date whithin banner item to filter for expired banners.