Lesson 42. Orders — Documents Editor

Starting with version 4.4.1, CS-Cart comes with a built-in editor for documents, such as invoices, packing slips, and gift certificates. You can customize the documents according to your needs, or import the documents that were created and exported by someone else.

So, before we proceed, let’s go through the key ecommerce shopping cart features of the new editor:
1. Different types of documents. Both default and added documents can be edited via the WYSIWYG editor.
2. The Unified editing system. All documents use one editing system. So, once you learn how the system works you will be able to edit any document, notification, and snippet.
3. Add-on support. You can add new documents and snippets with add-ons.
4. Easy notification editing. Coding skills are not required, just enter the data manually or use variables and snippets.
5. Preview. Check how your documents will look like by using a preview feature.
6. Conditions. Manage the content of your documents by including conditions into code snippets.
7. The separated products table. Use the Products Table tab to manage look and structure of the products section.
8. Backward compatibility. Old templates are preserved so you don’t have to worry about them while moving from the old system to the new one.
9. The Import/Export feature. Add new types of documents by using the Import/Export feature.

Now, let’s move to the detailed overview of the online shopping cart features.

By default in shopping cart website software four types of documents are available—an invoice, a packing slip, an order details page, and a gift certificate. Some of them, a packing slip, for example, are attached to packages and sent by post, others, like order details, are sent by email.

To overview new ecommerce software features we are going to use an invoice as an example. An invoice is a list of goods sent or services provided, with a statement of the sum due for these. This is a financial document with a statement of the sum for the order that can be used to report to tax authorities. The editing functionality is the same for all types of documents.

Three tabs conveniently separate different functions from each other, allowing you to work either with elements of the document or to see the whole picture on the General tab.

To edit the invoice use variables and snippets. Variables and snippets use the data from the store to substitute correct values. Speaking about variables. There are two types of variables available. Common variables, that contain general information about orders, users, company and other main aspects of the store, and variables with an array key that are hidden under the plus buttons. They specify the general data provided by the common variables. To make it easier to understand let’s take a look at the example. Here we have the {{o.tracking_number}} variable where O means “order”. Instead of pulling the full information about the order it pulls only its tracking number. And finally, to check the result click the gear button and choose Preview. In order to see the preview of invoice or order_detailes templates you need to have at least one order in your CS-Cart. The same thing applies to other types of documents.

Now let’s turn to the Code Snippets tab.

Code snippets are used to represent common elements of the document such as bill_to and ship_to fields in the invoice. On this tab you can create, delete, and edit snippets. Also, snippets can be used to specify the conditions under which some values will be displayed or not. For example, you can create a snippet that will hide tax and discount lines on the invoice if no taxes and discounts are applied to this order.

Next is the Products table online shopping cart feature.

This tab represents the products_table snippet. This snippet creates a table that contains the information about products being ordered. Here you can not only add, edit, and delete columns of the table but also change their position. To do it, simply drag and drop the desired column. While editing use variables to fill in the columns.

We also preserved the backward compatibility. The old templates that don’t have documents, notifications and snippets for them will continue to work after the upgrade as supposed. The old templates can be found at Design -> Templates.

Here is the icing on the cake for you to finish it up. The Import/Export feature. Add new and modify existing documents and snippets with this new feature. Use the gear button located on the main page of the Editor to Import and Export documents. You can also import and export documents individually just choose a document and click the gear button. The documents are saved in .xml file.

After the detailed overview of the general features let’s take a quick look at other documents that are available by default.

The next document after the invoice is a packing slip. A packing slip is a list of products that is attached to the package being sent to the customer.

Order details. It is sent by email to the customer as a reminder about the content of the order.

The last document in our list is a gift certificate. A document generated by the add-on. As you can see add-on documents are easily added to the new editor. All information is conveniently sorted out between tabs. All you need to do is just enter your own variables. Any types of documents and snippets can be generated by add-ons for ecommerce software.