Skip to main content

Contract Management

Omnitron's flexible and robust content management system enables businesses to create customized mailing templates tailored to specific needs, such as contracts. These templates ensure seamless communication while adhering to legal and operational standards. In this guide, you'll learn how to create a mailing template specifically designed for contract purposes. The process involves setting up the template, configuring its properties, and ensuring it integrates smoothly with frontend endpoints for dynamic usage.

Key Features of Contracts:

  1. Multilingual Support: Specify the language of the template to cater to diverse audiences.
  2. Site-Specific Targeting: Assign templates to multiple sites for broader reach.
  3. Customizable Design: Use HTML to structure and style templates.
  4. Dynamic Fields: Leverage placeholders and model-based data for personalized content.
  5. Active/Passive Control: Easily toggle the status of templates.

This document provides a step-by-step guide to creating mailing templates for Info Contracts and Sales Contracts, accompanied by example configurations and frontend integration details to streamline implementation.

Creating a Mailing Template in Omnitron

To create a mailing template for contracts in the Omnitron system, follow these steps:

  1. Log in to Omnitron.

  2. Navigate to Sales Channels > Content Management > Mailing Templates.

  3. Click the + New Mailing Template button to access the template creation page.

  4. Configure the template settings:

    • Name: Select the "Other" option to manually input the template name. Available names for contracts:
      1. orders/info-contract.html
      2. orders/sales-contract.html
    • Status: Assign a boolean value: Active or Passive.
    • Language: Specify the language of the contract by selecting from the provided list.
    • Sites: Choose the sites where the contract will be displayed. Multiple site selections are allowed.
    • Content: Enter the corresponding HTML file for the contract.

Example Configurations

Info Contract Template:

  • Name: Other > orders/info-contract.html
  • Status: Active
  • Language: English
  • Sites: Akinon.Net
  • Content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Info Contract</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
}
h1 {
color: #333;
text-align: center;
}
p {
margin-bottom: 15px;
}
.section-title {
font-size: 1.2em;
margin-top: 20px;
color: #555;
}
</style>
</head>
<body>
<h1>Information Contract</h1>
<p>This document outlines the terms and conditions of the information contract between the service provider and the client. Please review the details carefully.</p>

<div class="section">
<h2 class="section-title">1. Introduction</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus luctus urna sed urna ultricies ac tempor dui sagittis. In condimentum facilisis porta.</p>
</div>

<div class="section">
<h2 class="section-title">2. Responsibilities</h2>
<p>Nulla facilisi. Aenean nec eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae.</p>
</div>

<div class="section">
<h2 class="section-title">3. Termination</h2>
<p>Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis.</p>
</div>

<p>For more details, contact us at <a href="mailto:support@example.com">support@example.com</a>.</p>
</body>
</html>

Sales Contract Template:

  • Name: Other > orders/sales-contract.html
  • Status: Active
  • Language: Turkish
  • Sites: Akinon.Net
  • Content:
<div id="js-modal-sales" style="position: unset !important; display: block !important; font-size: 12px;">
<h1 style="font-size: 22px; margin-bottom: 1rem;">MESAFELİ SATIŞ SÖZLEŞMESİ</h1>
<div style="font-weight: 700; margin-bottom: 0.75rem !important;">
AKİNON İNTERNET YATIRIM VE PROJE GELİŞTİRME A.Ş. ile TÜKETİCİ arasındaki Sanal Ortamda Mesafeli Satış Sözleşmesi'dir.
</div>
<div style="font-weight: 700;">Madde – 1 KONU</div>
<p style="margin-bottom: 1rem;">
İşbu Mesafeli Satış Sözleşmesi (kısaca “Sözleşme”), satıcının, TÜKETİCİ’ye satışını yaptığı, aşağıda nitelikleri ve satış fiyatı belirtilen ürünün satışı ve teslimi ile ilgili olarak 6502 sayılı Tüketicinin Korunması Hakkında Kanun ve Mesafeli Sözleşmeler Yönetmeliği hükümleri gereğince tarafların hak ve yükümlülüklerini belirlemek amacıyla düzenlenmiştir.
</p>

<div style="font-weight: 700;">Madde - 2 SATICI BİLGİLERİ</div>
<div style="display: flex;">
<div style="flex: 3;">Unvanı</div>
<div style="flex: 9;">AKİNON İNTERNET YATIRIM VE PROJE GELİŞTİRME A.Ş. (Bundan sonra “SATICI” olarak anılacaktır)</div>
</div>
<div style="display: flex;">
<div style="flex: 3;">Adresi</div>
<div style="flex: 9;">YTÜ-Davutpaşa Kampüsü Teknopark Bölgesi B2 Blok D:Kat:2, No: 417, 34220 Esenler/İstanbul</div>
</div>
<div style="display: flex;">
<div style="flex: 3;">Tel</div>
<div style="flex: 9;">(0212) 483 72 45</div>
</div>

<div style="font-weight: 700; margin-top: 1.125rem;">Madde - 3 TÜKETİCİ BİLGİLERİ</div>
<p style="margin-bottom: 1rem;">(Bundan sonra TÜKETİCİ olarak anılacaktır)</p>
<div style="display: flex;">
<div style="flex: 3;">Adı Soyadı / Unvanı</div>
<div style="flex: 9;">
<span class="customer-name">
{{ pre_order.shipping_option.address.first_name }}
</span>
</div>
</div>
<div style="display: flex;">
<div style="flex: 3;">Teslimat Adresi</div>
<div style="flex: 9;">
<span class="shipping-address">
{{ pre_order.shipping_address }}
</span>
</div>
</div>
<div style="display: flex;">
<div style="flex: 3;">Telefon</div>
<div style="flex: 9;">
<span class="customer-phone">{{ pre_order.shipping_option.address.phone_number }}</span>
</div>
</div>
<div style="display: flex;">
<div style="flex: 3;">E-Posta</div>
<div style="flex: 9;">
<span class="customer-email">{{ pre_order.shipping_option.address.email }}</span>
</div>
</div>

<div style="font-weight: 700; margin-top: 1.125rem;">Madde - 4 ÜRÜN BİLGİLERİ</div>
<p style="margin-bottom: 1rem;">
Ürünlerin türü, miktarı, marka/modeli, rengi, adedi, satış bedeli ve ödeme şekli aşağıda belirtilmiştir.
</p>
<div style="display: block; width: 100%; overflow-x: auto;">
<table style="border-collapse: collapse; width: 100%;" border="1">
<thead>
<tr>
<th>Ürün Adı</th>
<th>Marka</th>
<th>Fiyat</th>
<th>Adet</th>
<th>Toplam</th>
</tr>
</thead>
<tbody>
{% for item in pre_order.basket.basketitem_set %}
<tr>
<td>{{ item.product.name }}</td>
<td>{{ item.product.brand }}</td>
<td>₺{{ item.unit_price }}</td>
<td>{{ item.quantity }}</td>
<td>₺{{ item.total_price }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>

Retrieving Contract Details via API

Once the mailing template is created, the frontend must call the appropriate endpoint to retrieve the contract details. This endpoint supports multiple contract types: info or sales, and returns the contract as an HTML file.

GET Retrieve Contract Details

Path: /orders/contract/
Authentication Required: No
Headers:

Content-Type: application/json
Accept-Language: <iso_language_code>

Query Parameters

PropertyDescription
contract_nameSpecifies the type of contract. Accepted values: info sales

Example Request

import requests
import json

url = "https://{commerce_url}/orders/contract/?contract_name=sales/"

headers = {
'Content-Type': 'application/json',
'Accept-Language': '<iso_language_code>'
}

response = requests.get(url, headers=headers)
print(response.text)

Example Response (200 OK)

The response contains the contract in HTML format. The content will render the contract directly as text or a downloadable HTML file, depending on the browser or client.

Example Response (406 Not Acceptable)

This error indicates that the provided template name (contract_name) is invalid.

{
"non_field_errors": "{template_name} is not valid",
"error_code": "template_100"
}

Available Values for HTML File

This section provides a detailed explanation of the dynamic values that can be used within the content of the uploaded HTML file. These values are derived from models such as PreOrder, Basket, BasketItems, Products, and other related entities, enabling a customized experience for users.

Below is a comprehensive list of each field and its associated data structure with descriptions.

PreOrder Model

The PreOrder model contains essential information for the order process, including the basket, delivery, and payment options. The following table outlines the fields available in the PreOrder model and their descriptions:

Field NameDescription
pre_order.basket → BasketThe basket associated with the preorder, containing items to be purchased.
pre_order.shipping_address → AddressThe address where the order will be shipped.
pre_order.billing_address → AddressThe address used for billing purposes.
pre_order.shipping_option → ShippingOptionThe chosen shipping method for the order.
pre_order.payment_option → PaymentOptionThe payment method selected for the preorder.
pre_order.delivery_option → DeliveryOptionThe delivery option chosen for the order.
pre_order.retail_store → RetailStoreThe retail store associated with the order, if applicable.
pre_order.sample_products → ProductThe list of sample products included in the order.
pre_order.bags → ProductThe list of bags included in the order.
pre_order.installment → InstallmentThe installment plan details, if applicable.
pre_order.shipping_amountThe cost of shipping the order.
pre_order.total_amountThe total amount of the order.
pre_order.total_amount_with_interestThe total amount of the order, including interest.
pre_order.loyalty_moneyThe loyalty money or points applied to the order.
pre_order.phone_numberThe contact phone number for the order.
pre_order.delivery_rangeThe expected delivery time range for the order.
pre_order.user_phone_numberThe phone number provided by the user.
pre_order.billing_and_shipping_sameIndicates if the billing and shipping addresses are the same.
pre_order.is_guestIndicates if the order was placed by a guest user.
pre_order.selected_cardThe card selected for the payment.

Basket Model

The Basket model represents the collection of items a user intends to purchase. It also includes details like discounts, quantities, and total costs. Below are the available fields for the Basket model:

Field NameDescription
basket.basketitem_set → BasketItem[]The list of Basket Items in the basket.
basket.discounts → DiscountThe discounts applied to the basket.
basket.total_quantityThe total quantity of items in the basket.
basket.total_amountThe total price of all items in the basket before discounts.
basket.total_discount_amountThe total amount of discounts applied to the basket.
basket.total_product_amountThe total cost of all products in the basket, excluding discounts and taxes.
basket.created_dateThe date and time when the basket was created.

BasketItem Model

The BasketItem model provides detailed information about individual items in the basket, such as product details, quantities, and pricing. The following fields are available:

Field NameDescription
basket.basketitem_set[0].product → ProductThe Product associated with the Basket Item.
basket.basketitem_set[0].shipping_discount → DiscountThe shipping discount applied to the basket item.
basket.basketitem_set[0].datasource_detailed → DataSourceThe detailed information about the Data Source for the product.
basket.basketitem_set[0].tax_rateThe tax rate applied to the Basket Item.
basket.basketitem_set[0].quantityThe quantity of the product associated with Basket Item.
basket.basketitem_set[0].currency_typeThe currency type for pricing.
basket.basketitem_set[0].unit_priceThe price per unit of the product.
basket.basketitem_set[0].total_amountThe total amount for the basket item.
basket.basketitem_set[0].imageThe image URL associated with the product.

Product Model

The Product model contains detailed information about a product, including attributes, pricing, stock, and associated images. Below is a list of fields available for the Product model:

Field NameDescription
product.productimage_set → ProductImage[]The list of Product Image associated with the product.
product.category → CategoryNodeThe category the product belongs to.
product.parent → ProductThe parent product.
product.nameThe name of the product.
product.skuThe SKU of the product.
product.base_codeThe base code of the product.
product.in_stockIndicates whether the product is in stock.
product.priceThe price of the product.
product.retail_priceThe retail price of the product.
product.stockThe available stock quantity for the product.
product.currency_typeThe type of currency. (try, eur)
product.price_typeThe type of price. (default, range_)
product.unit_typeThe unit type for the product. (qty, kg)
product.tax_rateThe tax rate applied to the product.
product.absolute_urlThe URL to access the product details page.
product.attributesThe attributes or specifications of the product.
product.attributes_kwargsAdditional keyword arguments for product attributes.
product.product_typeThe type of the product. (simple, bundle)
product.data_source → DataSourceThe Data Source associated with the product.

ProductImage Model

Field NameDescription
product.productimage_set[0].statusThe status of the product image (active, disabled)
product.productimage_set[0].imageThe URL of the product image.
product.productimage_set[0].orderThe display order of the product image.
product.productimage_set[0].created_dateThe date and time when the product image was created.

Category Node Model

The Category Node model represents the category details of a product or item. Below is the field provided:

Field NameDescription
category.nameThe name of the category.

Discount Model

The Discount model provides information about any discounts applied to a basket or product. Below are the available fields:

Field NameDescription
discount.descriptionThe description of the discount applied.
discount.discountThe amount of the discount.

DataSource Model

The DataSource model contains detailed information about the seller, supplier, or related data entity. Below are the fields available:

Field NameDescription
data_source.nameThe name of the seller.
data_source.slugThe slug for the seller.
data_source.titleThe title for the seller.
data_source.supplier_codeThe supplier code associated with the seller.
data_source.addressThe address of the seller.
data_source.emailThe email address for communication with the seller.
data_source.phone_numberThe phone number for the seller.
data_source.fax_numberThe fax number for the seller.
data_source.kep_addressThe KEP address of the seller.
data_source.mersis_numberThe Mersis Number of the seller.

ByDataSources Model

The ByDataSources model provides information about the list of Basket Items grouped by Data Source associated with an order. Below are the fields included:

Field NameDescription
by_data_sources[0].data_sourceThe supplier code of the seller.
by_data_sources[0].basket_items → BasketItem[]The list of basket items associated with the seller.

Address Model

The Address model provides details about a specific address, such as location, contact information, and whether it’s associated with an individual or a company. Below are the available fields:

Field NameDescription
address.country → CountryThe country associated with the address.
address.city → CityThe city associated with the address.
address.township → TownshipThe township associated with the address.
address.district → DistrictThe district associated with the address.
address.phone_numberThe phone number associated with the address.
address.emailThe email address associated with the address.
address.first_nameThe first name of the person associated with the address.
address.last_nameThe last name of the person associated with the address.
address.lineThe line or street details of the address.
address.titleThe title or label for the address.
address.post_codeThe postal code for the address.
address.notesNotes or additional details about the address.
address.company_nameThe company name, if the address is corporate.
address.tax_officeThe tax office associated with the address.
address.is_corporateIndicates if the address is corporate.
address.identity_numberThe identity number of the individual associated with the address.

Country, City, Township, and District Models

These models define the geographical hierarchy for addresses. Below are the fields:

Country:

Field NameDescription
country.nameThe name of the country.
country.codeThe code of the country.

City:

Field NameDescription
city.nameThe name of the city.

Township:

Field NameDescription
township.nameThe name of the township.

District:

Field NameDescription
district.nameThe name of the district.

ShippingOption Model

The ShippingOption model outlines the details of the shipping method chosen for an order. The following fields are available:

Field NameDescription
shipping_option.nameThe name of the shipping option.
shipping_option.slugThe slug of the shipping option.
shipping_option.logoThe URL for the logo of shipping option.
shipping_option.shipping_amountThe cost of the shipping option.
shipping_option.descriptionThe description of the shipping option.

PaymentOption Model

The PaymentOption model provides information about the payment methods available for an order. Below are its fields:

Field NameDescription
payment_option.nameThe name of the payment option.
payment_option.slugThe slug of the payment option.
payment_option.payment_typeThe type of payment (credit_card, funds_transfer).

DeliveryOption Model

The DeliveryOption model defines the delivery method chosen for an order. Below are the available fields:

Field NameDescription
delivery_option.nameThe name of the delivery option.
payment_option.slugThe slug for the delivery option.
payment_option.delivery_option_typeThe type of delivery option (customer, retail_store).

Installment Model

The Installment model provides details about installment plans used in payment. Below are its fields:

Field NameDescription
installment.price_with_accrued_interestThe total price with accrued interest for the installment plan.
installment.installment_countThe number of installments in the plan.
installment.labelThe label or description for the installment plan.
installment.monthly_price_with_accrued_interestThe monthly payment amount with accrued interest.

RetailStore Model

The RetailStore model provides information about a specific retail store associated with an order. Below are the fields included:

Field NameDescription
retail_store.nameThe name of the retail store.
retail_store.addressThe address of the retail store.
retail_store.township → TownshipThe township where the retail store is located.
retail_store.district → DistrictThe district where the retail store is located.