osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

> contrib complet_header, search / login / cart dans le header
nexius2
posté 2 Feb 2007, 23:44
Message #1


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 42
Inscrit : 27-January 07
Membre no 14931



Bonjour a tous,
ne trouvant pas mon bonheur, j'ai fait une petite contrib regroupant une search box, un panier et un login dans le header, certainne partie sont issue d'autre contrib et le code est perfectible...

une petit image pour voir ce que ca donne

Image IPB

et le code:

CODE


=====================================================
1 the header.php
=====================================================

in catalog\includes\header.php find

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr class="header">
    <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>'; ?></td>
    <td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>  <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>  <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?>  </td>
  </tr>
</table>

replace with

<TABLE border="0" width="100%" height="100" cellspacing="0" cellpadding="0">
  <TR>
    <TD height="3" width="100%"></TD>
  </TR>
  <TR>
    <TD>    
      <table border="0" width="100%" height="100" cellspacing="0" cellpadding="0">
        <tr class="header">
          <td valign="middle" align="left" width="50%"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'Oscommerce') . '</a>'; ?></td>
          <td>
            <TABLE border="0" width="100%" height="100" cellspacing="0" cellpadding="0">
              <?php require(DIR_WS_INCLUDES . 'header_login.php');?>
              <?php require(DIR_WS_INCLUDES . 'header_cart.php');?>
              <?php require(DIR_WS_INCLUDES . 'header_search.php');?>
            </TABLE>
          </td>
        </tr>
      </table>    
    </TD>
</TR>
</TABLE>

=====================================================
2 header_searche.php
=====================================================

create catalog\includes\header_search.php

<?php
/*
$Id: header_search.php,v 1.1.1.1 2003/04/06 12:15:21 wilt Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2001 osCommerce

Released under the GNU General Public License
## Patch bandeau Search dans Header : GniDhal gnidhal@free.fr ##
*/
?>
<!-- Header search //-->
<tr>
<td align="right" valign="bottom" class="BoxHeadingSearch"  height="25%" width="100%">
<?php

$hide = tep_hide_session_id();
echo '<form name="quick_find" method="get" action="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false) . '">';
echo tep_draw_hidden_field('search_in_description', '1', ' CHECKED');
echo $hide . BOX_SEARCH_TEXT_SHORT . ' <input type="text" name="keywords" size="10" maxlength="30" value="' . htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["keywords"])) . '" style="width: ' . (BOX_WIDTH-90) . 'px; height:20px"> <input type="submit" value="go" />   ';

?>
</td>
</tr>
<!-- Header_search_eof //-->

=====================================================
3 header_cart.php
=====================================================

create catalog\includes\header_cart.php and add

<!-- Header Cart //-->
<tr>
<td align="left" valign="center" class="BoxHeadingcart" height="50%" width="100%">


  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'); ?>"><?php echo BOX_HEADING_SHOPPING_CART; ?></a><BR>
  <?php echo $cart->count_contents();?> 
    <?php
      if ($cart->count_contents() > 1) {
        echo TABLE_HEADING_PRODUCTS;
          } else {
        echo TABLE_HEADING_PRODUCT;
      }
    ?>
  <BR>
  <?php echo TABLE_HEADING_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?>

</td>
</tr>
<!-- Header_Cart_eof //-->

=====================================================
4 header_login.php (not yet functionnal)
=====================================================


<!-- Header login //-->
<tr>
<td height="25%" width="100%">

<?php

if (tep_session_is_registered('customer_id')) {

    $db=DB_DATABASE;
    
    $select="select customers_firstname from customers where customers_id=\"$customer_id\"";
    $result=mysql_db_query($db,$select);
    $res=mysql_fetch_object($result);

         echo '<table width="100%"><tr><td class="BoxHeadingsearch" align="left" valign="top">' . LOGIN_BOX_WELCOME_TEXT . ' ' . "$res->customers_firstname" . '</td><td class="BoxHeadingsearch" align="right"><a href="'.tep_href_link(FILENAME_ACCOUNT, '', 'SSL').'">' . LOGIN_BOX_WELCOME_MYACCOUNT . "</a>" . '<BR><a href="'.tep_href_link(FILENAME_LOGOFF, '', 'NONSSL').'">' . LOGIN_BOX_WELCOME_LOGOUT . "</a>" . '</td></tr></table>';
         } else {
        
         echo '<form name="login" action="login.php?action=process" method="post"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="BoxHeadingsearch" align="left" valign="top">' . LOGIN_BOX_CONNECTION . ' ' . tep_draw_input_field('email_address','votre email', 'size="12"  maxLength="96" onfocus="this.value=\'\'"') . ' ' . tep_draw_input_field('password', '******' ,'size="12"', 'password', 'maxLength="96" onfocus="this.value=\'\'"') . '<input type="submit" value="' . LOGIN_BOX_WELCOME_LOGIN . '" name="Submit"></td><td class="BoxHeadingsearch" align="right"><a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN) .'">' . LOGIN_BOX_PASSWORD_FORGOTTEN . ' <BR></a><a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT) . '">' .  LOGIN_BOX_CREATE_ACCOUNT . ' </a></td></tr></table></form>';
         }

?>

</td>
</tr>
<!-- Header_login_eof //-->


=====================================================
5 language change
=====================================================
in catalog\includes\languages\english.php find

// quick_find box text in includes/boxes/quick_find.php

add immediatly after

define('BOX_SEARCH_TEXT_SHORT', 'Find a product');

or in

catalog\includes\languages\french.php

add

define('BOX_SEARCH_TEXT_SHORT', 'Rechercher un produit');

still in the <language>.php

before

?>

for french add

// Cart
define('TABLE_HEADING_TOTAL', 'Total');
define('TABLE_HEADING_PRODUCT', 'Article');
define('TABLE_HEADING_PRODUCTS', 'Articles');

for english add

// Cart
define('TABLE_HEADING_TOTAL', 'Total');
define('TABLE_HEADING_PRODUCT', 'Product');
define('TABLE_HEADING_PRODUCTS', 'Products');


=====================================================
6 stylesheet
=====================================================

in stylesheet.php find

SPAN.errorText {
  font-family: Verdana, Arial, sans-serif;
  color: #ff0000;
}

immediatly after add


TD.BoxHeadingSearch {
  font-family: Verdana, Arial, sans-serif;
  font-size: 10px;
  font-weight: bold;
  color: #000000;
}
A.BoxHeadingSearch {
  color: #000000;
}
A.BoxHeadingSearch:hover {
  color: #000000;
}

TD.BoxHeadingcart {
  font-family: Verdana, Arial, sans-serif;
  font-size: 10px;
  font-weight: bold;
  color: #000000;
}
A.BoxHeadingcart {
  color: #000000;
}
A.BoxHeadingcart:hover {
  color: #FF0000;
}



des avis, interessé, modifs a proposé etc... ???

bon, j'ai deja trouvé une erreur, sur un oscommerce d'origine, la liste de fabericants ne marche plus, elle renvoi vers advanced_search_result.php....



--------------------
oscommerce 2.2-ms2 fr
+ header_tag V 2.6.2 + Ultimate_SEO_URLsv21da + autre...
Go to the top of the page
 
 
Start new topic
Réponse(s)
Bonbec
posté 27 Oct 2011, 21:49
Message #2


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Re,

Peut-être que ceci résoudra le problème ?


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 

Les messages de ce sujet


Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 29th March 2024 - 06:15
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)