Installation und Konfiguration
Installation
{
"repositories": [
{
"type": "composer",
"url": "https://gitlab.com/api/v4/group/2045762/-/packages/composer/packages.json"
}
],
"require": {
"leoparden/category-discounts": "^1.1.15"
}
}
{
"repositories": [
{
"type": "vcs",
"url": "https://[your-access-user]:[your-access-token]@gitlab.com/dieLeoparden/shopware/base-plugin.git"
},
{
"type": "vcs",
"url": "https://[your-access-user]:[your-access-token]@gitlab.com/dieLeoparden/shopware/customfieldentitymatcher.git"
},
{
"type": "vcs",
"url": "https://[your-access-user]:[your-access-token]@gitlab.com/dieLeoparden/shopware/categorydiscounts.git"
}
],
"require": {
"leoparden/category-discounts": "^1.1.15"
}
}
Templates
Das Plugin überschreibt folgende Blöcke
@Storefront/storefront/component/buy-widget/buy-widget-price.html.twig::buy_widget_price_inner
@Storefront/storefront/component/line-item/element/total-price.html.twig::component_line_item_total_price
@Storefront/storefront/component/line-item/element/unit-price.html.twig::component_line_item_unit_price_inner
und stellt folgende Dateien zur Verfügung
Diese Templates können dann nach Belieben im Theme extended und überschrieben werden.
Routen / Entities
Die Entitäten
namespace EntitySchema {
export interface Entities {
leoparden_product_group: leoparden_product_group
leoparden_category_discount: leoparden_category_discount
product: product
}
interface price extends Entity<'price'> {
net: number
gross: number
currencyId: IdString
linked: boolean
listPrice: price
percentage: number
regulationPrice: price
}
interface DefaultPriceStruct extends price {
calculated: boolean
}
interface product extends Entity<'product'> {
customFields: {
productGroup: Entity<'leoparden_product_group'>
isDiscountable: boolean
}
extensions: {
productGroup: Entity<'leoparden_product_group'>
discounts: EntityCollection<'leoparden_category_discount'>
defaultPrice: DefaultPriceStruct
}
}
interface leoparden_product_group extends Entity<'leoparden_product_group'> {
name: string,
discounts: EntityCollection<'leoparden_category_discount'>
productGroupMatch: string
}
interface leoparden_category_discount extends Entity<'leoparden_product_group'> {
customerId: IdString
customer: Entity<'customer'>
productGroupId?: IdString
productGroup?: Entity<'leoparden_product_group'>
isAbsolute: boolean
isAdditive: boolean
value: number
}
}
Die Route "/store-api/product-groups" ist eine cached-route um Produktgruppen zu laden.
Als caching Events gibt es das Leoparden\CategoryDiscounts\Content\ProductGroup\ProductGroupRouteCacheKeyEvent und Leoparden\CategoryDiscounts\Content\ProductGroup\ProductGroupRouteCacheTagsEvent
Last modified: 22 March 2024