Setting up email notification for abandoned product view in 1C-Bitrix
An abandoned view trigger captures the fact — user viewed product but did nothing. Email notification turns this fact into marketing action: an email arrives in 30–60 minutes with the viewed product card, price and "View again" button. Implementation is built on top of the abandoned view trigger from b_catalog_viewed_product and Bitrix's standard mail engine.
Mail event type
In Bitrix emails are sent via the mail events system. You need to create an event type in "Settings → Mail → Mail event types":
-
Symbolic code:
CATALOG_ABANDONED_VIEW -
Event fields:
PRODUCT_ID,PRODUCT_NAME,PRODUCT_URL,PRODUCT_PRICE,PRODUCT_IMAGE,USER_NAME,USER_EMAIL
Email template is created in "Settings → Mail → Mail event templates" and linked to the event type for the needed site.
Email template
Template is written as HTML with Bitrix macros. Product data is passed via event field array:
Subject: #PRODUCT_NAME# — you viewed this product
Body:
<p>Hello, #USER_NAME#!</p>
<p>You recently viewed the product:</p>
<p><img src="#PRODUCT_IMAGE#" width="200"/></p>
<p><strong>#PRODUCT_NAME#</strong></p>
<p>Price: #PRODUCT_PRICE# rubles</p>
<a href="#PRODUCT_URL#">View product</a>
Product image (PRODUCT_IMAGE) — absolute URL. In the agent you need to get the path from CFile::GetPath($previewPictureId) and add site domain.
Sending logic in agent
Agent polls b_catalog_viewed_product, finds entries in the "30 to 90 minutes ago" window that don't have corresponding order or addition to cart, and sends email:
$email = \Bitrix\Main\UserTable::getById($userId)
->fetchObject()
?->getEmail();
if ($email) {
\Bitrix\Main\Mail\Event::send([
'EVENT_NAME' => 'CATALOG_ABANDONED_VIEW',
'LID' => SITE_ID,
'C_FIELDS' => [
'USER_EMAIL' => $email,
'USER_NAME' => $userName,
'PRODUCT_ID' => $productId,
'PRODUCT_NAME' => $productName,
'PRODUCT_URL' => $productUrl,
'PRODUCT_PRICE' => $price,
'PRODUCT_IMAGE' => $imageUrl,
],
]);
}
Deduplication and frequency limits
Without control a user can receive multiple emails per day if they viewed different products. Restrictions:
- No more than one abandoned view email per 24 hours per user
- Don't send if abandoned cart email (
CATALOG_ABANDONED_CART) was already sent in this period - Exclude users who unsubscribed from marketing mailings (field
UF_MAILING_SUBSCRIBEinb_uts_useror check viab_subscribe_user_group)
Deduplication table bl_abandoned_view_sent: fields (user_id, sent_date) with unique index. Before sending — INSERT OR IGNORE, if record exists — skip.
What we configure
- Mail event type
CATALOG_ABANDONED_VIEWand HTML email template - Agent with logic for selecting from
b_catalog_viewed_productand checking cart/orders - Deduplication table with limit of one email per 24 hours per user
- Check subscription status before sending
- Building absolute URLs for product images for correct display in email







