Das ShopBite Plugin bietet ein leistungsstarkes Geschäftszeiten-Management-System, das speziell für Gastronomie- und Einzelhandelsbetriebe entwickelt wurde. Dieses Kapitel erklärt die detaillierte Konfiguration und Verwaltung von Geschäftszeiten.
Das Geschäftszeiten-System ermöglicht:
CREATE TABLE `shopbite_business_hour` (
`id` BINARY(16) NOT NULL,
`day_of_week` INT(11) NOT NULL, -- 0=Sonntag, 1=Montag, ..., 6=Samstag
`opening_time` VARCHAR(5) NOT NULL, -- Format: HH:MM
`closing_time` VARCHAR(5) NOT NULL, -- Format: HH:MM
`sales_channel_id` BINARY(16) NOT NULL,
`created_at` DATETIME(3) NOT NULL,
`updated_at` DATETIME(3) NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk.shopbite_business_hour.sales_channel_id`
FOREIGN KEY (`sales_channel_id`)
REFERENCES `sales_channel` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
| Feld | Typ | Beschreibung | Beispiel |
|---|---|---|---|
| Sales Channel | Dropdown | Vertriebskanal auswählen | "Mein Restaurant" |
| Wochentag | Dropdown | Tag der Woche (0-6) | 1 (Montag) |
| Öffnungszeit | Zeitauswahl | Öffnungszeit | 11:00 |
| Schließzeit | Zeitauswahl | Schließzeit | 22:00 |
| Geschlossen | Checkbox | Tag als geschlossen markieren | ✓ |
GET /store-api/shopbite/business-hour
| Parameter | Typ | Beschreibung | Beispiel |
|---|---|---|---|
sales-channel-id | UUID | Filter nach Sales Channel | 019a36f224b0704fb6835914050392f4 |
include-closed | Boolean | Geschlossene Tage einbeziehen | true |
curl -X GET "https://Ihre-Shopware-Domain.de/store-api/shopbite/business-hour" \
-H "Authorization: Bearer IhrAPIToken" \
-H "sw-access-key: IhrAccessKey" \
-H "Accept: application/json"
{
"apiAlias": "shopbite_business_hour",
"data": [
{
"id": "019a36f224b0704fb6835914050392f4",
"dayOfWeek": 1,
"openingTime": "11:00",
"closingTime": "22:00",
"salesChannelId": "019a36f224b0704fb6835914050392f4",
"createdAt": "2024-01-11T14:30:00+01:00",
"updatedAt": "2024-01-11T14:30:00+01:00",
"salesChannel": {
"id": "019a36f224b0704fb6835914050392f4",
"name": "Mein Restaurant",
"typeId": "019a36f224b0704fb6835914050392f4"
}
},
{
"id": "019a36f224b0704fb6835914050392f5",
"dayOfWeek": 2,
"openingTime": "11:00",
"closingTime": "22:00",
"salesChannelId": "019a36f224b0704fb6835914050392f4",
"createdAt": "2024-01-11T14:30:00+01:00",
"updatedAt": "2024-01-11T14:30:00+01:00",
"salesChannel": {
"id": "019a36f224b0704fb6835914050392f4",
"name": "Mein Restaurant",
"typeId": "019a36f224b0704fb6835914050392f4"
}
}
],
"total": 7
}
| Statuscode | Bedeutung | Lösung |
|---|---|---|
| 200 | Erfolg | Daten erfolgreich abgerufen |
| 401 | Unauthorized | API-Zugangsdaten prüfen |
| 403 | Forbidden | Berechtigungen prüfen |
| 404 | Not Found | Endpunkt oder Sales Channel nicht gefunden |
| 500 | Internal Server Error | Server-Logs prüfen |
Sonderöffnungszeiten werden in der gleichen Tabelle gespeichert, aber mit einem speziellen Flag:
-- Sonderöffnungszeiten werden als separate Einträge gespeichert
-- mit einem speziellen Datum statt Wochentag
ALTER TABLE `shopbite_business_hour`
ADD COLUMN `special_date` DATE NULL AFTER `day_of_week`;
| Feld | Typ | Beschreibung | Beispiel |
|---|---|---|---|
| Sales Channel | Dropdown | Vertriebskanal auswählen | "Mein Restaurant" |
| Datum | Datumauswahl | Datum der Sonderöffnung | 24.12.2024 |
| Öffnungszeit | Zeitauswahl | Spezielle Öffnungszeit | 10:00 |
| Schließzeit | Zeitauswahl | Spezielle Schließzeit | 14:00 |
| Beschreibung | Text | Optional Beschreibung | "Heiligabend - verkürzte Öffnungszeiten" |
curl -X GET "https://Ihre-Shopware-Domain.de/store-api/shopbite/business-hour?special=true" \
-H "Authorization: Bearer IhrAPIToken" \
-H "sw-access-key: IhrAccessKey"
-- Indizes für bessere Performance
CREATE INDEX `idx_sales_channel` ON `shopbite_business_hour` (`sales_channel_id`);
CREATE INDEX `idx_day_of_week` ON `shopbite_business_hour` (`day_of_week`);
-- Für Sonderöffnungszeiten
CREATE INDEX `idx_special_date` ON `shopbite_business_hour` (`special_date`);
# In config/packages/cache.yaml
framework:
cache:
pools:
shopbite.business_hours:
adapter: cache.adapter.redis
default_lifetime: 3600 # 1 Stunde Cache
// Geschäftszeiten abrufen
async function fetchBusinessHours(salesChannelId) {
const response = await fetch(
`/store-api/shopbite/business-hour?sales-channel-id=${salesChannelId}`,
{
headers: {
'Authorization': `Bearer ${apiToken}`,
'sw-access-key': accessKey
}
}
);
if (!response.ok) {
throw new Error('Failed to fetch business hours');
}
return await response.json();
}
// Geschäftszeiten anzeigen
function displayBusinessHours(hours) {
const days = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
hours.data.forEach(hour => {
const dayName = days[hour.dayOfWeek];
console.log(`${dayName}: ${hour.openingTime} - ${hour.closingTime}`);
});
}
// Beispielaufruf
fetchBusinessHours('019a36f224b0704fb6835914050392f4')
.then(displayBusinessHours)
.catch(console.error);
<template>
<div class="business-hours">
<h3>Öffnungszeiten</h3>
<div v-for="hour in businessHours" :key="hour.id" class="hour-item">
<span class="day">{{ getDayName(hour.dayOfWeek) }}</span>
<span class="time">{{ hour.openingTime }} - {{ hour.closingTime }}</span>
</div>
</div>
</template>
<script>
export default {
data() {
return {
businessHours: [],
days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
};
},
async mounted() {
await this.fetchBusinessHours();
},
methods: {
getDayName(dayOfWeek) {
return this.days[dayOfWeek];
},
async fetchBusinessHours() {
try {
const response = await this.$axios.get('/store-api/shopbite/business-hour');
this.businessHours = response.data.data;
} catch (error) {
console.error('Failed to fetch business hours:', error);
}
}
}
};
</script>
<style scoped>
.business-hours {
margin: 20px 0;
padding: 15px;
background: #f5f5f5;
border-radius: 8px;
}
.hour-item {
display: flex;
justify-content: space-between;
padding: 8px 0;
border-bottom: 1px solid #ddd;
}
.day {
font-weight: bold;
}
.time {
color: #666;
}
</style>
Ursachen:
Lösungen:
# Cache leeren
bin/console cache:clear
# Datenbank prüfen
mysql -u shopware -p shopware -e "SELECT * FROM shopbite_business_hour;"
# Sales Channel-ID prüfen
bin/console sales-channel:list
Ursachen:
Lösungen:
# Datenbank prüfen
mysql -u shopware -p shopware -e "SELECT COUNT(*) FROM shopbite_business_hour;"
# API-Berechtigungen prüfen
bin/console integration:list
# API-Test
curl -X GET "https://Ihre-Domain.de/store-api/shopbite/business-hour" -H "Authorization: Bearer IhrToken"
Ursachen:
Lösungen:
# Zeitformat prüfen
mysql -u shopware -p shopware -e "SELECT opening_time, closing_time FROM shopbite_business_hour LIMIT 5;"
# Zeitzone prüfen
bin/console config:get Shopware.Core.SystemConfig.timezone