Forums / General Questions / Display certain sidebox on shopping cart page

Display certain sidebox on shopping cart page

Locked

Views: 1,341

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
18 Feb 2010, 3:16 AM
#1
jc_m avatar

jc_m

New Zenner

Join Date:
Jan 2010
Posts:
19
Plugin Contributions:
0

Display certain sidebox on shopping cart page

I want to display only two right sideboxes in the shopping cart page.

Let's say only Tell A Friend sidebox & Who's online sidebox as an example.

I managed to display only right column in the shopping cart page, but it shows all the right column sideboxes. If I turn off the rest of the sidebox except both, it will still display the same sidebox on other pages as well.

Here's an example of what I'm trying to do:

  • Product page: only display Best sellers sidebox
  • Shopping cart page: only display Tell a friend & Who's online sidebox

What code should I use to achieve this?

18 Feb 2010, 3:18 AM
#2
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,187
Plugin Contributions:
0

Re: Display certain sidebox on shopping cart page

JC.M:

I want to display only two right sideboxes in the shopping cart page.

Let's say only Tell A Friend sidebox & Who's online sidebox as an example.

I managed to display only right column in the shopping cart page, but it shows all the right column sideboxes. If I turn off the rest of the sidebox except both, it will still display the same sidebox on other pages as well.

Here's an example of what I'm trying to do:

  • Product page: only display Best sellers sidebox
  • Shopping cart page: only display Tell a friend & Who's online sidebox

What code should I use to achieve this?

Jc,
Take a look at his Tutorial which will get you on the right track
https://www.zen-cart.com/tutorials/index.php?article=270

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

18 Feb 2010, 3:51 AM
#3
jc_m avatar

jc_m

New Zenner

Join Date:
Jan 2010
Posts:
19
Plugin Contributions:
0

Re: Display certain sidebox on shopping cart page

In includes/modules/sideboxes/shopping_cart.php,

  switch (true) {
    case (SHOW_SHOPPING_CART_BOX_STATUS == '0'):
      $show_shopping_cart_box = true;
      break;
    case (SHOW_SHOPPING_CART_BOX_STATUS == '1'):
      if ($_SESSION['cart']->count_contents() > 0 || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0)) {
        $show_shopping_cart_box = true;
      } else {
        $show_shopping_cart_box = false;
      }
      break;
    case (SHOW_SHOPPING_CART_BOX_STATUS == '2'):
      if ( ( (isset($_SESSION['cart']) && $_SESSION['cart']->count_contents() > 0) || (isset($_SESSION['customer_id']) && zen_user_has_gv_account($_SESSION['customer_id']) > 0) ) && ($_GET['main_page'] != FILENAME_SHOPPING_CART) ) {
        $show_shopping_cart_box = true;
      } else {
        $show_shopping_cart_box = false;
      }
      break;
    }


  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;
    $title_link = false;
    $title_link = FILENAME_SHOPPING_CART;

    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
  }

I'm not sure what to change.

Is this the right code?

  if (in_array($current_page_base,explode(",",'shopping_cart')) ) {
    $show_tell_a_friend = true;
  } else {
    $show_tell_a_friend = false;
  }
18 Feb 2010, 6:24 AM
#4
jc_m avatar

jc_m

New Zenner

Join Date:
Jan 2010
Posts:
19
Plugin Contributions:
0

Re: Display certain sidebox on shopping cart page

I tested the code below by replacing the code in includes/modules/sideboxes/YOUR_TEMPLATE/sidebox/tell_a_friend.php

Replace this code,

// test if box should display
  $show_tell_a_friend= false;

with this one,

// test if box should display
  if (in_array($current_page_base,explode(",",'shopping_cart')) ) {
    $show_tell_a_friend = true;
  } else {
    $show_tell_a_friend = false;
  }  

Works for me.

But I'm not sure about doing the same with the product page like,

  • Product page: only display Best sellers sidebox

Anyone?

18 Feb 2010, 6:44 AM
#5
jc_m avatar

jc_m

New Zenner

Join Date:
Jan 2010
Posts:
19
Plugin Contributions:
0

Re: Display certain sidebox on shopping cart page

Also in Admin > Tools > Layout Boxes Controller, make sure set Left/Right Column Status: ON

18 Feb 2010, 1:32 PM
#6
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Display certain sidebox on shopping cart page

The review sidebox will only be displayed on the product info page, you can copy the if condition from that box to the best seller box.

I am not sure if that would work for the best seller sidebox, I believe it is designed to work on product listing pages, but I could be wrong.