Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

    Default Overlay Window Database Data and Language Constants Not Working

    I created an overlay window for search - click a search icon and an overlay window shows the search input and drops the user on the advanced search page with their results.

    I'm trying to use the same approach for a shopping cart overlay window.

    The problem is when the window opens, it doesn't load the language constants or pull any database data.

    Is it possible this approach just won't work because it is bypassing the database pulls that happens within Zen-Cart when a page loads?


    Code in includes/templates/responsive_classic/common/tpl_header.php looks like this:

    Code:
                        <li>
                        <div id="shoppingcartOverlay" class="overlay">
                          <span class="closebtn" onclick="closeShoppingCart()" title="Close Overlay"><i class="fas fa-check"></i></span>
                          <div class="overlay-content">
                          <?php require($template->get_template_dir('tpl_shopping_cart.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_shopping_cart.php'); ?>
                         
                           </div>
                        </div>
                        <div id="openShoppingCart" onclick="openShoppingCart()"><i class="fa fa-check"></i></div>
                        </li>
    Code in includes/templates/responsive_classic/jscript/jscript_header.js loooks like this:
    Code:
    //BOF Shopping Cart Overlay
    function openShoppingCart() {
                          document.getElementById("shoppingcartOverlay").style.display = "block";
                        }
    
    function closeShoppingCart() {
                          document.getElementById("shoppingcartOverlay").style.display = "none";
                        }
    //EOF Shopping Cart Overlay

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Overlay Window Database Data and Language Constants Not Working

    Per-Page language constants are only defined when that main_page= URL is loaded. If you want to load language defines for other pages, you'll need to do that manually. And also resolve any conflicts that occur if constants of the same name are already defined for the current page.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

    Default Re: Overlay Window Database Data and Language Constants Not Working

    I think I can play with the defines to get those to work by adding them to the main language defines file.

    The part I'm totally stumped on is pulling in the data that would normally pull from the database. With this shopping cart example, the page loads, but there is no cart data (product, pricing, total, etc.).

    Is there a quick fix I'm not seeing?

    Or is the solution something very involved and therefore this attempt at a lean solution isn't a good approach (there are plugins that do this but they seem to impact way more files than I would think they need to.)

  4. #4
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Overlay Window Database Data and Language Constants Not Working

    Most templates (especially those without "_module" in their filename) are designed for serving content for an entire page, not for a popup, so adapting content to a popup can create some challenges such as missing variables that the template expects to be present in order to display them.
    Pages build their pre-page-execution data in the /includes/modules/pages/header_php.php file, and then call the page's main_template_vars.php file if one exists, after which the template itself is called.

    That may give you some guidance for reverse-engineering the content you're seeking.

    This Program Flow document explains some of the execution path which may help shed other light on things in your customization process: https://docs.zen-cart.com/dev/code/program_flow/

    I thought there were already some plugins that provided a popup shopping cart in the header? Perhaps those may also help with inspiration for you.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v150 Livezilla overlay chat window cannot rise up in IE
    By scott_ease in forum General Questions
    Replies: 0
    Last Post: 9 Jan 2017, 10:51 AM
  2. v151 language utf8 working and not working
    By marieAA in forum General Questions
    Replies: 12
    Last Post: 28 Jan 2013, 12:50 AM
  3. Nav overlay not working in IE - Pure Blue template
    By tiagail in forum Addon Templates
    Replies: 2
    Last Post: 21 Feb 2011, 10:32 PM
  4. CSS overlay not working
    By tiagail in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Feb 2011, 06:42 PM
  5. popup image as an overlay not working properly in IE
    By gems14k in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 2 Oct 2006, 11:01 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