The main thing to be careful about is limiting the code length to a maximum of 8192 characters.
This limitation relates to each of the 4 sections: Header, Footer, Completed order and Robots.txt.
If you exceed the limit, your modifications will not be saved.
If you want to insert a longer code, you must upload the code file via the FTP client and link to that part of the codes.
You must use an FTP client that can work with a secure SFTP protocol. We recommend using WinSCP or FileZilla clients.
First, you need to create a connection in administration, in Settings → Hosting → FTP menu.
When editing a file for uploading and linking, make sure that you have set up UTF-8 encoding in your editor. This will prevent the Czech characters from becoming displayed as �.
The link to a file with longer code can be as follows, in JavaScript: <script src="/user/documents/modification.js" type="text/javascript"></script>
Or in case of CSS, as follows: <link href="/user/documents/style.css" rel="stylesheet" />
By adding ?v=CISLO_VERZE
behind the file path, you can force the current file to load. For example for the fourth version of the current JavaScript, you can write the link as follows:
<script src="/user/documents/modification.js?v4" type="text/javascript"></script>
For new addons versioning use Shoptet Bender https://github.com/shoptet/shoptet-bender/
When debugging a new CSS or JavaScript, you can use the DEBUG_TIMESTAMP
placeholder to force the current file to load each time you refresh the page, this will only apply if you are logged as an administrator:
<script src="/user/documents/modification.js?v=#DEBUG_TIMESTAMP#"></script>
In order for DEBUG_TIMESTAMP
to function, it is necessary to create a cookie debugTimestamp
. At the console, enter:
shoptet.cookie.create('debugTimestamp', 1, {days: 1});
Be extremely careful if you are using XHR requests (not only) to our web servers in your scripts. Always check Network -> XHR
in browsers console to ensure that XHR requests are not unnecessarily duplicated or multiplicated.