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!
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? :P (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...
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.
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
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?
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".