No announcement yet.

Template Variables, how are they implemented?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Template Variables, how are they implemented?


    Does anyone know how the 3DC cart engine deals with template variables?

    Specifically, what determines which variables are available for a given template? (I am aware that there is documentation in the guide about which templates have which variables available. The question is how do they get to be that way?).

    The reason I ask, specifically, is that I want to generate a packing slip with thumbnails, and the [thumbnails] variable which is available in some templates, is not in the packing_print.html template.

    Tech support's short answer is that I can call sales and ask for custom coding (phone number provided).

    Last edited by obleck; 01-09-2020, 05:01 PM.

  • #2
    The answer is pretty much if its not available on the default templates, it isn't available. But, in this case, i think [thumbnail] might work, also, [image1]...give it a shot.
    Gonzalo Gil
    3dCart Support
    800-828-6650 x111


    • #3
      I tried [thumbnail} and it didn't work. I'll try the others.

      However, that didn't answer my question, which was, "What determines which variables are available for a given template?"

      Obviously if I can call sales and pay someone at 3DC to code up what I want, then there is an answer to this. Moreover, if I can pay 3DC's people to do it, I should be able to do it myself too, given that I'm competent in this realm.


      • #4
        "What determines which variables are available for a given template?"

        When we build a template for something, we get a list of the variables that we want to have available based on the requirements we setup when we created the project, put them on the template, and on the software.

        This is why, if it isn't on the template, it most likely isn't available for you to use. We can always make a customization, but, we try to have the app do the least work as necessary, as if we wanted to make every variable available on every template, it would make things a lot more complicated & unnecessary for the app.

        However, in this case, [thumbnail] does work, i just tested it. I think you were close, but you used "thumbnails" (plural), which isn't a valid one.

        Here is what i did:

        HTML Code:
        <!--START: items-->
                    <div class="row">
                        <div class="invoice-id">[id] <img src="[thumbnail]"></div>
                        <div class="invoice-items">
                            [itemname]<!--START: warehouse_location--><br />
                            [warehouse_location] [warehouse_aisle] [warehouse_bin] [warehouse_custom]<!--END: warehouse_location-->
                        <div class="invoice-qty">[numitems]</div>
                        <div class="clear"></div>
                    <!--END: items-->
        on /packing_print.html
        Gonzalo Gil
        3dCart Support
        800-828-6650 x111


        • #5
          I had it as [THUMBNAIL] for some reason (copied from a different template if I recall correctly), but it's not documented in any case on this page:

          ...where I'm sure you would agree one would expect to find it:

          Nevertheless, two things:

          1) I still don't know the answer to my question, which is, "What determines which variables are available for a given template?" Clearly somewhere in your system there is _some_ mapping somewhere somehow. If the answer is, "We're not going to tell you because you can't access it anyway", that's fine.

          2) Is there some way to actually determine what variables ARE in fact available for any given template, given that the documentation leaves some out?
          Perhaps some code block called "LIST-ALL-TEMPLATE-VARIABLES"....


          • #6
            I'm sorry, but, typically the packing print, is usually black and white (currently lol, i guess pretty soon color printing will be the nrom), so no, i wouldn't expect it there, but, yes, if you print those in color i would understand, that's great, but, it isn't normal, this is why it wasn't part of that template because when it was designed, it was understood that it would most likely print on a thermal printer, or black and white and wouldn't want that in it.

            #2, yes, the variables you have access to, are the ones in the templates. Now, i'm sure you'll say "Hey, but this one wasn't there!!!!", true, that's because we have done a customization recently that's not available to everyone yet. When you reach our customization team, the first thing they do is test on the latest version if its possible, if it is, they tell you how to do it, if it isn't they let you know what we can do.A good % of "how can i" sales tickets end up with similar answers as the one i placed. Now, if you are a developer, look here:


            You can pretty much have access to pretty much anything of your store and do your own development, so if the stock app doesn't fit your needs, you could read the order, make your own email and send it, but that's a lot more complicated.

            So if the question is "What can i make sure i have access to?" then, read the templates the variables there are 100% available, if your question is "I want XYZ available and that's not on templates?" then, we would need to look at that and that's not something our support team handles. The "List all template variables" is basically "open the template and anything you see there is available".

            I wish we can make this simpler, but, if we added the thumbnails today (a few years after we introduced the original template for packing slip), i am sure we would have a huge issue with those that don't want to spend so much ink :(

            Gonzalo Gil
            3dCart Support
            800-828-6650 x111


            • #7
              Well, I suppose that mostly answers it:

              1) Template variables are mostly documented, but the ones that aren't, well... that's just how it is
              2) Variable assignment to templates is internal and not accessible. Unless...
              3) ... it sounds like maybe you can do it through the API if one wants to dig into it.

              Fair enough. Thanks.


              • #8
                Interesting pages:


                Packaging and Shipping Supply Specialists


                • #9

                  Why does the packing slim include the price for options? Example; The price we charge to personalize an item appears on the packing slip. It has been this way for years. Why doesn't 3dCart fix this?