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:
- Multilingual Support: Specify the language of the template to cater to diverse audiences.
- Site-Specific Targeting: Assign templates to multiple sites for broader reach.
- Customizable Design: Use HTML to structure and style templates.
- Dynamic Fields: Leverage placeholders and model-based data for personalized content.
- 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:
Log in to Omnitron.
Navigate to Sales Channels > Content Management > Mailing Templates.
Click the + New Mailing Template button to access the template creation page.
Configure the template settings:
- Name: Select the "Other" option to manually input the template name. Available names for contracts:
orders/info-contract.html
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.
- Name: Select the "Other" option to manually input the template name. Available names for contracts:
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
Property | Description |
---|---|
contract_name | Specifies 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 Name | Description |
---|---|
pre_order.basket → Basket | The basket associated with the preorder, containing items to be purchased. |
pre_order.shipping_address → Address | The address where the order will be shipped. |
pre_order.billing_address → Address | The address used for billing purposes. |
pre_order.shipping_option → ShippingOption | The chosen shipping method for the order. |
pre_order.payment_option → PaymentOption | The payment method selected for the preorder. |
pre_order.delivery_option → DeliveryOption | The delivery option chosen for the order. |
pre_order.retail_store → RetailStore | The retail store associated with the order, if applicable. |
pre_order.sample_products → Product | The list of sample products included in the order. |
pre_order.bags → Product | The list of bags included in the order. |
pre_order.installment → Installment | The installment plan details, if applicable. |
pre_order.shipping_amount | The cost of shipping the order. |
pre_order.total_amount | The total amount of the order. |
pre_order.total_amount_with_interest | The total amount of the order, including interest. |
pre_order.loyalty_money | The loyalty money or points applied to the order. |
pre_order.phone_number | The contact phone number for the order. |
pre_order.delivery_range | The expected delivery time range for the order. |
pre_order.user_phone_number | The phone number provided by the user. |
pre_order.billing_and_shipping_same | Indicates if the billing and shipping addresses are the same. |
pre_order.is_guest | Indicates if the order was placed by a guest user. |
pre_order.selected_card | The 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 Name | Description |
---|---|
basket.basketitem_set → BasketItem[] | The list of Basket Items in the basket. |
basket.discounts → Discount | The discounts applied to the basket. |
basket.total_quantity | The total quantity of items in the basket. |
basket.total_amount | The total price of all items in the basket before discounts. |
basket.total_discount_amount | The total amount of discounts applied to the basket. |
basket.total_product_amount | The total cost of all products in the basket, excluding discounts and taxes. |
basket.created_date | The 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 Name | Description |
---|---|
basket.basketitem_set[0].product → Product | The Product associated with the Basket Item. |
basket.basketitem_set[0].shipping_discount → Discount | The shipping discount applied to the basket item. |
basket.basketitem_set[0].datasource_detailed → DataSource | The detailed information about the Data Source for the product. |
basket.basketitem_set[0].tax_rate | The tax rate applied to the Basket Item. |
basket.basketitem_set[0].quantity | The quantity of the product associated with Basket Item. |
basket.basketitem_set[0].currency_type | The currency type for pricing. |
basket.basketitem_set[0].unit_price | The price per unit of the product. |
basket.basketitem_set[0].total_amount | The total amount for the basket item. |
basket.basketitem_set[0].image | The 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 Name | Description |
---|---|
product.productimage_set → ProductImage[] | The list of Product Image associated with the product. |
product.category → CategoryNode | The category the product belongs to. |
product.parent → Product | The parent product. |
product.name | The name of the product. |
product.sku | The SKU of the product. |
product.base_code | The base code of the product. |
product.in_stock | Indicates whether the product is in stock. |
product.price | The price of the product. |
product.retail_price | The retail price of the product. |
product.stock | The available stock quantity for the product. |
product.currency_type | The type of currency. (try, eur) |
product.price_type | The type of price. (default, range_) |
product.unit_type | The unit type for the product. (qty, kg) |
product.tax_rate | The tax rate applied to the product. |
product.absolute_url | The URL to access the product details page. |
product.attributes | The attributes or specifications of the product. |
product.attributes_kwargs | Additional keyword arguments for product attributes. |
product.product_type | The type of the product. (simple, bundle) |
product.data_source → DataSource | The Data Source associated with the product. |
ProductImage Model
Field Name | Description |
---|---|
product.productimage_set[0].status | The status of the product image (active, disabled) |
product.productimage_set[0].image | The URL of the product image. |
product.productimage_set[0].order | The display order of the product image. |
product.productimage_set[0].created_date | The 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 Name | Description |
---|---|
category.name | The 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 Name | Description |
---|---|
discount.description | The description of the discount applied. |
discount.discount | The 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 Name | Description |
---|---|
data_source.name | The name of the seller. |
data_source.slug | The slug for the seller. |
data_source.title | The title for the seller. |
data_source.supplier_code | The supplier code associated with the seller. |
data_source.address | The address of the seller. |
data_source.email | The email address for communication with the seller. |
data_source.phone_number | The phone number for the seller. |
data_source.fax_number | The fax number for the seller. |
data_source.kep_address | The KEP address of the seller. |
data_source.mersis_number | The 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 Name | Description |
---|---|
by_data_sources[0].data_source | The 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 Name | Description |
---|---|
address.country → Country | The country associated with the address. |
address.city → City | The city associated with the address. |
address.township → Township | The township associated with the address. |
address.district → District | The district associated with the address. |
address.phone_number | The phone number associated with the address. |
address.email | The email address associated with the address. |
address.first_name | The first name of the person associated with the address. |
address.last_name | The last name of the person associated with the address. |
address.line | The line or street details of the address. |
address.title | The title or label for the address. |
address.post_code | The postal code for the address. |
address.notes | Notes or additional details about the address. |
address.company_name | The company name, if the address is corporate. |
address.tax_office | The tax office associated with the address. |
address.is_corporate | Indicates if the address is corporate. |
address.identity_number | The 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 Name | Description |
---|---|
country.name | The name of the country. |
country.code | The code of the country. |
City:
Field Name | Description |
---|---|
city.name | The name of the city. |
Township:
Field Name | Description |
---|---|
township.name | The name of the township. |
District:
Field Name | Description |
---|---|
district.name | The 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 Name | Description |
---|---|
shipping_option.name | The name of the shipping option. |
shipping_option.slug | The slug of the shipping option. |
shipping_option.logo | The URL for the logo of shipping option. |
shipping_option.shipping_amount | The cost of the shipping option. |
shipping_option.description | The 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 Name | Description |
---|---|
payment_option.name | The name of the payment option. |
payment_option.slug | The slug of the payment option. |
payment_option.payment_type | The 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 Name | Description |
---|---|
delivery_option.name | The name of the delivery option. |
payment_option.slug | The slug for the delivery option. |
payment_option.delivery_option_type | The 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 Name | Description |
---|---|
installment.price_with_accrued_interest | The total price with accrued interest for the installment plan. |
installment.installment_count | The number of installments in the plan. |
installment.label | The label or description for the installment plan. |
installment.monthly_price_with_accrued_interest | The 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 Name | Description |
---|---|
retail_store.name | The name of the retail store. |
retail_store.address | The address of the retail store. |
retail_store.township → Township | The township where the retail store is located. |
retail_store.district → District | The district where the retail store is located. |