📜 ⬆️ ⬇️

PDF price generation and automatic image linking

Recently, our designer implemented the function of automatically creating price lists in PDF format. This is a useful feature for online stores whose sellers want to upload fresh price lists for download, as well as convenient printing of all product offers (or those that fit the specified filters) and creating paper prices that are conveniently put together with the order to the customer.

Export settings

There are a lot of settings for exporting to pdf: selection of columns, filters by sections, price, brands, product options, etc. Best of all will show a screenshot:

At the exit can get such a price.

Binding images to products

Generation of prices allowed more convenient to work with another useful function - image linking via FTP. The idea is simple, you compose a set of images from specially named files.

This feature allows you to greatly simplify the download of images for product positions, especially if there are a lot of them.
For this you need:
1. create a set of files on your computer with special names: [product id] .jpg or [product id] .png or [product id] .gif
For example, files can be called: 2332.jpg, 332112.jpeg, and so on. Id of each product can be found in the list of products. If you need to upload more than one image for the product, then the name will be: 74324_2.jpg, 74324_3.jpg, etc. up to 74324_6.jpg, that is, for each product it is possible to download no more than 5 pictures.
All these files you can have inside as one or different directories, at its discretion.
2. Log in via FTP as described above.
3. Create a folder in the root of goods
4. Go to it and download the entire set of prepared files. Please note that all files that do not correspond to the format or their id is incorrect will simply be downloaded but not linked.

Id product can just spy in the price list.

Those. the details

As usual there are some technical details. To generate PDF, the Pisa library is used (http://www.xhtml2pdf.com/), which in turn uses Reportlab and html5lib, and creates pdf based on HTML files, in which styles you can customize the appearance and generation options.

PS We are actively engaged in writing documentation for users and partners, as well as making training videos at the request of workers. Here are some of them:

Source: https://habr.com/ru/post/102399/

All Articles