hello,
Le fait que ce soit dans le head ne change rien...
C'est plus un pb de template surement... le tep_href_link ne devrai pas poser de pb,
Par contre , quelle navigateur utilise tu ?
Je viens de m'apercevoir que la modif de quantité ne marche pas sur ie et opéra...
Une petite erreur de js, doit en etre à l'origine,..
Donc, si vous trouvez, merci de m'en informer.
Bon donc vu que c tout buggé et que je trouve pas la solution pour le fairee tourner sur autre chose que firefox : je met le code ici, en esperant debloquer la situation au plus vite .. Toute aide est la bienvenue!
(le pb viens de : var cartQty = document.getElementById('cart_quantity').eval(cartQtyId).value; )
--------------------------------------------------------------------------------------------------------------
1)in includes/languages/french/shopping_cart.php :
Add before ?> near the end :
define('TEXT_CART_DEL_CONFIRM', 'Voulez vous vraiment supprimer ce produit?');
2)in includes/languages/english/shopping_cart.php :
Add before ?> near the end :
define('TEXT_CART_DEL_CONFIRM', 'Would you like to delete this product?');
3)in shopping_cart.php :
Just before : near line 28 :
</head>
Add :
CODE
<?php $first_ajax_caracter_url = (SESSION_FORCE_COOKIE_USE == 'True') ? '?' : '&'; ?>
<script type="text/javascript">
<!--//
function writedel(text, cart_id) {
var cartDelId = 'ajaxcartProduct'+cart_id;
document.getElementById(cartDelId).innerHTML = '';
document.getElementById('ajaxcartSubTotal').innerHTML = text;
}
function changecartdel(cart_id) {
if (confirm ("<?php echo TEXT_CART_DEL_CONFIRM; ?>")){
if(text = file('<?php echo tep_href_link('ajax_cart.php').$first_ajax_caracter_url; ?>cart_id='+escape(cart_id))){
writedel(text, cart_id);
}
} else {
var cartCheckId = 'cart_delete'+cart_id;
document.getElementById('cart_quantity').eval(cartCheckId).checked = false;
}
}
function writeqty(texte1, texte2, cart_id) {
var cartPriceId = 'ajaxcartPrice'+cart_id;
document.getElementById(cartPriceId).innerHTML = texte1;
document.getElementById('ajaxcartSubTotal').innerHTML = texte2;
}
function changecartqty(cart_id) {
var cartQtyId = 'cartQty'+cart_id;
var cartQty = document.getElementById('cart_quantity').eval(cartQtyId).value;
if ( cartQty > 0) {
if(texte = file('<?php echo tep_href_link('ajax_cart.php').$first_ajax_caracter_url; ?>cart_id='+escape(cart_id)+'&'+'product_qty='+eval(cartQty))){
update = texte.split('|');
writeqty(update[0],update[1], cart_id);
}
}
}
function file(fichier){
if(window.XMLHttpRequest) // FIREFOX
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
return(false);
xhr_object.open("GET", fichier, false);
xhr_object.send(null);
if(xhr_object.readyState == 4)
return(xhr_object.responseText);
else return(false);
}
//-->
</script>
4) in the same file, near line 91:
replace :
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
With :
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product'), 'post', 'id="cart_quantity"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
4bis) in the same file, near line 117:
replace :
if (($i/2) == floor($i/2)) {
$info_box_contents[] = array('params' => 'class="productListing-even"');
} else {
$info_box_contents[] = array('params' => 'class="productListing-odd"');
}
With :
if (($i/2) == floor($i/2)) {
$info_box_contents[] = array('params' => 'class="productListing-even" id="ajaxcartProduct'. $i .'"');
} else {
$info_box_contents[] = array('params' => 'class="productListing-odd" id="ajaxcartProduct'. $i .'"');
}
5) in the same file, near line 163:
replace :
'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));
With :
'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], false, 'onchange="changecartdel('.$i.')" id="cart_delete'.$i.'"'));
6) in the same file, near line 195:
replace :
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top"',
With :
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" id="cartQty'.$i.'" onkeyup="changecartqty('.$i.')"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
$info_box_contents[$cur_row][] = array('align' => 'right',
'params' => 'class="productListing-data" valign="top" id="ajaxcartPrice'. $i .'"',
7) in the same file, near line 173:
replace :
<td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
With :
<td align="right" class="main" id="ajaxcartSubTotal"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
add in catalog file : ajax_cart.php
CODE
<?php
/*
$Id: ajax_cart.php,v 1.0 2006/03/08 14:51:24 stepibou Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require("includes/application_top.php");
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);
$cart_id_get = (int)tep_output_string_protected($_GET['cart_id']);
$products = $cart->get_products();
if(!empty($_GET['product_qty'])) {
$product_qty_get = (int)tep_output_string_protected($_GET['product_qty']);
$attributes = (isset($products[$cart_id_get]['attributes'])) ? $products[$cart_id_get]['attributes'] : '';
$cart->add_cart($products[$cart_id_get]['id'], $product_qty_get, $attributes, false);
$subTotal = '<b>' . SUB_TITLE_SUB_TOTAL .' '. $currencies->format($cart->show_total()).'</b>';
$products_sum = '<b>' .$currencies->display_price($products[$cart_id_get]['final_price'], tep_get_tax_rate($products[$cart_id_get]['tax_class_id']), $product_qty_get) .'</b>';
echo $products_sum.'|'.$subTotal;
} else {
$cart->remove($products[$cart_id_get]['id']);
$subTotal = '<b>' . SUB_TITLE_SUB_TOTAL .' '. $currencies->format($cart->show_total()).'</b>';
echo $subTotal;
}
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>