Hallo zusammen,
ich habe einen isotope Shop mit verschiedenen Preisen für verschiedene Mitgliedergruppen.
Diese unterschiedlichen Preise bzw. den sich daraus ergebenen Rabatt würde ich gerne in der Produktdarstellung anzeigen.
Mit einer allgemeinen Rabattregel passiert das bereits automatisch und das Template gibt den Strike Price nach außen, der durchgestrichen dargestellt wird.
Gastuser = Basispreis = 10,00 €
Silberuser = 8,20 €
Golduser = 6,00 €
ich möchte immer den Unterschied zum Gastuser Preis darstellen. Alle Preise sind individuell gesetzt und können deshalb leider nicht über eine Pauschale 20% Rabattregel definiert werden.
Hier sind meine ersten Versuche den calculatePrice Hook dafür zu verwenden.
Ich bekomme allerdings weder den geänderten Preis noch die Errormeldung.
Irgendwas passt am Ansatz noch nicht. Kann mir bitte jemand helfen?
in der services.yml registriert.Code:<?php
// src/EventListener/PriceCalculationListener.php
namespace AppBundle\EventListener;
use Isotope\Model\Product;
use Contao\CoreBundle\ServiceAnnotation\Hook;
class PriceCalculationListener
{
/**
* @Hook("calculatePrice")
*/
public function onCalculatePrice($fltPrice, Product $objProduct, array $arrConfig)
{
return $fltPrice * 2;
error_log('CalculatePrice Hook wurde aufgerufen');
}
}
Code:AppBundle\EventListener\PriceCalculationListener:
tags:
- { name: 'contao.hook', hook: 'calculatePrice', method: 'onCalculatePrice' }