Email And Document Template Editor In Cs-Cart 4.4.1

Hi!

The alpha version of CS-Cart 4.4.1 is coming in the closest time, and the production release will be available this fall. Two main changes in the new version are the new logic of theme functioning and the updated email and document template editor.

In this post, we’d like to share with you the information about the updated email and document template editor. The editor has been a prototype for a long time. Now, it will be released as a ready-to-go feature built into CS-Cart 4.4.1. Store administrators will be able to edit email notifications, plus these documents via the new editor:

  • Invoices
  • Packing slips
  • Packing slips of the RMA add-on
  • Supplier invoices of the Suppliers add-on
  • Gift certificates of the Gift certificates add-on

Read general information about the editor in our old post.

<span><span style="font-size:26.6667px;font-family:Arial;color:rgb(0,0,0);font-weight:400;background-color:transparent;">Quick Introduction to the Editor</span></span>

In CS-Cart 4.4.1, store administrators will be able to edit and construct email notifications, invoices, packing slips, and gift certificates right in their admin panels using a visual text editor.

Basically, two key elements of the editor are variables and snippets:

  • A variable is a dynamic component of a template. A template fetches all the necessary information through variables. For example, the {{ order.total }} variable added to the invoice template displays the total order price in the invoice. Developers will be able to expand the list of available variables via add-ons.

  • A snippet is a separate part of a template to quickly insert the same information to different invoices or email notifications. Often the footer and header of email notifications or invoices must look the same. Store admins construct a snippet in the Code snippets tab when editing an invoice or email and then add the whole snippet by simply inserting the function to the invoice or email. For example, this function {{ snippet("footer") }} fetches the footer snippet to email notifications. Developers will be able to expand the list of available snippets via add-ons.

The new template editor works on the template engine called Twig (version 1.24). Developers can take advantage of all the Twig features.

Key Insights for Developers

  • Since the editor is based on WYSIWYG, you won’t be able to insert conditions, loops, or other logical constructions to invoices and email notifications—WYSIWYG cuts them off.
  • Use snippets to add conditions, loops, and that kind of constructions to templates. Snippet editing window doesn’t use WYSIWYG—you’ll be able to work with snippets just like with SMARTY templates.
  • There will be no hooks for documents—use snippets instead.
  • You’ll be able to add new variables, snippets, and, probably, invoices via add-ons.
  • Store administrators will manually insert variables and snippets to documents.
  • Backward compatibility will be fine—if your add-on uses email notifications or invoices, it will still work in CS-Cart 4.4.1. Templates will be fetched same as before.
  • After the upgrade to CS-Cart 4.4.1, the new template editor will be disabled. Store admins will be able to activate it on the Settings → Appearance page of their admin panels. After a clean CS-Cart 4.4.1 installation, the new editor will be active by default. Store admins will also be able to choose the old template editor on the clean installation.

We’ve prepared detailed developer docs describing the whole workflow and examples. Check them out.

For now, you can test the new editor in our developer demo stores: CS-Cart and Multi-Vendor. To edit email notifications or documents, go to Design in the admin panel and select Email templates or Documents:

Please ask any questions about new document template editor in this topic, our developers will kindly answer them.

Thanks for this great feature. Will test it out.

Great :) (y)

It would be even greater if this feature would also extend to the editing of product detail pages and the brand page feature page.

invoices A4 format , but horizontal and juxtaposed so as to be 3 pieces of A4 how to set ??

https://s8.postimg.org/xdmfjt0sl/invoice.jpg

invoices A4 format , but horizontal and juxtaposed so as to be 3 pieces of A4 how to set ??

https://s8.postimg.org/xdmfjt0sl/invoice.jpg

You can not set it this way. You need a custom modification for this.

Unfortunately we are not going to implement this feature.

Actual invoice template editor is done very well indeed however I am missing the key point of this feature that is editing actual invoice before print.

While in admin order details page for example

http://dev.demo.cs-cart.com/stores/588157b579c7d8c4f/admin.php?dispatch=orders.details&order_id=96

there is a tweak before send but actually this should be edit and there send, save and download

My product names are long and seo oriented, I am always editing invoice product names to remove what is not necessary or to combine re calculate product list if too many identical product in same order.

Lack of save button would be big disappointment.

PS while printing order invoice, print preview mode of firefox, invoice content does not fit to default A4 page unless you pick shrink to fit, some content hides behind right margin.

Also I know that everyone can change this according to taste but what is this padding: 0px 44px 0px 46px; for? Isint page setup margins enough or you expect them to be set to 0 and controlled from invoice?


            

Actual invoice template editor is done very well indeed however I am missing the key point of this feature that is editing actual invoice before print.

While in admin order details page for example

http://dev.demo.cs-cart.com/stores/588157b579c7d8c4f/admin.php?dispatch=orders.details&order_id=96

there is a tweak before send but actually this should be edit and there send, save and download

My product names are long and seo oriented, I am always editing invoice product names to remove what is not necessary or to combine re calculate product list if too many identical product in same order.

Lack of save button would be big disappointment.

We decided that save button can broke the order workflow.

When you change order status, your saved invoice should be modified because it is already have another status in it, and I don't have an idea how we can implement this.

I guess you are missing the point that since invoice is saved from the law and book keeping, accounting it cannot be changed. Same as currency exchange rate cannot impact completed order total.

I guess you should check this addon

http://marketplace.cs-cart.com/add-ons/site-management/easy-invoice-management.html

currently it is best invoicing addon for my needs, I suppose I'll have to stick with it..

What does invoice document has to do with order status anyways?

Invoice as a document should not reflect status of the order. There are just too many aspects of of what part of the order is paid, what part shipped, when order will be paid, will company pay invoice at all maybe it will bankrupt.. All this sorted by accountant..

When you change order status, your saved invoice should be modified because it is already have another status in it, and I don't have an idea how we can implement this.

here a scenario for you.

1. you sell t-shirt and complete order invoice nr1001

send order, customer gets order but t-shirt is too small and he returns it.

2. you create credit note invoice nr1002 (not nr1001)

What does invoice document has to do with order status anyways?

Invoice as a document should not reflect status of the order. There are just too many aspects of of what part of the order is paid, what part shipped, when order will be paid, will company pay invoice at all maybe it will bankrupt.. All this sorted by accountant..

here a scenario for you.

1. you sell t-shirt and complete order invoice nr1001

send order, customer gets order but t-shirt is too small and he returns it.

2. you create credit note invoice nr1002 (not nr1001)

Are you saying that we should not display order status on the invoice? https://www.evernote.com/l/AQEyyhl3OWlIkqvAcnVfqqkflfZV3ikpCGY- because each time we change order status, the invoice will also be changed.

What if customer changes shipping method or payment method after the order is placed.

I just think you should implement new functionality "beside" existing functionality so that you don't break things that are out of your control. Additionally, if you did a new implementation then you would be free of compatibility issues.

I will await documentation but my point is that I shouldn't have to re-do all my addons and custom development work I've done for others using hooks and approved methods because you decide to optionally allow users to edit email templates from a WYSIWYG editor.

Tony, have you had a chance to go through this post and dev docs.
Right now we in alpha state and we can make some serious changes. So I would really appreciate your feedback on this.

Imac, how could I change the Subject line for the email that is sent when a new order is placed. I saw that I can change the body email (invoice), but we need to put the {{ order.total }} in the subject line.

Imac, how could I change the Subject line for the email that is sent when a new order is placed. I saw that I can change the body email (invoice), but we need to put the {{ order.total }} in the subject line.

Try the following.

Go to Design -> Email templates. Open the email notification that is base on your initial order status. In many cases this is either Open or Processes.

In my case this is Order notification: Open, and replace the Subject from:

{{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} 

to:

{{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} {{ order_info.total }} 

Darius is right. Once issued invoice should not be changed.

I cannot speak for whole world accounting. But

credit memo and invoice must have unique number even they are for same order. Remember that order can be paid in parts, part of the order can be returned or refunded, there are just too many factors.

From accounting point on invoice you have to fit

seller details customer details, unique invoice number, sale date, product name, unit price, quantity, subtal, tax, total.

At what stage order is, is information for buyer and does not have to be on invoice.

What if customer changes shipping method or payment method after the order is placed.

That is why invoice should be create in very last step, when order is completed, before very last step invoice would be called proforma, proforma has no legal right, customer has no obligation to pay it or proceed with it, proforma are details and totals for

payment to be done. Commercial invoice would mean you are in debt, or you have made payment, proof of payment is receipt, bank receipt or similar..

Are you saying that we should not display order status on the invoice? https://www.evernote.com/l/AQEyyhl3OWlIkqvAcnVfqqkflfZV3ikpCGY- because each time we change order status, the invoice will also be changed.

What if customer changes shipping method or payment method after the order is placed.

Try the following.

Go to Design -> Email templates. Open the email notification that is base on your initial order status. In many cases this is either Open or Processes.

In my case this is Order notification: Open, and replace the Subject from:

{{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} 

to:

{{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} {{ order_info.total }} 

I've tried {{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} - {{ order.total }}

but no working.

I receive this Subject line: Simtech: Order #99 has been placed successfully -

I've tried {{ company_name }}: {{ __("change_order_status_o_subj", {"[order]": order_info.order_id}) }} - {{ order.total }}

but no working.

I receive this Subject line: Simtech: Order #99 has been placed successfully -

Your code is missing _info.

{{ order_info.total }}

Partially payed can be presented in the time invoice was issued. Payed change can be allowed. I don’t see the relevance of changing shipping method on the invoice. If something is altered then alter the delivery slip not the issued invoice. Invoice can be marked payed but had also not to be presented or the invoice.


Once issused invoice should be left as it is. :wink:

One cool idea is to pull payment method data to the invoice. Examples : payal Transaction id …


My suggestion go away from issued invoices :wink: