Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Join Date
    Sep 2013
    Location
    Devon, UK
    Posts
    56
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    Quote Originally Posted by mc12345678 View Post
    While this may have prevented the problem seen, it still doesn't look like the right solution or perhaps the problem is caused by something else.

    The tpl_ files are expected to be in the global space. That means any variable referenced within them is expected to be in the global space. The $currencies variable when needed is routinely loaded either in the associated header_php.php file for the page or its main_template_vars like file. Having to declare $currencies as a global indicates that this template file is being loaded/run within some other code section like a function or class method. If that is the case, the function/class method really should ensure that the variable is brought into the current space rather than the file that is being called. Meaning, where global $currencies has been added, it should be within the out-of-scope code section that is calling this template file.
    I do see what you're saying and I agree, to a point.
    However, doesn't this mean that the function (or the page) including a template must predict all of the global variables a custom override might require and declare all of them in the function? It has no idea what code is in the overriding template, what it is doing and which globals it needs in order to do it.

  2. #12
    Join Date
    Sep 2013
    Location
    Devon, UK
    Posts
    56
    Plugin Contributions
    0

    Default Re: Strange problem with prices displayed at final stage of checkout

    As you say, though, perhaps the problem is caused by something else and the template shouldn't be included in a context that isn't truly global.

  3. #13
    Join Date
    Jul 2012
    Posts
    16,487
    Plugin Contributions
    17

    Default Re: Strange problem with prices displayed at final stage of checkout

    Quote Originally Posted by BillJ View Post
    I do see what you're saying and I agree, to a point.
    However, doesn't this mean that the function (or the page) including a template must predict all of the global variables a custom override might require and declare all of them in the function? It has no idea what code is in the overriding template, what it is doing and which globals it needs in order to do it.
    If this were the style of design to consider the possibility of any template file to be so used, then every variable within every template should be declared as global and used as such; however, can see two parts to this, why would there be the design to include a normally expected global file in a non-global context and *not* know what it needs to support operation? Design by design, right? So, that leads to...

    Quote Originally Posted by BillJ View Post
    As you say, though, perhaps the problem is caused by something else and the template shouldn't be included in a context that isn't truly global.
    There are multiple ways to activate or prepare a template file to be displayed/loaded in the global space. Of course, one question is why would/do ZC template files contain executable code rather than "reference" or fill-in-the-blank variables (obvious answer is that it was inherited and isn't actually in the way of operation)? If/when the template system gets so or similarly revised, it would be possible to set/modify the associated variable(s) to contain the information necessary though that wouldn't fix the template file within the limited scope function (as compared to an init_include, module, or other on-demand global scoped template file).

    Yes, there may be a "reason" to load that template file within a function instead of some other way, inquiring minds certainly would like to hear. Good discussion, I think.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v151 Discount For Completing Survey At Final Checkout Stage
    By ShopVille in forum General Questions
    Replies: 6
    Last Post: 11 Apr 2022, 05:16 PM
  2. Choose displayed prices with or without tax
    By ffredrik in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 28 Oct 2009, 03:40 PM
  3. Tax problem on last stage of checkout
    By Kylles in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 6 Sep 2007, 02:04 AM
  4. Problems with checkout stage 2 (payment options
    By jas99villa in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 6 Jun 2006, 02:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR