Transferring content to Bitrix infoblocks. Automatic deployment of projects in php Why should I transfer the project to Bitrix

Obviously, any project must be on the server in order to start its work. The question is how to do it quickly, conveniently and safely.

Automatic deployment of projects (deploy)

What is automatic project deployment (deploy)? For ourselves, we defined it as the process of transferring the code and database structure from the developer’s local machine (“sandbox”, if you like) to the server (or server cluster) on which this project will work in the future. This process also includes various preparatory operations, such as clearing and heating the cache.

Why is it needed? Each of us, on our way, went through different options for transferring a project to a “combat” server: this is ftp (in our memory there were developers who immediately wrote code on the server, interacting with it exclusively via ftp), and sftp, and rsycn, and git pull - all of these methods have many disadvantages, and most importantly, they require monotonous routine work. We decided that it was better to spend this time on development, and entrust all the monotony to the machine.

Deployment system requirements

To begin with, we decided on the requirements for such a system:

  1. it should be possible to deploy a project to several sites at once or to one of them of your choice - for each project we have at least two sites (combat and test), in addition, some projects use a server cluster,
  2. you need to deploy projects from the repository, and, in addition, it should be possible to deploy different branches of the repository to different sites,
  3. it should be possible to quickly roll back to a previous release,
  4. the update process should be as inconspicuous as possible for site users,
  5. the system should be extensible and allow us to introduce any additional operations that we need (installing composer packages, database migrations, etc.),
  6. the system itself must be quickly deployed and configured for any project,
  7. should be written in php - it is obvious that the php developer has an environment set up for working with php and forcing him to set up an environment for working with, for example, ruby ​​for the sake of deployment - heartlessly.

Deployment scripts for php

We started looking for a suitable turnkey solution. Jenkins, Capistrano, etc. were discarded immediately, despite their popularity. We needed a script written in php.

Now, to deploy the project skeleton, it is enough to execute in the console

composer create-project marvin255/bitrix-base

composer create - project marvin255 / bitrix - base

and you will get the entire project structure, the latest versions of composer, rocketeer and bitrixsetup.php. Clean and fast.

How to make it work?

At first, setting up the deployment may seem complicated and unnecessary to you, but we guarantee that you just have to try and you will not be able to refuse rocketeer.

For example, the algorithm from our internal regulations for creating a new project

  1. The developer informs the server specialist that the project needs to be set up, reports the name of the project in Latin characters.
  2. The developer creates a repository in his gitlab account and initiates the project with an empty README.MD file.
  3. The developer clones the repository to his local stand.
  4. The developer creates a folder structure in accordance with article 3 of this regulation and fills in all service files (.gitignore, composer.json, README.MD, etc.) or deploys a standard project using the composer create-project marvin255/bitrix-base command.
  5. The developer copies the bitrixsetup.php file to the web folder and installs "1C-Bitrix: Site Management" using it.
  6. The developer configures the connection of the /vendor/autoload.php file in the /web/local/php_interface/init.php file.
  7. The developer initiates composer with the php composer.phar install command.
  8. The server specialist informs the developer of all the data on the test server.
  9. The developer configures Rocketeer in the project in accordance with article 6 of this regulation.
  10. The developer commits all changes from the local machine to the repository.
  11. The developer on the test server generates an ssh key for the project user using the ssh-keygen command. The key must be created in the standard path ~/.ssh/id_rsa.pub, without specifying a password.
  12. The developer adds the public part of the key created earlier to the deploy keys of the project in the corporate gitlab.
  13. The developer adds the corporate gitlab domain to the authorized_keys for the project user.
  14. The developer creates shared/web/upload and shared/web/bitrix/backup folders on the test server in the home folder of the project.
  15. The developer creates the shared/web/bitrix/.settings.php and shared/web/bitrix/php_interface/dbconn.php files on the test server in the project's home folder and specifies the correct data for connecting to the server database in them.
  16. The developer transfers the database using a dump from the local machine to the test server.
  17. The developer enters the project folder on his local stand on the command line and executes the php rocketeer.phar deploy command.
  18. The developer checks the performance of the test site.

If you need to implement a project, you can create a group, invite only those employees who are related to this project to it, set tasks for them, and upload the necessary files. Groups help to group all data, tasks, files, messages, appointments in one place. You can always view what actions, what tasks were performed in a particular group.

There are groups and projects in Bitrix24. The main difference between a group and a project is that in a project, you can set the deadlines for the implementation of the project, the deadlines for tasks in the project cannot go beyond the deadlines of the project.

Therefore, if you need specific deadlines in the project, then when creating a group, you can select the type of group - Project. If timing is not important, then it could be a regular working group.

You can read more about creating a group or project.

2. Who can create groups and projects?

Each employee can create a group or project and invite members to it. The number of groups and projects in Bitrix24 is unlimited for all tariffs.

3. How to view all groups (projects) that are on the portal?

All groups on the portal can be viewed by an employee with administrator rights. For this you need.

4. How to archive a group (project)?

To do this, in the group tab Main select menu Actions and in it the paragraph Edit group (project). In the window that opens, mark Group (project) type: Archival.

Archived groups and projects are not displayed in the general list of groups. You can find them by filter Archival or with a search query.

You can return the archive group (project) to work in a similar way - uncheck the group type Archival.

5. How to delete a group?

To delete a group, select in the groups tab Main menu item Actions > Delete Group:

After clicking, a confirmation form for deleting the group will open.

If some tasks are attached to a group (project), then you must first unpin or delete tasks, and then you can delete the group (project) itself.

6. How to delete a group (project) that belongs to a terminated employee?

The portal administrator can delete such a group. To do this, on the page My page and further on the menu Actions select item Delete group:

If a group or project is still needed, then you can simply change the owner of the group (project manager) through the menu Actions: either in Editing a group (project), either in Editing the composition.

7. Is it possible to prevent members of a group (project) from seeing each other?

If you need to divide the visibility of employees by groups, there is a function Extranet (external users), which is available on Bitrix24 commercial tariff plans. This tool allows you to work with external employees, invite them to groups (projects) and conduct all work within the group. At the same time, internal and external employees will see each other only if they are members of the same extranet group (project).

Moreover, if you have several extranet groups (projects), then the participants do not see each other among themselves.

8. How to invite an extranet user to a group (project)?

Users can be invited either directly when creating a working group (project), or at any time after creating a working group (project) on the tab Main pages of an existing group or project (menu Actions > Invite to Group).

Clients turn to us not only to create a new website, but also to redesign an existing one. There are three main reasons why the site needs to be updated:

  1. A new corporate identity has been developed. The site needs to be adjusted.
  2. The cost of site support has reached critical values ​​and it is required to optimize this expense item.
  3. We need to add new big functionality, and the existing architecture is not flexible enough.

Of course, there are various combinations of these causes. As a rule, we recommend that clients simultaneously with an external update, transfer the site to Bitrix. This will provide great opportunities for the development of the project in the future, reduce dependence on contractors and gain access to the Marketplace - a platform with proven solutions that allow you to quickly and cheaply expand the functionality of your site.

The first question we hear from clients is “How much does it cost to move to Bitrix?”. The answer will depend on which project we are migrating and how much functionality we end up adding. For a site selling goods and services, the cost of the 1C-Bitrix license will at least depend on this.

However, our practice shows that redesigning a site and relaunching it on a new CMS is more expensive than creating a site from scratch on the same one. This happens due to the following circumstances:

  1. The need to transfer all content from the old site. At the same time, the greatest problems arise with the catalogue, users and orders. In addition to the fact that it is necessary to preserve the integrity of the database, that is, all data and connections between them, it is extremely important to preserve the structure of the url and the final addresses of the pages. Indeed, for sites that have good visibility in search engines, the option of maintaining addressing is preferable than setting up 301 redirects to new addresses.
  2. Often, along with the transfer of data, the transfer of specific functionality is required, for example, calculators, discount systems, etc. The difficulty lies in the fact that the copied functionality is not documented, may contain errors (especially in the boundary conditions) and, often, the client, along with the transfer, wants to improve it a little.
  3. Creation of a development infrastructure and the need to update it before launch. This means that once you create a complete copy of the old site data and start development, which will take a couple of months at best, you will need to update the data before launching the project. For example, the nomenclature, prices and balances of goods, the list and orders of users.
  4. Connection to external systems. A large number of pitfalls can be hidden here. It happens that the client cannot update the exchange module in his 1C accounting system, and you just need a new module to set up synchronization with 1C.
  5. Accurate and thorough launch of the site on the main domain. One mistake that may not have any consequences when launching a new site can lead to serious problems when redesigning.

Summarizing the above, we can say that the transfer of a site to Bitrix, combined with a redesign, is a more complex and expensive procedure than developing a new site. In complex cases, the difference can reach 100%, in other words, it will cost you twice as much as creating a project from scratch. We already wrote earlier about the formation of value, when creating an e-commerce project.

Compared to stores, for corporate sites, the difference in labor intensity between creating a new site and redesigning an old one combined with a platform change will be lower, and for portal-type sites, the difference will be slightly higher.

If you do not change the management system, then it will probably be better to continue to cooperate with your contractors and focus on their approach to pricing work.





For all the time of my work with Bitrix, I had a chance to work with a very large number of projects that someone developed before me. Here are minor improvements, fixing various bugs and errors in the operation of logic, redesigning the site and global changes in existing functionality. And, like any other developer, I hate to sort out other people's garbage, crutches and "temporary" patches that actually remember the 8th edition of the product.

Here I will try not to focus on the standard “worst practices” when programming in PHP, such as not giving a damn about the choice of variable and function names, unnecessary queries to the database in a loop, lack of validation of user data in forms, ignoring comments, and the like. I will try to touch on exactly the moments inherent in the development on Bitrix, which later will allow you to avoid indignation and curses against you from the programmer who had to accompany your code. And yes, often you yourself will turn out to be this programmer in a year or more, when you have completely forgotten why you inserted this or that crutch here.

“Write code as if it were accompanied by a violent psychopath who knows where you live” (c) John F. Woods
First, and most, in my opinion, the most important - for heaven's sake, use the local folder. This is simply vital when using the version control system - all you need is to add the /bitrix/ folder to the exclusions. All. Further, almost all development is carried out only in it. This greatly simplifies the search for the necessary files and components later, helps not to clog the repository with unnecessary files, and in general - brings the project tree into a neater, “human” look.

Do not modify the kernel. Even if you are sure that it will not be updated. Even if it's faster. Even if you are lazy. Forget this thought, like a bad dream. If you need to change the logic of a standard component, move it to a new namespace /local/components/modify/ and work with it. The same goes for modules, gadgets, and business process activities.

Do not pollute the init.php file. Combine functions for working with a specific module or functionality into a class, write this entire class in a separate file, and in init.php just include these files and write event handlers. I have seen init.php files of 500Kb each, where functions, constant definitions, classes, and initialization of handlers were mixed into a mess. Of course, when I had to deal with these files, I cursed my predecessors.

The next paragraph does not apply to the case of developing ready-made solutions for the Marketplace, when the goal is to make the most customizable functionality from the public part for the end user. If you are working on a specific project, for a specific TOR - you should not try to make a unified template for a component for all occasions. Personally, I adhere to the philosophy - it is better to have several simple templates used for different purposes than one universal one, but in which the devil himself will break his leg later. Of course, in each specific case, you need to build on what is - the terms of reference, implementation options, and the like, but you still should not forget about Occam's Razor. As an example, I will give one project of a leasing company that I happened to edit. The project itself, of course, was implemented terribly, the real horror was in the pages of the service catalog section. Each of the five sections had its own layout, which differed both in the position of the blocks on the page and, in principle, the presence of some of them. And for all five pages, one template was used with a bunch of if-else, duplicating component calls, connecting styles and scripts, which, moreover, periodically conflicted with each other. As a result, a huge file, in which it was like death to understand “without half a liter”. Although, it would seem, what prevented you from making 5 different templates and not creating difficulties out of the blue?

Use the API. Don't reinvent the wheel where it's not needed. Use the documentation - the whole product is quite well described, as well as each function can be viewed in detail on bxapi.ru.

Avoid direct database queries. This is a special case of the previous point - use the API. Rough, unsecured requests can lead to data corruption, loss, or even compromise.

Do not use CNC components from the site root. The consequences are usually quite unfortunate, since the CNC uses an address handler file, trying to use it from the root easily breaks you the addressing of other components, as well as 404 pages. It won't hurt anything if your articles are addressed relative to the /articles/ folder, and products relative to /catalog/.

Include css and js using the API. Until now, everywhere I meet the connection of scripts and styles using html tags. Use the \Bitrix\Main\Page\Asset class object and the addJs() and addCss() functions. This will allow you to merge files and, later, cache them with one click of the checkbox in the settings of the main module

And finally, the error concerns not only Bitrix, but too often I began to encounter problems associated with it. Check for emptiness array with sample results. As an example, the last time I encountered this problem was when working with one online store. Complaint: Pages sometimes take 16 seconds to load. With what it is connected - it is not clear. By trial and error, I found out that pages load indecently for a long time only when the basket is empty. It seemed like why? As it turned out, when hovering over the basket, a pop-up window appeared in which images of the product put in the basket were displayed. So what did the previous developer do? I took the result of the work of the “small basket” component and in the file result_modifier.php made a call to GetList() of products to select images with a filter from the array of product IDs, then added the src of the image from the results of the selection to the array of the corresponding product. As a result, when there were no goods in the basket, the filter went empty, and the ENTIRE catalog of goods fell into the selection. Well, then the cycle for each and ... we have what we have. It is clear that at the development stage, with 15 test products, this was imperceptible, and problems arose already in combat conditions. Although, it would seem that it was worth putting a check on empty($arResult[‘ITEMS’])…

This concludes my personal “worst practice” top regarding Bitrix development. If at least someone this information helps to avoid mistakes in the future and improve their development style, then it was not in vain.

You can help and transfer some funds for the development of the site

Stanislav Shashalevich

The time has come when business owners do not need to explain why they need a website or an online store. Now they absorb it on their own at the stage of business formation. It's time to explain to the client: what CMS is the platform better suited to his business? And it is much more difficult to explain this, when the client already has a project on his platform, then convincing him of the need to switch to another platform is a very difficult task. But, in our opinion, with the platform 1C-Bitrix this task is much easier to solve than with other e-commerce platforms.

Therefore, we invite you to consider 10 reasons why you need to switch to 1C-Bitrix.


1. 1C integration

This is one of the most pleasant "goodies" of the 1C-Bitrix platform. In 2007 Bitrix established a joint venture with "1C""1C-Bitrix". In our opinion, it is this fact that has given the active development of this platform. A new era has come when 1C integration has turned from a complex task into a clear scheme of simple actions.

On the Internet, you can find "horror stories" in which integration into Bitrix is ​​presented as something complicated and expensive. In fact, such “horror stories” are invented by those who do not know very well all the nuances of integration and 1C itself. Integration problems can only occur in the following cases:

  • The site template was developed without understanding the features 1C integration
  • 1C itself is already well sawn
  • Low qualification of developers
If we have a standard site from 1C-Bitrix and standard 1C, then there should not be any problems with integration. The uniqueness and complexity of your internal business processes adds complexity to 1C integration. But it's not the fault Bitrix are the characteristics of your company.

And as proof of our innocence, we provide a video tutorial in which our experts show how to make integration with1COnly for30 minutes. And no tricks. Only facts!

2. CRM integration

If 1C-integration no longer surprise anyone and this is a mandatory functionality of any e-commerce systems, then CRM integration is just gaining momentum. But here too Bitrix trying to be ahead of everyone.

In the box 1C-Bitrix there is already a standard functionality for synchronizing data with CRM Bitrix24. This allows the sales team to work more efficiently with leads, deals, and new contacts. Right out of the box, you get a ready-made sales tool.

A very topical topic at the moment, which, moreover, is the main argument for transferring the project to Bitrix already in 2017.

WITH February 1, 2017 year, cash registers must send electronic versions of receipts to the fiscal data operator - the new rules are established in 54-FZ, article 2, paragraph 2.

The law will come into full force July 1, 2017. Each online store must have a cash register (CRE) connected to the Internet and connected to a fiscal data operator (OFD).

What does this mean? In simple words, with July 1, 2017 years for each order paid online (not against an invoice) through your online store, you need to knock out KKM check, enter it into the site database, send it electronically to the buyer, and even provide a lot of data immediately to the tax office. And all this takes all 5 minutes otherwise you will be fined.

How do you like this problem? In our opinion, it is very nontrivial. What we like about Bitrix is that it responds promptly to all market changes. He does not dwell on the idealization of his product, but simply measures the pulse of all the components e-commerce and responds instantly.

Here and here 1C-Bitrix promptly responded and immediately implemented functionality that satisfies all requirements 54-FZ. As far as we know, at the moment Bitrix is ​​testing the link on its own site: online store - cash register - tax authorities. Therefore, to July 1 we will be fully armed with Bitrix.

We believe that this is a very weighty argument for transferring the project to the platform 1C-Bitrix exactly at 2017- full compliance 54-FZ. We think that in this regard there will be problems for many paid e-commerce platforms, not to mention free ones. The business owner will simply need to pay attention to 1C-Bitrix to securely close the issue with 54-FZ.

4. Marketing tools

We've all heard about marketing skills. 1C-Bitrix. Someone, quietly envious, says that this is the main component of the success of this company. But let's not envy, but just learn from experience Bitrix. Fortunately, the company itself 1C-Bitrix gladly shares all his tools directly in the platform itself.

Now we will tell you about the most interesting, in our opinion, marketing tools that will add points in favor of making a decision to transfer the project to Bitrix:

  • email marketing. They will allow you to work with buyers in automatic mode through mailing lists. Already prepared scripts for chains of trigger emails motivate the client to return to the site and place new orders.
  • Commodity marketing. Motivating customers with promotions and discounts has always had a positive effect. And Bitrix offers flexible configuration options to be able to influence each user group.
But marketing from Bitrix are not just tools sewn into a box. This is a set of materials aimed at improving the client's education in online sales. This is a set of systematic actions that will help your store gain momentum.

5. SEO Tools

SEO- was, is and will be an important tool for attracting traffic to the site. We, as developers of our own SEO solutions, we pay special attention to this.

Unfortunately until 2013 SEO platform component 1C-Bitrix was very underdeveloped. It was not possible to flexibly generate regular meta tags, let alone more complex tasks. But since version 14 Bitrix everything has changed. Now SEO platform tools include:

  • Meta tag templates
  • Smart sitemap generation
  • Robots.txt generation
  • Sending unique text to Yandex
  • And much more
Now we can say with confidence that the platform 1C-Bitrix will be a great help for SEO Specialist.

big data- it is now not only fashionable, but also necessary. The buyer will no longer appreciate just an offer to purchase goods in an online store. The buyer will appreciate if the store offers exactly what he needs. That's what these services are for.

Company Bitrix and reacted promptly in this direction and launched its own cloud service "1C-Bitrix BigData". This allows you to make personal offers to the client, that is, by analyzing his behavioral actions according to certain algorithms, to offer the goods he needs. The withdrawal of personal goods can occur both in the public part of the site and in mailing lists.

Please note that a similar service from Bitrix will not only increase your sales, but also have a positive effect on increasing loyalty to your online store.

7. Affiliate network

Affiliate network is what makes it grow 1C-Bitrix. Now there are more than 13,000 partners in the network. And every day there are more and more of them.

What does such an extensive network give a business?

Firstly, you get the opportunity to select a developer according to the following parameters:

  • Project budget
  • Qualification and expertise of the developer
  • Regionality
Secondly, there is no link to a specific developer, who, due to the self-written system, allows you to dictate your terms. The affiliate network removes such restrictions and makes your project alienable, that is, virtually any partner can accept it 1C-Bitrix.

As for the choice of a direct partner, in our opinion, this is the most important and responsible stage. It depends on him how your project will turn out. Bitrix, of course, is trying to somehow filter and find suitable developers for you, but, as we think, so far this has not always worked out well. Same status "Gold Partner" does not give any guarantees to your project. After all, as we believe, the entry threshold for obtaining this status is too low and it would be worth raising it.

Although this is not the topic of the current article, nevertheless, based on the above, we can give you a couple of recommendations:

  • Partner cases. Carefully familiarize yourself with the projects that the developer has already implemented, similar in theme to yours. Ask clarifying questions about cases. Do not be shy.
  • Expertise. Be sure to check the qualifications of the partner. Testing starts with the first touch. With competent clarifying questions, the partner will reveal your project, and with his convincing answers to questions, he will break all your doubts.
We will try to cover this topic in more detail in future articles. The problem is very important. After all, often because of unscrupulous partners, all the negative spills out to the side. Bitrix. In order to somehow justify themselves, alleged flaws and omissions of the platform itself are invented. The whole community suffers from such partners 1C-Bitrix. It is after such developers that the owners of online stores do not want to work with Bitrix at all.

8. E-commerce platform #1

Paradoxically, this is the simplest and most important argument in favor of switching to Bitrix.



From the graph, it can be seen that about 60% of the market commercial CMS now occupied by the company 1C-Bitrix. And 6 out of 10 are unlikely to be wrong. They made their choice by carefully analyzing all the pros and cons of the product. Now it is much easier for you to make the right decision by following their example.

I would like to wish Bitrix so that he does not stop there and tries not only to maintain the current market share, but also to increase it. And there is room to grow: 40% of the commercial CMS market + free systems. 1C-Bitrix simply obliged to create such conditions and such a platform that you just want to switch to.

9. 1C-Bitrix.Marketplace

We decided to save the best for later. Creating your own sales platform Marketplace in 2011 opened before 1C-Bitrix new opportunities. After all, thanks to this step, popularization Bitrix has increased both among developers and directly among online sales participants. And there are several reasons for this:

  • Typical solutions - Quick start of sales. After launch 1 WITH-Bitrix.Marketplace there was a big boom in standard template solutions. Thanks to this, clients really launched online stores from several days to weeks, instead of many months and expensive projects from scratch. This allowed them to quickly gain experience in online sales and have a more conscious and professional attitude towards the development of their project.
  • Increasing the functionality of 1C-Bitrix. Now what he can't do himself Bitrix are made by his partners. This expands the possibilities of the platform and makes them almost limitless.
  • Raising the qualifications of developers.The site opened up new opportunities directly for performers. Thus, it contributed to the growth of qualification of technical specialists in the development of solutions for 1C-Bitrix.
Now Marketplace everything is also replete with ready-made solutions and modules. However, the quality of many of them leaves much to be desired. Therefore, we can give you one useful piece of advice for free: before purchasing a solution, be sure to test its operation on your project. Make sure the module has demo mode. If there is no such mode, then ask the developer for the opportunity to test his solution. Personally, we don't even consider products that don't have demo mode. We recommend the same to all our clients. There is no desire to acquire a "pig in a poke". The owner of an online store needs to: ignite, interest and convince. A demo mode- just the tool that can do it.

10. Constant development and updates

As mentioned above, 1C-Bitrix carefully monitors all trends and changes e-commerce market. You get not just a product that is relevant only for today, as it happens with self-written CMS– you get a constantly evolving platform.

When you get a year of free updates. This means that during this time your project will always be up to date. And if you purchase 1C-Bitrix products through us, then you also receive bonuses in the amount of 20% of the order amount, which you can spend on purchasing our modules.

I would like to note that the Bitrix there is a specific rule that has not been violated for a long time: two global releases of updates per year. This means that specific dates and deadlines for the implementation of these updates are already set in advance. On the appointed dates, the presentation of the release is carried out, and immediately after that, its systematic implementation. This model of work is very effective. It motivates the development department to get rid of code idealization and helps to quickly deliver results directly to the owner of the online store.

Here, it seems, we can stop. Total 10 reasons but every reason Bitrix"suffered". Each reason has stood the test of time, failed experiments, failed hypotheses. We hope that 1C-Bitrix will give us new reasons to work on this particular platform.

Share with friends or save for yourself:

Loading...