$deviceType =
$request->
getDeviceType();
if (empty($articleId)) { return;
} $shopId =
Shopware()->
Shop()->
getId();
$repository =
Shopware()->
Models()->
getRepository(ArticleImpression::
class);
$articleImpressionQuery =
$repository->
getArticleImpressionQuery($articleId,
$shopId, null,
$deviceType);
$articleImpression =
$articleImpressionQuery->
getOneOrNullResult();
// If no Entry for this day exists - create a new one
if ($articleImpression === null
) { $articleImpression =
new ArticleImpression($articleId,
$shopId, null, 1,
$deviceType);
Shopware()->
Models()->
persist($articleImpression);
} else { $articleImpression->
increaseImpressions();
} Shopware()->
Models()->
flush();
} /**
* Refresh partner log
*
* @param Enlight_Controller_Request_Request $request
* @param Enlight_Controller_Response_ResponseHttp $response
*
* @return void
*/