contrib complet_header, search / login / cart dans le header |
Bienvenue invité ( Connexion | Inscription )
contrib complet_header, search / login / cart dans le header |
2 Feb 2007, 23:44
Message
#1
|
|
Ceinture jaune OSC 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 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... |
|
3 Feb 2007, 00:20
Message
#2
|
|
Ceinture jaune OSC Groupe : Membres Messages : 42 Inscrit : 27-January 07 Membre no 14931 |
l'erreur vient du header_search, il manque le </form>
le header_search.php devient CODE <?php
/* $Id: header_search.php,v 1.1.1.1 2003/04/06 12:15:21 wilt Exp $ osCommerce, Open Source E-Commerce Solutions [url=http://www.oscommerce.com]http://www.oscommerce.com[/url] Copyright © 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="12" maxlength="30" value="' . htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["keywords"])) . '" style="width: ' . (BOX_WIDTH-30) . 'px; height:20px"> <input type="submit" value="go" /> </form>'; ?> </td> </tr> <!-- Header_search_eof //--> Ce message a été modifié par nexius2 - 3 Feb 2007, 00:31. -------------------- oscommerce 2.2-ms2 fr
+ header_tag V 2.6.2 + Ultimate_SEO_URLsv21da + autre... |
|
19 Feb 2007, 19:59
Message
#3
|
|
Ceinture blanche+ OSC Groupe : Membres Messages : 37 Inscrit : 3-October 05 Membre no 7331 |
Bonjour,
SUPERBE ! exactement ce que je cherchais ! Cependant, j'ai du rajouter à mon fichier includes/languages/french.php les lignes suivantes qui manquaient : define('LOGIN_BOX_CONNECTION', 'Client existant'); define('LOGIN_BOX_PASSWORD_FORGOTTEN', 'Mot de passe perdu ?'); define('LOGIN_BOX_CREATE_ACCOUNT', 'Créer un compte'); define('LOGIN_BOX_WELCOME_LOGIN', 'Connexion'); define('LOGIN_BOX_WELCOME_TEXT', 'Vous êtes connecté en tant que : '); define('LOGIN_BOX_WELCOME_MYACCOUNT', 'Mon Compte'); define('LOGIN_BOX_WELCOME_LOGOUT', 'Déconnexion'); Pour english.php on rajoutera donc : define('LOGIN_BOX_CONNECTION', 'Returning customer'); define('LOGIN_BOX_PASSWORD_FORGOTTEN', 'Forgotten your password ?'); define('LOGIN_BOX_CREATE_ACCOUNT', 'Create an account'); define('LOGIN_BOX_WELCOME_LOGIN', 'Sign in'); define('LOGIN_BOX_WELCOME_TEXT', 'Welcome back '); define('LOGIN_BOX_WELCOME_MYACCOUNT', 'My Account'); define('LOGIN_BOX_WELCOME_LOGOUT', 'Sign Out'); Sinon ça roule ! bravo. -------------------- Plateforme :OSC ms2fr-051113 - Apache - MySQL 4.1.20 - PHP 4.3.10
Contrib : Country/State selector - big_images 1.25 - define_mainpage_v1.3.3 - Fixed Width Site With CSS - LoginBox_5.21 - Must Agree to Terms v1.5.6 - order_history_1.1 - visible_countries_1.1c - TotalB2B - postfinance_asulis_2006-05-09 |
|
21 Feb 2007, 07:54
Message
#4
|
|
Ceinture blanche+ OSC Groupe : Membres Messages : 37 Inscrit : 3-October 05 Membre no 7331 |
Re-Bonjour,
Dans mon cas, j'ai eu un problème pour la fonction recherche qui renvoyait l'erreur suivante : 1066 - Not unique table/alias: 'pd' J'ai donc appliqué ça : Open the advanced_search_result.php file from the contribution. Search for the following text: // START: Extra Fields Contribution // $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; $from_str = "from (" . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id) left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; // END: Extra Fields Contribution if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { if (!tep_session_is_registered('customer_country_id')) { $customer_country_id = STORE_COUNTRY; $customer_zone_id = STORE_ZONE; } $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')"; } $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; The very last line adds tables to $from_str that are already there, so you can safely remove it. That is, erase the following: $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; And resave. It should then work. Que j'ai trouvé ici : http://forums.oscommerce.com/index.php?sho...18357&st=40 Et maintenant tout fonctionne correctement. Ce message a été modifié par jimmyjones - 21 Feb 2007, 07:55. -------------------- Plateforme :OSC ms2fr-051113 - Apache - MySQL 4.1.20 - PHP 4.3.10
Contrib : Country/State selector - big_images 1.25 - define_mainpage_v1.3.3 - Fixed Width Site With CSS - LoginBox_5.21 - Must Agree to Terms v1.5.6 - order_history_1.1 - visible_countries_1.1c - TotalB2B - postfinance_asulis_2006-05-09 |
|
13 Mar 2007, 19:21
Message
#5
|
|
Ceinture orange OSC Groupe : Membres Messages : 191 Inscrit : 15-November 04 Membre no 3784 |
Bonjour à tous,
J'ai une boutique avec le panier dans le header qui affiche une image et le nombre d'article qu'il contient !!! J'aimerai que quand le client ajoute un article dans son panier, il ne soit pas redirigé directement dans le panier et je vais le modifier dans l'admin car c'est possible. Le truc, c'est que j'ai peur que mes clients ne voient pas le panier dans le header et j'aimerai que : Si panier = <1 article : on affiche l'image "image_1.gif" Si panier = >1 article : on affiche l'image "image_2.gif" Je suis pas un pro du PHP et j'aimerai qu'on me donne un petit coup de main si c'est possible Voici le code de l'image dans mon HEADER : <a href=<?=tep_href_link('shopping_cart.php')?> title="Visualiser le contenu de votre panier"><img src=images/m08_2.gif width=40 height=40 border=0></a> Je ne sais pas comment faire le IF, ELSE D'avance merci de votre aide Thierry Ce message a été modifié par thierry_montpellier - 13 Mar 2007, 19:21. |
|
26 Oct 2011, 18:26
Message
#6
|
|
Ceinture jaune OSC Groupe : Membres Messages : 51 Inscrit : 28-April 11 Membre no 29751 |
Bonjour,
J'ai des petits problèmes pour insérer le code sur mon site, notamment dans le header_login. Avec ce code lorsque je rentre mon email et mot de passe, ben ça se connecte pas et ça me redirige vers la page de connexion standard. Dans un deuxième temps, lorsque je me connecte (depuis la page connexion), dans mon header j'ai les messages suivant qui s'affichent : "Deprecated: Function mysql_db_query() is deprecated in U:\WEB\EasyPHP-5.3.8.1\www\catalog\includes\header_login.php on line 12 Deprecated: mysql_db_query() [function.mysql-db-query]: This function is deprecated; use mysql_query() instead in U:\WEB\EasyPHP-5.3.8.1\www\catalog\includes\header_login.php on line 12 Vous êtes connecté en tant que : Vincent" J'aimerai savoir comment corriger ce problème de base de données, probablement tout bête... merci d'avance Vincent -------------------- oscommerce-france-oscommerce2-1a17f72
|
|
26 Oct 2011, 19:12
Message
#7
|
|
Ceinture jaune OSC Groupe : Membres Messages : 51 Inscrit : 28-April 11 Membre no 29751 |
et en remplaçant dans header_login
$result=mysql_db_query($db,$select); par $result=mysql_query($db,$select); j'obtiens le message d'erreur : "Warning: mysql_query() expects parameter 2 to be resource, string given in U:\WEB\EasyPHP-5.3.8.1\www\catalog\includes\header_login.php on line 12 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in U:\WEB\EasyPHP-5.3.8.1\www\catalog\includes\header_login.php on line 13 Vous êtes connecté en tant que : " donc il n'y a même plus le nom de l'utilisateur... Merci de votre aide... Vincent -------------------- oscommerce-france-oscommerce2-1a17f72
|
|
26 Oct 2011, 19:49
Message
#8
|
|
Ceinture marron OSC Groupe : Modérateurs Messages : 1543 Inscrit : 30-May 06 Lieu : Vichy (03) Membre no 10583 |
-------------------- 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 |
|
27 Oct 2011, 09:04
Message
#9
|
|
Ceinture jaune OSC Groupe : Membres Messages : 51 Inscrit : 28-April 11 Membre no 29751 |
Bonjour,
merci pour cette réponse, et ce lien (que j'avais déjà consulté sans rien y comprendre...) Du coup mon code $db=DB_DATABASE; $select="select customers_firstname from customers where customers_id=\"$customer_id\""; $result=mysql_query($db,$select); $res=mysql_fetch_object($result); se transforme en $db=DB_DATABASE; $select="select customers_firstname from customers where customers_id=\"$customer_id\""; $result=mysql_query($select); $res=mysql_fetch_object($result); Il semble marcher !!! les messages d'erreurs ne s'affichent plus !!! Par contre lorsque je rentre mon adresse et mot de passe, la connexion ne se fait pas et ça me renvoi vers la page des connexions... est-ce normal ou est-il possible de changer ça ? merci encore !!! Vincent -------------------- oscommerce-france-oscommerce2-1a17f72
|
|
27 Oct 2011, 09:21
Message
#10
|
|
Ceinture marron OSC Groupe : Modérateurs Messages : 1543 Inscrit : 30-May 06 Lieu : Vichy (03) Membre no 10583 |
Re,
Essaye de remplacer : Code echo '<form name="login" action="login.php?action=process" method="post"> par : Code echo '<form name="login" method="post" action="' . tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL') . '"> Je pense qu'il doit y avoir 2 lignes qui commencent par <form : 1) dans le cas où il n'existe pas de session enregistrée pour le customer_id if (!tep_session_is_registered('customer_id')) 2) dans le cas où il existe une session enregistrée pour le customer_id if (tep_session_is_registered('customer_id')) Ce message a été modifié par Bonbec - 27 Oct 2011, 09:21. -------------------- 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 |
|
27 Oct 2011, 13:17
Message
#11
|
|
Ceinture jaune OSC Groupe : Membres Messages : 51 Inscrit : 28-April 11 Membre no 29751 |
Re,
Avec cette nouvelle ligne ça ne change rien, lorsque je mets mes identifiants dans la case du header je suis redirigé vers la page connexion (dans l'écran central). J'ai essayé de faire les deux if, dans ce cas là ça n'améliore rien, au contraire une fois connecté j'ai une partie des boutons (déconnexion par ex) qui ne s'affichent plus. Mon problème est donc mineur maintenant, je ne pense pas que ce soit nécessaire d'y passer trop de temps dessus... merci encore -------------------- oscommerce-france-oscommerce2-1a17f72
|
|
27 Oct 2011, 21:49
Message
#12
|
|
Ceinture marron OSC Groupe : Modérateurs Messages : 1543 Inscrit : 30-May 06 Lieu : Vichy (03) Membre no 10583 |
-------------------- 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 |
|
Version bas débit | Nous sommes le : 28th March 2024 - 11:45 |
Ce site est déclaré auprès de la commision Nationale de l'Informatique et des Libertés (déclaration n°: 1043896) |