Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default [DONE 1.3.5] Missing </div> in tpl_shopping_cart.php

    It would appear that the content generated by the tpl_shopping_cart.php sidebox file is missing its final </div>. As a result the div for the shopping cart box erroneously wraps around all the sideboxes boxes below it. The solution is to add
    PHP Code:
    $content .= '</div>'
    immediately prior to the templates closing }
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  2. #2
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Missing </div> in tpl_shopping_cart.php

    Kuroi-

    is there already a closing </div> one line 61 of that file?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Missing </div> in tpl_shopping_cart.php

    Quote Originally Posted by Kim
    Kuroi-

    is there already a closing </div> one line 61 of that file?
    Sorry I didn't make this as clear as I should have. There are two divs needing to be closed. One opened on line 14 and one on line 15. I tend to like to be able to nest them neatly, hence the suggestion that would have led to two identical, adjacent statements, but it would have been clearer (and more efficient) if I'd suggested amending the line to
    PHP Code:
    $content .= '</div></div>'
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Missing </div> in tpl_shopping_cart.php

    I'd hold off on the changes for a few ...

    I think you are correct that there is something off ... but ... there are several IFs in there that may also be confusing the issue ...

    Give us a bit to look at what we think we wrote when we thought we wrote it perfectly right the first dozen times ...

    Thanks for the heads up that something might be askew here ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Missing </div> in tpl_shopping_cart.php

    Quote Originally Posted by Ajeh
    I think you are correct that there is something off ... but ... there are several IFs in there that may also be confusing the issue ...
    You're right. The IFs do confuse the issue. More so than I originally thought when I skimmed the code.

    As I result, it now appears to me that although there are the right number of opening and closures of divs, the IFs mean that they don't match up in all circumstances.

    Specifically, it seems that the Content div is only opened (line 14) if there is something in the cart and only closed (line 61) if the customer is logged on.

    This allows two potential problems
    1. customer puts something in the cart before logging on, opening the div, but not closing it.
    2. the customer is logged on but with nothing in the cart, resulting in a superfluous div closing tag


    Number 1 is the reported bug and exists. It can be easily reproduced though would not normally be visually obvious. The specific circumstances that highlighted it were the adding of vertically repeating background image to this div that then proceeded to continue downwards to all lower boxes. I could replicate this on a publically visible site if you would find this helpful.

    Number 2 I suspect is theoretical rather than actual, as I don't believe that this template is invoked if the cart is empty, and if it were to happen, then it is possible that a parent div would be prematurely closed with very obvious results. However, I'm not certain as I haven't tracked down where it is supressed and this would imply that the first IF/ELSE statement and the code in the ELSE part of it are redundant.

    A possible solution, which appears to fix problem 1 with no side effects is to move the opening div to before the IF statement and the closing tag to after the last IF. I attach a zip of the tpl_shopping_cart.zip that I have tested successfully.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

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

    Default Re: Missing </div> in tpl_shopping_cart.php

    Solution:

    1. Swap lines 13 and 14
    2. change $content = to $content .= on line 42
    3. swap lines 61 & 62.
    .

    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.

  7. #7
    Join Date
    Sep 2004
    Posts
    2,420
    Plugin Contributions
    2

    Default Re: Missing </div> in tpl_shopping_cart.php

    Looks like I need to read this forum more often.

    Thanks Kuroi and DrByte.

    Woody

    --

    P.S. I dislike line number edit directions. If I have ever customized the file in question I am completely out of luck, unless I remember exactly what I previously customized, or I somehow I can comprehend my own comments of my past edits. Neither is rarely the case. ;-)
    Last edited by Woodymon; 26 May 2006 at 06:04 AM.

  8. #8
    Join Date
    Sep 2004
    Posts
    2,420
    Plugin Contributions
    2

    Default Re: Missing </div> in tpl_shopping_cart.php

    Ok for slow people like me...

    Solution.
    Edit /sideboxes/tpl_shopping_cart.php

    1. Swap lines 13 and 14.

    So should be:

    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
    if ($_SESSION['cart']->count_contents() > 0) {


    2. Change $content = to $content .= on line 42

    So should be:

    $content .= '<div class="sideBoxContent center bold">' . BOX_SHOPPING_CART_EMPTY . '</div>';


    3. Swap lines 61 & 62.

    So last four lines of file should be:

    }
    }
    $content .= '</div>';
    ?>

  9. #9
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Solution to missing </div> in tpl_shopping_cart.php

    Until now this has seemed like an amusing little bug that causes some odd cosmetic effects revealed only to those using the background graphic techniques such as used in the future Zen template.

    However, here's an example where somebody doing something completely different has their layout completely trashed when a customer puts something in their shopping cart without logging in first. The difference is that this time the shopping cart sidebox is on the left and the layout table has been removed, so the missing </div> has a catastophic effect on the positioning of the central area.

    As I suspect we'll see this problem again before the next Zen Cart delivery, I'm posting a zip file >> tpl_shopping_cart.zip << here with the corrected file here as the reference point for any future instances of this bug.

    Although this will hopefully be corrected in future deliveries of Zen Cart, I recommend playing safe by placing the corrected version of the file in your ncludes/templates/YOUR_TEMPLATE_NAME/sideboxes/ directory (creating one if you don't already have it).
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  10. #10
    Join Date
    May 2004
    Location
    UK
    Posts
    478
    Plugin Contributions
    0

    Default Re: [DONE] Missing </div> in tpl_shopping_cart.php

    Thank you for this - I was one of those that it screwed my display up royally but all sorted, I found the missing div but wasn't totally sure which file to edit

    :)

 

 

Similar Threads

  1. Replies: 2
    Last Post: 22 Apr 2013, 08:56 AM
  2. [Done v1.5] 1.50Beta missing email_welcome.php
    By Rinker in forum Bug Reports
    Replies: 1
    Last Post: 16 Aug 2011, 10:12 AM
  3. [Done v1.3.9] Missing </tr> in collect_info.php
    By torvista in forum Bug Reports
    Replies: 1
    Last Post: 10 Jul 2010, 03:16 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