vampirehunter Posted March 2, 2015 Posted March 2, 2015 I was wondering if anyone else has done this, i'm just not sure of what to do in this instance. basically, at the moment, all the pages are set to 1 column on left and 1 main large width column on the right side. I want to remove the entire left column which has the categories box Only on the main index home page and have that main large column take full width. I am happy with the left column showing on all other pages including the index page when a product/manufacter is clicked. its only for the home landing page i don't want it showing. The problem im having is that since everything about the columns is specified via admin, im guessing i have to manually add the div tags for the entire index home page layout somewhere at the bottom of the index file? and does it mean i need to specify an alternate template_top file? since thats where the div tag code is implemented via the PHP? I checked the template_top file and this is where the columns are being grabbed, but im not sure how i can specify that when the page is on just Index.php, to make the column become full width and to remove the left column completely. <div id="bodyWrapper" class="<?php echo BOOTSTRAP_CONTAINER; ?>"> <div class="row"> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <div id="bodyContent" class="col-md-<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'col-md-push-' . $oscTemplate->getGridColumnWidth() : ''); ?>"> At the moment, my layout is set to 3 for the left column, and 9 for the other side column. So my aim is for the index.php file only to completely remove the left column and only show the other column but make that full width. So my layout at the moment with 2 columns <div id="bodyContent" class="col-md-9 col-md-push-3"> div id="columnLeft" class="col-md-3 col-md-pull-9"> needs to become just 1 column of 12 Just on the index.php page, and nowhere else. If anyone has any best method to do this, that would be greatly appreciated. thanks
♥mattjt83 Posted March 2, 2015 Posted March 2, 2015 What if you add code to the module to disable it on the index page? You would need to make sure you aren't on a category page though as well. Matt
vampirehunter Posted March 2, 2015 Author Posted March 2, 2015 What if you add code to the module to disable it on the index page? You would need to make sure you aren't on a category page though as well. Hi the only problem is that the width of the column is fixed from admin. so at the moment since ive set 2 columns, left column and large right column, im not sure how i can set the column sizes on a conditional basis. I've worked out that i may have to specify them by hardcoding it inside a custom template-top file which i can reference via the index.php file using if/else statement.
De Dokta Posted March 2, 2015 Posted March 2, 2015 Hi, look here: http://www.oscommerce.com/forums/topic/392595-left-column-hidden-only-at-home-page/?p=1668915 If you want to hide only a column box on a certain page look into the box module e.g. bm_categories.php, find the function isEnabled and change it to something like that: function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) { $this->enabled = false; }else{ return $this->enabled; } } You can add further conditions to the if statement, for example ... and !isset($_GET['manufacturers_id']) - what ever you want. J.J.
vampirehunter Posted March 2, 2015 Author Posted March 2, 2015 Hi, look here: http://www.oscommerce.com/forums/topic/392595-left-column-hidden-only-at-home-page/?p=1668915 If you want to hide only a column box on a certain page look into the box module e.g. bm_categories.php, find the function isEnabled and change it to something like that: function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) { $this->enabled = false; }else{ return $this->enabled; } } You can add further conditions to the if statement, for example ... and !isset($_GET['manufacturers_id']) - what ever you want. J.J. hi thanks yes, i will try that. Makes perfect sense. the only thing is that the column widths of the bootstrap divs are set from admin. so at the moment, left column is set to 3 and remainder set to 9 I can remove the category box like you said, but my remainder column would still be 9 rather than the full width of 12 after the left column is removed. maybe i need to make a conditional statement in the template top file? I found the particular bootstrap divs in the template_top file, so maybe i should add a if/else for these two and i think it will be ok. <div id="bodyContent" class="col-md-9 col-md-push-3"> <div id="columnLeft" class="col-md-3 col-md-pull-9"> the main body content div should then become <div id="bodyContent" class="col-md-12">
De Dokta Posted March 2, 2015 Posted March 2, 2015 @@vampirehunter Hi, no, if the left and/or right column is empty the main area automatically fills the empty space! Try it! Simply remove/deactivate in the admin all boxes in one column and see, what happens in the frontend: There's no empty space left! J.J.
vampirehunter Posted March 2, 2015 Author Posted March 2, 2015 @@vampirehunter Hi, no, if the left and/or right column is empty the main area automatically fills the empty space! Try it! Simply remove/deactivate in the admin all boxes in one column and see, what happens in the frontend: There's no empty space left! J.J. Yes, you are right! i just added the if/else statement like you said to BM_categories and it works fine. The other column resizes to full width. Many thanks. I don't know why i was thinking it wouldn't. Its because i was using the firefox html/css inspect (Q) functionality and testing by deleting certain html bits on the fly, but the other column didn't resize automatically. Its exactly how i wanted it now. I think i might add some index home page only custom modules for specific home page content such as multiple banners and other boxes
clustersolutions Posted March 2, 2015 Posted March 2, 2015 If you look at your other post which I just posted my bm_cat file you can do if by not showing it when the cPath array/variable not defined...good luck...this should be classified as something that most shopowners want...
vampirehunter Posted March 4, 2015 Author Posted March 4, 2015 @@vampirehunter Hi, no, if the left and/or right column is empty the main area automatically fills the empty space! Try it! Simply remove/deactivate in the admin all boxes in one column and see, what happens in the frontend: There's no empty space left! J.J. hi i wanted to ask. if i wanted to remove the categories box also for some other pages. would i need to create a new function? im thinking of removing the categories box from the shopping_cart.php page and the login pages.
vampirehunter Posted March 9, 2015 Author Posted March 9, 2015 I'm having trouble editing this code so that the categories box does not show on some of the other pages. I want to hide it on the shopping cart page and login pages. function isEnabled() { global $PHP_SELF, $category_depth; if( ($PHP_SELF == 'shopping_cart.php') ||($PHP_SELF == 'login.php') || ($PHP_SELF == 'index.php') and ($category_depth == 'top') ) { $this->enabled = false; } else{ return $this->enabled; } }
snakelimit Posted April 15, 2015 Posted April 15, 2015 Hi, look here: http://www.oscommerce.com/forums/topic/392595-left-column-hidden-only-at-home-page/?p=1668915 If you want to hide only a column box on a certain page look into the box module e.g. bm_categories.php, find the function isEnabled and change it to something like that: function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) { $this->enabled = false; }else{ return $this->enabled; } } You can add further conditions to the if statement, for example ... and !isset($_GET['manufacturers_id']) - what ever you want. J.J. Thank you nicely done I was just wonder how to get rid of this boxes in home page xd my page start looking like old one XD
gvv Posted April 28, 2015 Posted April 28, 2015 @@De Dokta I'm trying exclude product, but without results. maybe You can check?: function isEnabled() { global $PHP_SELF, $cPath, $products_id; if((($PHP_SELF == 'index.php') and ($PHP_SELF == 'product_info.php') and ($cPath == '3_15') and ($products_id == '20') ) ||($cPath == '3_13') || ($PHP_SELF == 'login.php')){ $this->enabled = false; }else{ return $this->enabled; } } I can exclude sub/category, or simple page. like, login.php, but how with product_id? Doors, Stairs an Furniture
De Dokta Posted April 28, 2015 Posted April 28, 2015 @@gvv For single products you can try this: function isEnabled() { if (strpos($_SERVER['REQUEST_URI'],'products_id=28') !== false) { $this->enabled = false; }else{ return $this->enabled; } } That means: If the URL contains the substring "products_id=28", the module is disabled. J.J.
vampirehunter Posted May 1, 2015 Author Posted May 1, 2015 Hi I thought the best answer code was fine, but it's not perfect, as the categories box is also being removed when you are viewing the categories themselves. I thought top level would do it, but if you click a category. The box disappears, when I only want it to be removed just on the main index page and that's it. Do you have any ideas on fixing this? Thanks
vampirehunter Posted May 1, 2015 Author Posted May 1, 2015 @@gvv For single products you can try this: function isEnabled() { if (strpos($_SERVER['REQUEST_URI'],'products_id=28') !== false) { $this->enabled = false; }else{ return $this->enabled; } } That means: If the URL contains the substring "products_id=28", the module is disabled. J.J. Hi, ignore the above post, i didn't explain it properly, im not sure what im doing wrong. but i tried to add some other pages to the query, to not show the category box, but when i did, the category box does not show on the main home page, but also will then not show on the index page when you click on a category or sub category. It seems like the Top level is not being selected. I will try see why that is.
vampirehunter Posted June 16, 2015 Author Posted June 16, 2015 @@gvv For single products you can try this: function isEnabled() { if (strpos($_SERVER['REQUEST_URI'],'products_id=28') !== false) { $this->enabled = false; }else{ return $this->enabled; } } That means: If the URL contains the substring "products_id=28", the module is disabled. J.J. Hi was wondering if you could help again i tried this code, but the category box does not dissapear on the shopping cart page. function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top') || ($PHP_SELF == 'shopping_cart.php') and ($category_depth == 'top')) { $this->enabled = false; } else{ return $this->enabled; } }
De Dokta Posted June 16, 2015 Posted June 16, 2015 @@vampirehunter 1. be careful with the brackets: if((($PHP_SELF == 'index.php') and ($category_depth == 'top')) || ($PHP_SELF == 'shopping_cart.php')) also possible: if(($PHP_SELF == 'index.php' and $category_depth == 'top') || ($PHP_SELF == 'shopping_cart.php')) You just have to make sure that the program can "distinguish" which elements belong to one and which to the other condition. 2. you can't use ($category_depth == 'top') in that case because there are no different levels in the shopping cart as in the categories. ;) With ($category_depth == 'top') the condition can never be true and therefore on the cart page the box will never disappear. J.J.
vampirehunter Posted June 17, 2015 Author Posted June 17, 2015 @@vampirehunter 1. be careful with the brackets: if((($PHP_SELF == 'index.php') and ($category_depth == 'top')) || ($PHP_SELF == 'shopping_cart.php')) also possible: if(($PHP_SELF == 'index.php' and $category_depth == 'top') || ($PHP_SELF == 'shopping_cart.php')) You just have to make sure that the program can "distinguish" which elements belong to one and which to the other condition. 2. you can't use ($category_depth == 'top') in that case because there are no different levels in the shopping cart as in the categories. ;) With ($category_depth == 'top') the condition can never be true and therefore on the cart page the box will never disappear. J.J. Ok ive done this and now it seems to work function isEnabled() { global $PHP_SELF, $category_depth; if ((($PHP_SELF == 'index.php') and ($category_depth == 'top')) || ($PHP_SELF == 'shopping_cart.php') || ($PHP_SELF == 'checkout_shipping.php') || ($PHP_SELF == 'account.php') || ($PHP_SELF == 'account_history.php') || ($PHP_SELF == 'address_book.php') || ($PHP_SELF == 'account_password.php') || ($PHP_SELF == 'account_edit.php') || ($PHP_SELF == 'products_new.php') || ($PHP_SELF == 'shipping.php') || ($PHP_SELF == 'privacy.php') || ($PHP_SELF == 'contact_us.php') || ($PHP_SELF == 'conditions.php') || ($PHP_SELF == 'specials.php') || ($PHP_SELF == 'reviews.php') || ($PHP_SELF == 'login.php') || ($PHP_SELF == 'loginoff.php') || ($PHP_SELF == 'create_account.php') || ($PHP_SELF == 'product_info.php') ) { $this->enabled = false; } else{ return $this->enabled; } } with this, the category box does dissapear on all the other pages, shopping cart, login page, etc And doesnt show on the main index home page. If i also didn't want to show the category box when sub categories are selected, what is the correct method for that? Should i put the level as Nested? Many Thanks
De Dokta Posted June 17, 2015 Posted June 17, 2015 I'm not sure if I understand what you want to achieve. Where do you want the categories box to be displayed?
vampirehunter Posted June 17, 2015 Author Posted June 17, 2015 I'm not sure if I understand what you want to achieve. Where do you want the categories box to be displayed? Hi the code above i just put in. it is doing the following: Categories box doesn't show on the main home page. /index.php Categories box doesn't show when a top level category is selected, ie, i can just see the sub categories and its images shown. /index.php/cPath/23 Categories box is showing when a sub category is selected. index.php/cPath/23_27 Categories box is not being shown on all the other specified pages, shopping cart, login, logoff etc what i mean is how to get categories box to not show when sub category is being selected? I think i need to specify it? I can live with it as it is, but was just wondering how it could be hidden when a sub category is clicked on. I added following as a test. if ((($PHP_SELF == 'index.php') and ($category_depth == 'top')) || (($PHP_SELF == 'index.php') and ($category_depth == 'products')) || (($PHP_SELF == 'index.php') and ($category_depth == 'nested')) This removes the categories box now for all levels. When top level category is clicked, and when sub category is clicked, the categories box is now dissapeared. I think this is ok for what i need.
SpicyGirl Posted March 16, 2016 Posted March 16, 2016 function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) { $this->enabled = false; }else{ return $this->enabled; } } You can add further conditions to the if statement, for example ... and !isset($_GET['manufacturers_id']) - what ever you want. J.J. That works FINE, but how to do that for multiple pages? Mean I dont want iton index, products_new and specials. Actualy only on product_info Thanks to help me
♥kymation Posted March 16, 2016 Posted March 16, 2016 if($PHP_SELF === 'product_info.php') { Regards Jim See my profile for a list of my addons and ways to get support.
SpicyGirl Posted March 16, 2016 Posted March 16, 2016 Please Jim, @@kymation clarify, i tried al possible combinations, or its everywhere or have php error thanks
♥kymation Posted March 16, 2016 Posted March 16, 2016 Then you did something wrong. I can't tell what you did without seeing your code. Please post the complete function like you did above so I can see it. Regards Jim See my profile for a list of my addons and ways to get support.
SpicyGirl Posted March 16, 2016 Posted March 16, 2016 Hi Jim, the working code to not have the boxes on the front page is function isEnabled() { global $PHP_SELF, $category_depth; if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) { $this->enabled = false; }else{ return $this->enabled; } } your art is : if($PHP_SELF === 'product_info.php') { how do mixed them together to one working code? Sorry, but I dont see it thanks for help
Recommended Posts
Archived
This topic is now archived and is closed to further replies.