Zen Cart Logo
Forums / Other Business Topics / Sidebox Overrides

Sidebox Overrides

Sticky Locked

Views: 15,641

Results 1 to 20 of 41
This thread is locked. New replies are disabled.
26 Jun 2005, 8:11 PM
#1
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Sidebox Overrides

I know this has been discussed before but I can't seem to find anything about this. I want to know how to turn sideboxes off and on depending on the page you are on

(i.e. show bestsellers sidebox on mainpage only)

26 Jun 2005, 8:56 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Sidebox Overrides

wrap an IF statement around everything in the
/includes/modules/sideboxes/YOURTEMPLATE/xxxxxx.php

The IF statement could be coded based on whatever
$current_page
is set to.

($current_page will be set to whatever the URL's ?main_page= is set to)

26 Jun 2005, 9:47 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox Overrides

You will find in the /modules/sideboxes that each file for a sidebox has a setting such as in the featured.php file:

  $show_featured= true;

This can have a setting for an IF

IF (condition) {
  $show_featured= true;
} else {
  $show_featured= false;
}

This will make the box show/not show based on your condition.

You can use things like:

if ($_SESSION['customer_id'] != '')
if ($_SESSION['cart']->count_contents() <= 0) {
if ($_GET['main_page'] == 'index' and $current_category_id=='')
if ($_GET['main_page'] == 'index')

etc. etc.

26 Jun 2005, 10:47 PM
#4
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Sidebox Overrides

and if you want to get real fancy, you can put that true/false define in the configuration table, allowing you to turn the sidebox on and off from the admin.

27 Jun 2005, 1:41 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox Overrides

That is one of the new toys that will eventually be part of Zen Cart ... won't that be some sweet code?! B)

27 Nov 2005, 4:53 PM
#6
toolatesmart avatar

toolatesmart

New Zenner

Join Date:
Nov 2005
Posts:
22
Plugin Contributions:
0

Re: Sidebox Overrides

Not sure if this is off topic, but I wanted my sideboxes to display only if they weren't already displaying in the main column - so no duplicating. Based on one of Dr. Byte's posts I added:

$single_specials= true; to the end of specials_index.php.

// test if box should display
$show_specials= false;
if ($single_specials == true) {
$show_specials= false;
} else {
if (isset($_GET['products_id'])) {
$show_specials= false;
} else {
$show_specials= true;
}
}
to the beginning of specials.php

$single_specials= false; to the end of specials.php

For the featured box I modified featured_products.php and featured.php the same way, changing the variable names. I'm not a programmer so I'm not sure this is exactly correct or if it will work for boxes in the left column. Mine are in the right so it works for me! ;)

28 Nov 2005, 2:28 AM
#7
toolatesmart avatar

toolatesmart

New Zenner

Join Date:
Nov 2005
Posts:
22
Plugin Contributions:
0

Re: Sidebox Overrides

Oops.. also had to add the flag to tpl_featured_products_default.php & tpl_specials_default.php.

19 Dec 2005, 4:57 AM
#8
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Sidebox Overrides

Speaking of sideboxes....

I have been trying to make the font size in the Specials box title match the size of the other category names. My base font is 10pt, but I have all the other header box titles in 14pt.

Since the title of the Specials is an a href link, it is showing in the smaller text.

I have looked in the template, and can't find where in the line of code I could put a font size entry. Plus I'm not sure if I could add it in the defines file instead.

Any advice appreciated,

b

27 Dec 2005, 10:01 PM
#9
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Sidebox Overrides

the above issue has been fixed.

b

27 Dec 2005, 10:57 PM
#10
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,616
Plugin Contributions:
0

Re: Sidebox Overrides

Perhaps telling us how you fixed it would help someone else in the future? Thanks.

27 Dec 2005, 11:27 PM
#11
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Sidebox Overrides

Sorry about not putting in how I got the text to appear like the other sidebox headers instead of a link.

I used the includes/languages/custom/english.php file, which for some may be includes/languages/english.php

and where the define statement for the Specials are:

// specials box text in sideboxes/specials.php
define('BOX_HEADING_SPECIALS', 'SPECIALS');
define('CATEGORIES_BOX_HEADING_SPECIALS','Specials ...');

I changed the first entry which is for the boxes to:

define('BOX_HEADING_SPECIALS', '<div class="sideBoxHeading">SPECIALS</div>');

This gave it the same look as the other sideboxes, even though it was a link.

Since in html to change the text for a <a href> link, you need to add the class or font statement just before the word/phrase that is clickable just before the </a>. I had assumed/hoped this was the case with the define words. In this case, it turned out to be a correct assumption.

As to if this is the case with all the words/phrases in the english.php files, I don't know. Perhaps the Zen Gurus will enlighten.

Betty

29 Dec 2005, 1:25 AM
#12
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Sidebox Overrides

I'm trying to play catch-up now that my sideboxes are back.

If I only want the shopping cart and information boxes to show on the main page. Do I take i.e. includes/modules/sideboxes/shopping_cart.php

and where it says:

if ($show_shopping_cart_box == true) {
require($template->get_template_dir('tpl_shopping_cart.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_shopping_cart.php');
$title = BOX_HEADING_SHOPPING_CART;
$left_corner = false;
$right_corner = false;
$right_arrow = false;
$title_link = false;
$title_link = FILENAME_SHOPPING_CART;

Do I change $current_page_base to main_page=index ???

The page already has the if and else statements, so is this how I make them only show on the main page?

b

29 Dec 2005, 1:39 AM
#13
bettysue avatar

bettysue

Inactive

Join Date:
May 2004
Posts:
747
Plugin Contributions:
0

Re: Sidebox Overrides

Sorry - didn't get to the edit button in time.....

My second question on the sidebox issue is:

The search header had been moved to the header file to
appear above the logo on the right hand side.
Now that my sideboxes are back it is also showing above the shopping cart. Is there a way to only have the one in the header show and not the one wear the other sideboxes are.

I know I've asked more than my share of questions lately, however hopefully the Gurus can see that I was given a pile of junk to put a store together, and much of this is way beyond my knowledge (so far).

Betty

b

PS - I don't know if it's only me, but today I haven't been getting any emails notifying me of replies

30 Dec 2005, 3:37 PM
#14
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: Sidebox Overrides

How can I use the if function given by Ajeh to turn a sidebox off on multiple pages. I would like to turn off the sidebox for all of the checkout pages: checkout_shipping, checkout_payment, checkout_confirmation.

I have successfully turned it off for one, but not all.

Right now the if statement says if (a certain page) than false. How can I make it say if (page 1) or (page 2) or (page 3) than false, otherwise true?

Thanks!

(just to avoid having this dumb response, I don't simply turn the column off because I want to include a sidebox specifically about checking out - thanks)

30 Dec 2005, 11:37 PM
#15
jeff_fwd avatar

jeff_fwd

Totally Zenned

Join Date:
Jun 2003
Location:
CA
Posts:
212
Plugin Contributions:
0

Re: Sidebox Overrides

..

31 Dec 2005, 2:43 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox Overrides

How are you currently turning it off for the one page? :)

31 Dec 2005, 3:02 AM
#17
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: Sidebox Overrides

Hi Ajeh,

Like this:

if ($_GET['main_page'] == 'checkout_shipping'){
  $show_(my sidebox) = false;
} else {
  $show_(my sidebox) = true;
}

Can I just multiply this for each page I don't want it to show up on? I did that but it didn't work (maybe I did something wrong.) Like this:

if ($_GET['main_page'] == 'checkout_shipping'){
  $show_(my sidebox) = false;
} else {
  $show_(my sidebox) = true;
}

if ($_GET['main_page'] == 'checkout_payment'){
  $show_(my sidebox) = false;
} else {
  $show_(my sidebox) = true;
}

if ($_GET['main_page'] == 'checkout_confirmation'){
  $show_(my sidebox) = false;
} else {
  $show_(my sidebox) = true;
}

Is this correct use of php? For the checkout sidebox that I am going to create I will be doing the opposite:

if ($_GET['main_page'] == 'checkout_shipping'){
  $show_(my sidebox) = true;
} else {
  $show_(my sidebox) = false;
}

And so on . . .

31 Dec 2005, 3:06 AM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox Overrides

Close ... but no cigar ... :blink:

Unfortunately ... the IFs will processes ... and keep changing the value based on that given moment ...

To use the IF statements right you could use:

$show_(my sidebox) = true;
if ($_GET['main_page'] == 'checkout_shipping'){
 $show_(my sidebox) = false;
}

if ($_GET['main_page'] == 'checkout_payment'){
 $show_(my sidebox) = false;
}

if ($_GET['main_page'] == 'checkout_confirmation'){
 $show_(my sidebox) = true;
}

This way if 1 happens it changes the $show_blah to false and stays false through the next IF

Or, you could use CASE statements where only one can happen ...

31 Dec 2005, 4:44 AM
#19
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: Sidebox Overrides

Thanks Ajeh. I had the right idea but got lost in the php syntax. Here is what I did for future reference to others who have the same question.

This is the code I used to make the checkout sidebox appear only in the sidebox pages.

$show_checkout_box = false;
if ($_GET['main_page'] == 'checkout_shipping'){
 $show_checkout_box = true;
}
if ($_GET['main_page'] == 'checkout_payment'){
 $show_checkout_box = true;
}

if ($_GET['main_page'] == 'checkout_confirmation'){
 $show_checkout_box = true;
}

And of course tha code mentioned above to make the other sidebox disappear on these pages:

$show_help_box = true;
if ($_GET['main_page'] == 'checkout_shipping'){
 $show_help_box = false;
}

if ($_GET['main_page'] == 'checkout_payment'){
 $show_help_box = false;
}

if ($_GET['main_page'] == 'checkout_confirmation'){
 $show_help_box = false;
}

Thanks again Ajeh!

31 Dec 2005, 5:14 AM
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sidebox Overrides

You are most welcome ... glad that you are back on track ... :)