JavaScript for a site on Tilda Publishing

tilda-add-parameters

Honestly, I’m not a big fan of site builders. Customization of sites created based on such builders, leave much to be desired. I would advise if you want to make a site without programming knowledge – use WordPress.

But my opinion is just my opinion. My old friend, with whom I started working in 2014 as an accountant, adapted to create custom-made websites using the Tilda Publishing. He bought a paid tariff and about five sites for himself and customers made. By the way, the sites are beautiful, although they load quite a long time.

But, but, there is always some kind of “but.” The functionality of even fancy builders like Tilda, of course, is limited. No access to PHP-code, server settings, database and other things familiar to programmers. You can only insert own HTML-blocks, add CSS and JavaScript.

And with such initial data, I was very persistently asked to radically change the price calculation and add additional characteristics to the products. More specifically, it was required that for certain order amounts, prices change. Up to 50 thousand rubles – retail prices, from 50 thousand to 100 thousand – wholesale and retail, over 100 thousand – wholesale. Also, each product had to have four characteristics, while the Tilda constructor provided an opportunity for a maximum of three parameters. Each of these characteristics affects the price.

In general, a simple task, if not for the above limitations of the site builder. But complaining is useless, and so on Javascript came to help.

How glad I am that I studied this language diligently at one time. Thanks to the great learning site learn.javascript.ru, as well as the authors of the book “jQuery in Action”. The problem was solved and solved quickly enough. The final script, after refactoring, amounted to only about a hundred lines of code.

Yes, there is a category of customers who think that more code there is, the better programmer is. But in reality, of course, the opposite is true. The fewer lines of code that solve the task, the better. In the future, such code is easier to maintain and make the necessary changes.

Fortunately, my customer was satisfied, and I briefly plunged into the world of site builders))