Implementing E-Gift Certificates on 1C-Bitrix: From Product to PDF

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
Implementing E-Gift Certificates on 1C-Bitrix: From Product to PDF
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1356
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    943
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    693
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    828
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    731
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1073

When processing 500+ orders per day, a makeshift gift certificate implementation causes issues: duplicate codes, missed emails, broken coupons. We rewrote modules for 15 projects — the same errors kept appearing: incorrect codes, missing partial redemption, fiscalization problems. A well-thought-out architecture reduces support costs by 20–30% and pays off in 2–3 months. In 95% of cases, problems arise from incorrect coupon configuration; the average time to fix one incident is 4 hours. Let's examine how to set up electronic certificates from product to balance, using built-in Bitrix mechanisms and custom modifications.

How to Set Up the Sale of Electronic Certificates: From Product to Balance

An electronic certificate is created as a regular infoblock element, but with special features. Product type — simple product without stock accounting (unlimited quantity, uncheck "Quantitative Accounting"). Create SKUs by denominations: 1000, 2000, 5000 rubles. Each SKU has its own price equal to the denomination. Set the property "Delivery Type" to "Electronic delivery" so that no address is requested during checkout. In the product card, add an infoblock property "Certificate Denomination" (type — number). This will be used by the handler when generating the coupon.

How to Generate Unique Certificate Codes

Upon successful order payment, the event handler OnSalePayOrder generates a unique certificate code via Bitrix\Main\Security\Random::getString(12) — 12 characters from A-Z, 0-9. Handler logic:

  1. Check if the order contains a product from the "Certificates" section (by infoblock section ID).
  2. Generate the code.
  3. Create a coupon via Bitrix\Sale\Internals\DiscountCouponTable::add() linked to a basket rule.
  4. Save the code and denomination in order properties (user fields UF_CERTIFICATE_CODE, UF_CERTIFICATE_AMOUNT).

The coupon is created with type "For order series" and maximum usage count — this allows partial usage. According to Bitrix documentation, coupons of this type can be used multiple times until the limit is exhausted.

Generating the PDF

The PDF is generated using mPDF or Dompdf — included via Composer. The document template is an HTML file with variable substitution:

  • Voucher code
  • Denomination
  • Issue date and expiration date
  • QR code for quick activation (generated via chillerlan/php-qrcode or similar)

The HTML template is stored in /local/templates/certificate/ and contains inline styles (mPDF does not fully support external CSS). The background image is set via CSS background-image with an absolute path to the file on the server. The result is saved to /upload/certificates/ with a name based on the coupon code. Access to the directory is restricted via .htaccess — the file is only served through a PHP script with authorization checks.

Sending by Email

The mail event CERTIFICATE_CREATED is created under Settings → Mail Events. The email template contains:

Macro Value
#CODE# Coupon code
#AMOUNT# Denomination
#VALID_UNTIL# Expiration date
#PDF_LINK# Link to download PDF

Sending is triggered from the same OnSalePayOrder handler after PDF generation. The email is sent to the buyer's email from the order. If a separate recipient email is specified in the order ("Recipient email for gift"), the email is duplicated to that address.

Electronic Certificates Instead of Coupons

The built-in Bitrix coupon system does not support coupon balance out of the box. Compare with a custom solution:

Parameter Built-in Coupon System Custom Module
Partial redemption No Yes
Usage history No Yes
Balance display in account No Yes
1C integration Difficult, via API Ready-made handlers

For partial redemption, a modification is needed:

  • The OnSaleOrderPaid handler checks if the coupon was used in a paid order.
  • If the order total is less than the denomination, the remainder is calculated.
  • The basket rule is updated: new discount amount = remainder.
  • Usage history is recorded in a separate table (custom table b_certificate_usage).

If the order total is equal to or greater than the denomination, the coupon is deactivated via DiscountCouponTable::update() with field ACTIVE = N. The coupon balance is displayed in the buyer's account via a custom component that reads data from b_certificate_usage and the current basket rule. In one project, we implemented this mechanism for an electronics retail chain — it handled 3000 operations per day without a single failure for 3 years.

Activating the Electronic Certificate

The redemption mechanism works via the sale.discount module. When generating the coupon, a basket rule is created:

  • Discount type — fixed sum equal to the coupon denomination.
  • Binding — coupon whose code matches the voucher code.
  • Scope — entire order (or specific catalog sections, if it's a category coupon).

The buyer enters the coupon code in the "Coupon" field during checkout. The system applies a discount equal to the denomination.

Setting an Expiration Date

Expiration is set in the basket rule via fields ACTIVE_FROM and ACTIVE_TO. The standard period is 12 months from purchase. After expiration, the coupon automatically stops working, and in the account, the coupon displays as "Expired". To monitor expiry, we configure an agent that sends a reminder to the buyer 7 days before expiration.

Ready-made modules from the Marketplace often do not support partial redemption, 1C integration, or PDF template customization. They only work with 100% write-off scenarios. Our experienced team guarantees that a custom solution is 5 times more flexible than off-the-shelf modules, and development cost starts from $500. We did this for an electronics retail chain — the solution saved them 30% in support costs and paid off in 2 months.

Typical Setup Errors
  • Incorrect coupon type: "For one order" instead of "For order series" — coupon fully consumed.
  • Missing caching of coupon table queries — with 500+ orders, database load increases 10 times.
  • Wrong infoblock section ID in handler — code generation fails.
  • Ignoring the OnSaleCancelOrder handler — when an order is cancelled, the code is not released.

What's Included in the Service

  • Module development for code generation, coupons, and usage history.
  • Integration with payment systems and 1C via CommerceML.
  • PDF document template with QR code.
  • Mail event setup and email sending with attachment.
  • Documentation and source code handover.
  • Technical support for one month after launch.

Contact us to assess your project — we will prepare a commercial proposal within one business day. Order module development — timelines from 20 hours. Our engineers ensure correct fiscalization and integration with any payment systems. Get a consultation on your scenario.

Why is 1C-Bitrix the flagship of e-commerce?

A faceted index on a catalog of 200,000 SKUs is not built — bitrix:catalog.smart.filter takes 4 seconds instead of 200 ms, and the customer leaves. Our online store development on 1C-Bitrix eliminates such scenarios: from infoblock architecture and price types to cluster balancing under peak loads. With over 12 years of experience and 200+ completed e-commerce projects, we have solved every performance bottleneck.

Two-way synchronization with 1C via CommerceML — catalog, prices, balances, orders, and statuses. Configured from the admin panel via the catalog module -> 'Exchange with 1C'. Export to marketplaces via YML feeds (catalog.export) for Yandex.Market, Google Shopping, Ozon, Wildberries. According to Wikipedia, 1C-Bitrix is used by more than 70,000 commercial sites in Russia and the CIS (https://en.wikipedia.org/wiki/1C-Bitrix). Contact us to evaluate your current architecture.

How do we solve key performance problems?

bitrix:catalog.smart.filter without faceted index generates queries that bring down MySQL. Solution: build b_catalog_iblock_index — response time drops from 4 seconds to 100–200 ms. For SEO filters, we use catalog.seo.filter — indexable filter intersection pages with unique meta tags.

Composite cache (bitrix:main.composite) speeds up page loading by 3–5 times compared to regular. Goal — product card TTFB < 200 ms. For sessions we use Redis (SESSION_SAVE_HANDLER = redis in .settings.php). Lazy load images, CDN for static, SQL optimization (especially JOINs on b_iblock_element_property). As noted in the official Bitrix documentation, composite cache delivers a page from HTML, bypassing PHP execution and database requests, giving a speed advantage of up to 5x.

Why is caching critical for an online store?

Each second of page load delay reduces conversion by an average of 7%. At TTFB > 400 ms, 32% of users leave the site. Composite cache delivers a page from HTML, bypassing PHP execution and database requests — this gives a speed advantage of up to 5 times. For product cards with frequent price and stock changes, we use tagged caching: invalidation occurs only for affected entities. In practice, we have reduced TTFB from 1.2 seconds to 180 ms. Time savings on catalog loading — up to 60%.

Store types and their features

Store type Key modules Features
B2C retail catalog.smart.filter, catalog.compare.list, reviews, ratings Faceted index, conversion funnel from card to payment
B2B wholesale dealer prices (b_catalog_group), min. lots, credit limits Personal accounts, quick order by SKU, PDF invoices
Digital goods licenses, subscriptions, files OnSaleOrderPaid -> automatic access granting
Marketplace "Marketplace" module or custom Multiple sellers, separate accounting, commission model
PWA / mobile Progressive Web App, React Native + REST API Offline catalog, push notifications

Integrations: payment systems, delivery, CRM, marketplaces

Payment systems. Handlers in sale.handlers: YooKassa, CloudPayments, Tinkoff, Sberbank, Apple Pay, Google Pay, installment. Callback sale.payment.notify for status confirmation. Delivery. Handlers sale.delivery for CDEK, Boxberry, Russian Post, DPD — real-time cost calculation via API, tracking. Warehouse management. Reservation (RESERVED = Y in b_sale_basket), automatic write-off upon shipment, notifications when stock falls below threshold, pre-order for goods in transit. CRM. Bitrix24 or amoCRM — orders from b_sale_order are sent automatically, client base is synchronized. Triggers: abandoned cart, review request, reactivation. Marketplaces. Export via YML to Ozon, Wildberries, Yandex.Market. Orders flow into a single system. Analytics and marketing. GA4, Yandex.Metrica, email newsletters (Unisender, SendPulse). Logistics. MyWarehouse, Antor — labels, picking lists.

Migration from other CMS

Migration from OpenCart, WooCommerce, Shopify, MODX: transfer of catalog (elements, properties, sections, images, SEO-URLs), migration of client base (b_user) and order history (b_sale_order), 301 redirects via urlrewrite.php. Parallel operation during the transition period — old site sells, new one is accepted. Team experience — 50+ migration projects.

Example migration: from OpenCart with 50,000 products We transferred all data, including custom attributes and review history, in two weeks with zero downtime. The new store was tested in parallel before switching DNS. Result: 25% faster page load and 15% increase in sales.

What is included in the work (deliverables)

Deliverable Description
Technical specification Business requirements, catalog structure, integrations, cart logic
Infoblock architecture Price types, properties, sections, HL-blocks, ORM entities
Components and templates Custom or adapted standard (Component 2.0)
Integrations Payments, delivery, CRM, marketplaces, 1C
Documentation Content filling instructions, REST API, DB schema
Team training Working with admin panel, exports, updates
Warranty Free support 3 months after launch, bug fixes

Stages and timelines

Average project duration — 2 to 4 months:

  1. Analytics (1–2 weeks) — business requirements, catalog structure, integrations, technical specification
  2. Design (2–3 weeks) — prototypes, design system, layouts
  3. Development (4–8 weeks) — components, templates, integrations, content
  4. Testing (1–2 weeks) — functional, load, acceptance
  5. Launch (2–3 days) — deployment, monitoring, operational support

Budget range: from $10,000 for a basic store to $60,000+ for a complex marketplace with multiple integrations. Clients typically see a 20–30% increase in conversion after optimization. Contact us for a precise estimate — we tailor the solution to your specific catalog size and business logic.

Loyalty program and conversion

Bonus system: points for purchases, reviews, recommendations. Accrual rules by categories, points payment limit, expiration period — all in personal account. VIP levels (bronze, silver, gold, platinum) with increased cashback and free shipping. Recommendations 'You may also like', 'Complete your purchase' — built-in Bitrix tools + RetailRocket or Mindbox. Triggers: birthday discount, promo code for return, interest chain. Personalization via catalog.recommended.products and catalog.viewed.products. A/B testing of two card variants on real traffic. Enhanced E-commerce in GA4 and Yandex.Metrica — full path from click to return visit.

Request a free technical audit of your current store. Our engineers will identify performance bottlenecks and migration risks. Order turnkey online store development — get a ready solution with warranty and support.