diff --git a/code_samples/recommendations/EventData.php b/code_samples/recommendations/EventData.php index aa50de626c..4825ed6114 100644 --- a/code_samples/recommendations/EventData.php +++ b/code_samples/recommendations/EventData.php @@ -1,12 +1,28 @@ getCode(), - productName: $product->getName(), - categoryPath: '25#Electronics;26#Smartphones', // Build manually - currency: 'USD', - itemPrice: '999.99' -); + public function dispatchVisitEvent(ProductInterface $product): void + { + $eventData = new VisitEventData( + productCode: $product->getCode(), + productName: $product->getName(), + categoryPath: '25#Electronics;26#Smartphones', // Build manually + currency: 'USD', + itemPrice: '999.99' + ); -$this->trackingDispatcher->dispatch($eventData); + $this->trackingDispatcher->dispatch($eventData); + } +} diff --git a/code_samples/recommendations/EventMapper.php b/code_samples/recommendations/EventMapper.php index b89ec50fc4..df39c9da5e 100644 --- a/code_samples/recommendations/EventMapper.php +++ b/code_samples/recommendations/EventMapper.php @@ -1,4 +1,7 @@