New Zenner
- Join Date:
- Sep 2006
- Posts:
- 27
- Plugin Contributions:
- 0
Not to show Featured Product Sidebox on main page
Can this be applied for Categories box?
Axel
Views: 9,357
New Zenner
Can this be applied for Categories box?
Axel
Oba-san
You can control all sideboxes by setting a given condition and just not letting it run ...
Same holds true of any page, column, centerbox, etc.
That is the beauty of being able to customize the code ... just need to find the trigger to manage the element that you are trying to control ... :cool:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
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!
New Zenner
Hi there,
Just did what was suggested in that thread, it works great.
I have a question though: I'd rather not touch the code that is not in MY_TEMPLATE.
Is there any suggestion to be able to do the same thing as changing into modules/incription.php (example given) but to keep this change in MY_TEMPLATE?
I've modified the tpl_information.php with the if statement suggested here , but the header of "information" still appears. (which is logical). Anyway to pick up whatever sidebox you want for different pages/ categories without touching the core code?
THanks!
cristele
New Zenner
Copy the file and place it within your template folder beneath modules/.
Use:
modules/MY_TEMPLATE/incription.php
Then you can modify that code without worrying about messing up the core file.
Keep in mind that whereever you see a classic folder, you can place your own folder with the same name as MY_TEMPLATE to override the core files, without modifying core files.
Steve
New Zenner
burtjesus:
Copy the file and place it within your template folder beneath modules/.
Use:
modules/MY_TEMPLATE/incription.php
Then you can modify that code without worrying about messing up the core file.
Keep in mind that whereever you see a classic folder, you can place your own folder with the same name as MY_TEMPLATE to override the core files, without modifying core files.
it didnt work...let me check i got you write:
my template's name is "MY_TEMPLATE".
so you say the inscription.php should be here:
[zencart_location]\includes\templates\MY_TEMPLATE\modules\MY_TEMPLATE\inscription.php
Is it correct?
thanks,
cristele
New Zenner
The file should be located in /includes/modules/MY_TEMPLATE/[somefile.php]
This file will override the default file located in /includes/modules
Keep in mind that whereever you see a classic folder, you can place your own folder with the same name as MY_TEMPLATE to override the core files, without modifying core files.
Steve
New Zenner
That's very cool....works like a charm:cool:
This is the coolest feature about ZenCart!
New Zenner
It's a fantastic template override system.
It's important that you don't modify core files.. you should always use template override. Just create a folder in the appropriate directory called MY_TEMPLATE (use the real name of your template) and copy the default files into it. You can modify those files. If you screw it up royally, you can remove your override file, and the cart will use the defualt files again.
See this link for some more info, and try some other searches in the tutorials or wiki
https://www.zen-cart.com/tutorials/index.php?article=36
Steve
New Zenner
I have really tried to follow this thread, copying and pasting and testing and ...... getting nowhere except very frustrated.
I downloaded the blank_sidebox.php. Renamed it to colour_sidebox.php
into the 3 relevant folders as per the instructions.
I am using override of merlin/. on the admin/tools/layout boxes controller I have turned on the sidebox.
It now shows on all pages. However, I do not want it to show on the home page.
What code do I use please and where do I put it.. Polite responses please..
Thank you in anticipation
New Zenner
Bump !
Following on from the above, I have changed my code to the following.
The Colours side box still shows on the main page. Any ideas please..
I have tried changing the false to true, but nothing happens
// test if box should display
$show_colour_sidebox = false;
$this_is_home_page = $($current_page== 'sideboxes');
$show_colour_sidebox = !$this_is_home_page;
if ($show_colour_sidebox == true) {
require($template->get_template_dir('tpl_colour_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_colour_sidebox.php');
$title = BOX_HEADING_COLOUR_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
Oba-san
If I were to do this to the Featured sidebox ... I would copy the code to the proper templates and overrides and edit the file to change:
// test if box should display
$show_featured= true;
To read:
// test if box should display
// $show_featured= true;
$show_featured = !$this_is_home_page;
Now the condition is based on the existing $this_is_home_page and only shows when false or !$this_is_home_page
So more or less you are using:
// test if box should display
$show_colour_sidebox = false;
$this_is_home_page = $($current_page== 'sideboxes');
$show_colour_sidebox = !$this_is_home_page;
And should be using:
// test if box should display
// $show_colour_sidebox = false;
$show_colour_sidebox = !$this_is_home_page;
Note: commenting out the:
// $show_colour_sidebox = false;
is just to eliminate confusion ... whether or not it is commented out is is reset by the next line:
$show_colour_sidebox = !$this_is_home_page;
Easy smeasy, eh? :cool:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
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!
New Zenner
Hi Linda
I wish it was so easy.
This is the code I now have.
// test if box should display
$show_colour_sidebox = !$this_is_home_page;
if ($show_colour_sidebox == true) {
require($template->get_template_dir('tpl_colour_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_colour_sidebox.php');
$title = BOX_HEADING_COLOUR_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
this code resides in ..includes\modules\MY_TEMPLATE_NAME\colour_sidebox.php
Unfortunately the colour side box still shows on the main page.
This is the only colour_sidebox.php file that I have on the system. So I must be missing something else.
thank you for your prompt reply..
I will get the hang of this.......
Oba-san
Add this just before the IF statement in your sidebox:
echo 'I SEE ' . ($this_is_home_page == true ? "Lucy I'm Home!" : "Rick? Where are you");
Then look where you should see the sidebox and tell me what it reads ... :smile:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
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!
New Zenner
Hi I have added the code as suggested and all I get is the side box
no other description...
New Zenner
I am running V 1.3.7
Oba-san
Have you an URL to your site and do you have the sidebox currently show on your site?
And your code looks like what now?
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
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!
New Zenner
Hi Linda
Sorry. I am working on localhost, building the site, as I am already live with a HTML site at https://www.merlinmounts.co.uk...
I know this is not the ideal solution, but I am sure you are aware it is the easiest option. - until that is.. one gets problems...
This is my code that I have in...
store\includes\modules\merlin\colour_sidebox.php.
merlin is my override folder..
Basically I downloaded the Blank_sidebox 2 from the site. Changed all occurences of blank_sidebox to my own name of colour_sidebox in the 3 override folders.
// test if box should display
// $show_colour_sidebox = false;
// $this_is_home_page = $($current_page== 'sideboxes');
$show_colour_sidebox = !$this_is_home_page;
echo 'I SEE ' . ($this_is_home_page == true ? "Lucy I'm Home!" : "Rick? Where are you");
if ($show_colour_sidebox == true) {
require($template->get_template_dir('tpl_colour_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_colour_sidebox.php');
$title = BOX_HEADING_COLOUR_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
New Zenner
To help me understand. could you please explain briefly where the term
$this_is_home_page
comes from. Is it an actual name of a page?
New Zenner
Sorry to add to the above.
Is it the same as $this_is_main_page.php
Oba-san
$this_is_home_page is a variable set when the main page is resolved to the actual "home" page of your site to distinguish between all of the other pages ...
You can find where it is set by going to the Developers Tool Kit in your Admin under the Tools menu ...
Enter it in the bottom input box and select Catalog/Admin and click search ...
You will see where there is a:
$this_is_home_page = blah blah blah
Now, if you do not find this ... then you have files out of date from an upgrade issue ...
I am really surprised that you are not seeing Lucy or Ricky on this as one or the other should be showing ...
Are you sure you are editing the right file?
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
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!
Tell staff why this post should be reviewed.