Let's start creating a "Chat-Bot-Shop in Telegram" with the development of a technical task, without using any templates, but in a simple way, for ourselves.
First of all, let's decide what we want to get as a result. I imagine this as a product catalog, where the user can view the product card, add the product to the cart, and complete the purchase without leaving the messenger.
This will be a bot with the minimum required set of functions, for informational purposes, in the future you can expand the functionality of the bot to suit your needs.
We will fill the content through the bot itself, for this we will need to make an administration system, and also organize access rights to the admin chat.
Let's make it possible to add categories and product cards. We will not edit the product and categories; if necessary, this can be finalized outside the scope of the articles. Adding and editing information in the Help section.
Bot sections:
The user's account will store personal data necessary for making a purchase. Filling in the data must be made available both when making a purchase, and simply in the Personal Account section.
Data:
Navigation through the catalog should be convenient and intuitive. It is necessary to implement the ability to move not only deep into the directory, but also one step back. This should also work in any other section of the bot.
cart The shopping cart allows you to add the goods of interest to it and complete the purchase. The basket must contain management tools:
In this section, you can place information about the store, support service, feedback methods and more.
As we move forward, we will either supplement or exclude something in the TOR. We will write the code in our already known index.php file (this is the file that we have webHook configured for ), get acquainted with PDO
There will also be at least one table for an intermediate record of the user's steps, that is, we need to understand for what purpose the information came from the user, whether it is a text for editing a surname, or for the Help section.
Ok, that's enough for today. In the next article, we will go straight to practice.
First of all, let's decide what we want to get as a result. I imagine this as a product catalog, where the user can view the product card, add the product to the cart, and complete the purchase without leaving the messenger.
This will be a bot with the minimum required set of functions, for informational purposes, in the future you can expand the functionality of the bot to suit your needs.
We will fill the content through the bot itself, for this we will need to make an administration system, and also organize access rights to the admin chat.
Let's make it possible to add categories and product cards. We will not edit the product and categories; if necessary, this can be finalized outside the scope of the articles. Adding and editing information in the Help section.
Bot sections:
- Personal account
- Catalog
- Basket
- Help
Now more…
Personal Area.The user's account will store personal data necessary for making a purchase. Filling in the data must be made available both when making a purchase, and simply in the Personal Account section.
Data:
- First Name Last Name
- Telephone
- Delivery address
Navigation through the catalog should be convenient and intuitive. It is necessary to implement the ability to move not only deep into the directory, but also one step back. This should also work in any other section of the bot.
- Category
- Card Product
- Name
- Picture (1 piece, if desired, can be expanded)
- Description including specifications
- Price
- unit of measurement
- Card Product
cart The shopping cart allows you to add the goods of interest to it and complete the purchase. The basket must contain management tools:
- Remove item from cart
- View all items in the cart
- Increase / decrease the quantity of goods
- Checkout
- Delivery address
- Telephone
- Last name First name
- Payment
- Online (let's try Yandex.Checkout or QIWI)
- Upon receipt of the goods
- Purchase Preview
In this section, you can place information about the store, support service, feedback methods and more.
As we move forward, we will either supplement or exclude something in the TOR. We will write the code in our already known index.php file (this is the file that we have webHook configured for ), get acquainted with PDO
Database tables
Personal Area- id - unique identifier
- user_id - user id in Telegram
- first_name - username
- last_name - last name of the user
- phone - user's phone
- adress - delivery address
- Categories
- id - unique identifier
- name - directory name
- Card Product
- id - unique identifier
- parent - parent category
- name - product name
- description – product description
- image_tgr - product image in the telegram database
- image - product image on a non-third-party server
- price - item price
- unit - unit of measure
- id - unique identifier
- product_id - product id
- product_count - product quantity
- user_id - user id
- description – section description
You must reply before you can see the hidden data contained here.
Ok, that's enough for today. In the next article, we will go straight to practice.
You must reply before you can see the hidden data contained here.