How To Include Variables In Email Snippets

I am new to this and need some guidance on this please. My knowledge of coding is zero.

I am using CS Cart 4.7.1

I am trying to show the respective Barcode and the Supplier details on my email notifications to customers. I find the whole Variables+Documents+Email Templates to be quite mystical and I am totally lost when it comes to creating new variables for Documents and Email Termplates. I would love to be able to include the Supplier variable in the Invoice document, but I think this will remain beyond me for some time.

I am able to include static data into the email snippets, as well as the Barcode into the invoice and supplier invoice, but due to the nature of my supply chain the issuing of invoice is a final factor (complete status). The customer however needs the Supplier and Barcode information on initiation (processed status) of the order.

According to the csc documentation you can insert variables into email template snippets, but there is no "how" detailed in their guidelines.

I will be grateful if anyone is able to offer me guidance on what "code" is to be inserted into the snippet to achieve my desired result.

Thank you

Kevin

You have to implement new classes to make new variables available. Read the developer's documentation rather than the user's documentation.

Thank you, I will re-re-read them, hopefully they will begin to make sense in time.

Hi tbirnseth

I fiddled and found that I can add a variable into a email snippet, provided that variable is included in the email templates. Kind of puzzled as to why one would want to add a variable as a snippet when you can just add it as a variable, but there must be a reason. Either way, that doesn't help me, I want to add a variable that does not exist in the email templates, so I guess I need to add the variable to the Email Templates first.

Remember I said I know nothing about coding...seems I'm proving it.

In reading the developer documentation, there are three sections, one for Email templates, Documents and then Snippets. In the Email templates section there is no mention of how to add a variable, so I am guessing I should be following the guidelines for adding a variable to documents? The example they use is for adding the Barcode variable. Should I therefore be implementing a class for Barcode to appear as a variable in Email Templates, as indicated by

"Let’s extend the variable schema for the documents of the order type. To do that, add a file /app/addons/barcode/schemas/documents/order.post.php:"?

If so, how do I get that to appear in Email Templates as this clearly intended for Documents.

Yes, I too wonder how I have managed to put together a website, I will be amazed if it works properly when finished. I thought this was going to be easy, like building lego...a monster learning curve for me


Good that you're reading....

It's actually a hierarchy. Variables -> snippets -> documents.

Your issue is the need to add a variable. I think once you focus there and figure that out so it makes sense to you that you will be able to then either add it to a snippet or a document. I don't work with the new email template editor much because it's such a pain to do anything with that is not simply editing. It takes a bunch of work to do what should be simple things. There's no hooks in the code so they don't support simply adding a field to the list of variables that are available, etc. From a user's perspective, its nice. From a developer's perspective, it's hell.

Reading is the easy part, understanding it is something else.

Much of the fault in my inability to proceed lies with my lack of a basic understanding of website development.

When I initially evaluated CSC it was with 4.3.9, and I thought "hey, I can do this", but when I eventually bought the package it was at 4.4.2. Everything has progressed fine till I got to producing documents and emails for customers etc, and the brick wall jumped out in front of me.

I will probably have to do as most others have done and revert to the old version of invoices, although this is less than ideal as I suspect that at some stage in the future this will disappear from CSC and then I will be back where I am now.

It would be really great if someone (anyone!), perhaps the guys from CSC, could provide a "layman/noob" instructional on how to add variables etc, even if on only one example that we can use as a guide, I am sure it would not only help a great number of people but also allow CSC to show their support of their clientelle. I can fiddle and in time maybe even get the Barcode variable to work, but then when I look at the Supplier Variable I find that there isn't anything named SupplierVariable anywhere, yet the variable pops up in the Supplier Invoice like magic. Puzzling.

What really scares me going forward is that, I believe, the majority of people that purchase CSC are not developers, many are at a similar level as me trying to establish a web presence for their business and eventually, as CSC continue to include more complexity (to the extent where knowledgeable people such as yourself have challenges with the documents), we will no longer be able to work on the platform and will have to move on to something more usable, which will be a pity because I believe that CSC is a great package in most respects.

Thank you for your time and input, it is really good to know that there are people out there willing to assist.

Can you tell me how can I insert a snippet variable in Payment method description? I want to insert shipping country snippet variable

Shipping country should already be available as {{order_info.s_country}} I believe.

Can you tell me how can I insert a snippet variable in Payment method description? I want to insert shipping country snippet variable

Do you want to replace placeholder in payment description by country variable?