Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Sidebox Question: How to make a column appear ONLY when it has content?

    I have a zc155e with the mod Recently Viewed Items installed.

    Here is a link:
    https://002mc.justmedical.biz/

    I have it set up to appear in the right column. When you arrive at my store, there will be nothing in the right column until you view a product, add something to your cart, and/or log in.

    Despite the fact that the entire column is empty, it still takes up space.

    Is there a way to allow the center column expand over to use up that extra real estate until it is needed?

    Thanks!

  2. #2
    Join Date
    Jul 2012
    Posts
    11,632
    Plugin Contributions
    13

    Default Re: Sidebox Question: How to make a column appear ONLY when it has content?

    I don't think your going to like my answer, perhaps someone else will have a more positive spin.

    Three column layout: left, middle, right... you are wanting some sort of transitional 2 to 3 column layout. If not mistaken, the absence or disablement of a column does not necessarily "remove" it's notifiers about size (class/id information) and the overall css will still consider the column present. So... a few things you can try though to disprove me.

    Includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php has variables for the columns. You could attempt to just out right disable the right column and see if that "widens" your center column (I think not).

    So then it becomes an issue where knowing something within php you could change the html so that a different anchor is used to identify the center area and such css could be added to handle your new anchor as necessary.

    Mind you, start playing with css on this level and you may be redesigning everything to accomodate.

    Next thought is to use the mobile detect system to pick and choose the applicable css file(s) based on the same php knowledge.

    Btw, by php knowledge I mean, hey there's no new products for this group, so that's a reason not to display the right column. Do something similar for each such right box and if/only if one of them are to display then "slam" the content back into place and operate like normal. Typically this is also not a good idea because in a responsive environment say towards the bottom of the page, what was on the right side of the center column near that picture on the left will be pushed down to some other location with all of the text moved around... have to find everything again... you like doing that right? (sorry, to others that is a statement related to how badly some changes were desired after all these years that the changes were made partially because everytime visited had to relearn it all...)

    Anyways, yes, it can be done like anything else in ZC. Some would say why even have a right column at that point and just update the left one when needed...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  3. #3
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Sidebox Question: How to make a column appear ONLY when it has content?

    You're right... that wasn't what I was hoping to hear. It was, however, pretty much what I expected.

    This is a minor issue, doesn't warant the time that would be required. Thanks for the explanation though.

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,285
    Plugin Contributions
    20

    Default Re: Sidebox Question: How to make a column appear ONLY when it has content?

    I think it is possible
    In the file includes/templates/YOUR_TEMPLATE/common/tpl_main_paige.php

    add
    Code:
    if($_SESSION['cart']->count_contents() > 0 || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0)) {  $flag_disable_right = true;
    }
    This should disable the whole right column, as log as the cart is empty, and the customer is not logged in,
    and thus kill the white space.
    FYI I have not tested it

  5. #5
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Sidebox Question: How to make a column appear ONLY when it has content?

    Design, that looks super promising! Only, I wasn't able to get it working.

    I wasn't sure where/how to insert it. This is what I tried:
    Code:
    <?php
    if (COLUMN_RIGHT_STATUS == 0 || (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '') || (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == ''))) {
      // global disable of column_right
      $flag_disable_right = true;
    }
    if($_SESSION['cart']->count_contents() > 0 || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0)) {  $flag_disable_right = true;
    }
    if (!isset($flag_disable_right) || !$flag_disable_right) {
    ?>
      <div class="<?php echo $box_width_right_new; ?>">
    <?php
     /**
      * prepares and displays right column sideboxes
      *
      */
     require(DIR_WS_MODULES . zen_get_module_directory('column_right.php'));
    ?>
    Maybe I should put it higher?

  6. #6
    Join Date
    Jul 2012
    Posts
    11,632
    Plugin Contributions
    13

    Default Re: Sidebox Question: How to make a column appear ONLY when it has content?

    Ummm. Instead of fighting with the logic and the placement, as I said before for "testing" just put in $flag_disable_right = true; somewhere "after" it is last set to false. If not set to false in the file, then anywhere outside an if statment.

    The whole goal of the "exercise" is to see if there is any change to the display other than contents not being put into the right column.

    Then can start trying to determine what criteria is needed to "make it work".
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

 

 

Similar Threads

  1. how do i move sidebox content to grid colum / column in center column
    By Mrchristoh in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 17 May 2009, 04:03 PM
  2. How Do I Make EZ-Pages Appear on Sidebox?
    By zcnb in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 15 Jul 2008, 03:29 PM
  3. log off link - how do I make it only appear when logged on?
    By gsdcypher in forum General Questions
    Replies: 23
    Last Post: 2 Apr 2008, 12:28 AM
  4. More Information Sidebox to appear only when logged in
    By mathgyrl in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Jan 2008, 08:25 PM
  5. How do I make my logo only appear on the main page
    By CafePrima in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 27 Oct 2007, 07:00 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