in Observer/ViewContent.php [51:79]
public function execute(Observer $observer)
{
try {
$eventId = $observer->getData('eventId');
$customData = [
'currency' => $this->_magentoDataHelper->getCurrency()
];
$product = $this->registry->registry('current_product');
if ($product && $product->getId()) {
$customData['value'] = $this->_magentoDataHelper->getValueForProduct($product);
$customData['content_ids'] = [$product->getId()];
$customData['content_category'] = $this->_magentoDataHelper->getCategoriesForProduct($product);
$customData['content_name'] = $product->getName();
$customData['contents'] = [
[
'product_id' => $product->getId(),
'item_price' => $this->_magentoDataHelper->getValueForProduct($product)
]
];
$customData['content_type'] = ($product->getTypeId() == Configurable::TYPE_CODE) ?
'product_group' : 'product';
}
$event = ServerEventFactory::createEvent('ViewContent', array_filter($customData), $eventId);
$this->serverSideHelper->sendEvent($event);
} catch (\Exception $e) {
$this->fbeHelper->log(json_encode($e));
}
return $this;
}