Forums / General Questions / Shopping cart in header

Shopping cart in header

Views: 698

Results 1 to 5 of 5
5 Oct 2011, 5:00 PM
#1
niko62 avatar

niko62

New Zenner

Join Date:
Jul 2010
Posts:
24
Plugin Contributions:
0

Shopping cart in header

Hello,

I would like to put my shopping cart into the top of the header (see attached file).

Does any one can help me ?

27 Oct 2011, 3:56 PM
#3
niko62 avatar

niko62

New Zenner

Join Date:
Jul 2010
Posts:
24
Plugin Contributions:
0

Re: Shopping cart in header

Thanks, I tried the 2nd... But it's only display :

TEXT_TOTAL_ITEMS2  TEXT_TOTAL_AMOUNT€578.99

here is the code I added to my tpl_header

<div class="panier"> <div id="cont_panier"><?php require(DIR_WS_MODULES . 'sideboxes/cart_summary.php'); ?></div></div>

here is the content of cart_summary.php into includes/modules/sideboxes :

<?php
/**
 * cart_summary ("sidebox") - this sidebox can be used to display a summary of the customer's cart content in header or sidebox
 *
 * @package sideboxes
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: cart_summary.php  $
 */

  $item_separator = ($box_id == '') ? '  ' : '<br />';

  $totalsDisplay = '';
  switch (true) {
    case (SHOW_TOTALS_IN_CART == '1'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    case (SHOW_TOTALS_IN_CART == '2'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($_SESSION['cart']->show_weight() > 0 ? $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT : '') . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    case (SHOW_TOTALS_IN_CART == '3'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
  }
  $content = $totalsDisplay;

/////////////////////////
// Determine whether displaying as sidebox should be disabled, based on Admin settings under Admin->Configuration->Stock
  $show_shopping_cart_box = true;
  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 ( ( ($_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;
  }
///////////////////////


  require($template->get_template_dir('tpl_cart_summary.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_cart_summary.php');

  if ($box_id !='' && $show_shopping_cart_box == true) {
    $title = '<label>' . BOX_HEADING_CART_CONTENTS . '</label>';
    $title_link = false;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
  } else {
    if ($show_shopping_cart_box == true)
    require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
  }
?>

Can anyone help me ?

Thanks

27 Oct 2011, 4:18 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping cart in header

You are missing a language file for the mod. Perhaps there is only an /english/ file. If so, you will need to copy and translate it into a /french/ version.

27 Oct 2011, 4:34 PM
#5
niko62 avatar

niko62

New Zenner

Join Date:
Jul 2010
Posts:
24
Plugin Contributions:
0

Re: Shopping cart in header

Oops, my bad... :blush: Many thanks, it works !