Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

lavoriamopervoi

Archived
  • Posts

    11
  • Joined

  • Last visited

Posts posted by lavoriamopervoi

  1. Hello,

    I have installed this contribution: Ajax Shopping Cart but removed because it is not stable.

    So I decided to try to create a similar contribution like this:

    code shopping_cart.php:

    <?php
    /*
     $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $
    
     osCommerce, Open Source E-Commerce Solutions
     http://www.oscommerce.com
    
     Copyright (c) 2007 osCommerce
    
     Released under the GNU General Public License
    */
    
     require("includes/application_top.php");
    
     if ($cart->count_contents() > 0) {
    include(DIR_WS_CLASSES . 'payment.php');
    $payment_modules = new payment;
     }
    
     require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);
    
     $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    <title><?php echo TITLE; ?></title>
    <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    </head>
    <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
    <script type="text/javascript">
    /* AJAX Stuff */
    function xmlhttpPostButton(strURL,divsend,divupdate,button) {
    var xmlHttpReq = false;
    var self = this;
    //document.getElementById(divupdate).style.cursor = 'wait';
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
    	self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
    	self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
    	if (self.xmlHttpReq.readyState == 4 || self.xmlHttpReq.readyState == "complete") {
    		updatepage(divupdate,self.xmlHttpReq.responseText);
    	//document.getElementById(divupdate).style.cursor = 'auto';
    	}
    }
    self.xmlHttpReq.send(getquerystring(divsend,button));
    }
    function xmlhttpPost(strURL,divsend,divupdate) {
    var xmlHttpReq = false;
    var self = this;
    //document.getElementById(divupdate).style.cursor = 'wait';
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
    	self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
    	self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
    	if (self.xmlHttpReq.readyState == 4 || self.xmlHttpReq.readyState == "complete") {
    		updatepage(divupdate,self.xmlHttpReq.responseText);
    	//document.getElementById(divupdate).style.cursor = 'auto';
    	}
    }
    self.xmlHttpReq.send(getquerystring(divsend,false));
    }
    
    function getquerystring(divsend,button) {
    // already prepared post?
    if (divsend.indexOf("=") > 0) {
    	return divsend;
    }
    var qstr = '';
    if (!document.forms[divsend]) {
    	alert("no '"+divsend+"' object");
    	return "";
    }
    for(i = 0; i < document.forms[divsend].elements.length; i++) {
    	if (qstr) {
    		qstr += "&";
    	}
    	// in case of submit buttons use only the clicked one
    	if (button && document.forms[divsend].elements[i].name == button.name) {
    		if (document.forms[divsend].elements[i].value == button.value) {
    			qstr += document.forms[divsend].elements[i].name + '=' + escape(document.forms[divsend].elements[i].value);
    		}
    	}
    	else if (document.forms[divsend].elements[i].type != "radio" || document.forms[divsend].elements[i].checked) {
    		qstr += document.forms[divsend].elements[i].name + '=' + escape(document.forms[divsend].elements[i].value);
    	}
    }
    //alert(divsend + "<->" + form.elements.length + qstr);
    return qstr;
    }
    function gotoXurl(url) {
    window.location = url;
    }
    function check_quant_discont(divupdate,str){
    var itemtotal = str.match(/Default_Price\[([^\]]*)]\(([^\)]*)\)\(([^\)]*)\)/);
    if (itemtotal && itemtotal[1]) {
    	if (document.getElementById('default_price['+itemtotal[1]+']')) {
    		document.getElementById('default_price['+itemtotal[1]+']').innerHTML = itemtotal[2];
    		//alert (document.getElementById('default_price['+itemtotal[2]+']').value);
    		if ( itemtotal[2] != itemtotal[3] ) {
    			document.getElementById('default_price['+itemtotal[1]+']').style.display = "block";
    		} else {
    			document.getElementById('default_price['+itemtotal[1]+']').style.display = "none";
    		}
    	}
    } else {
    	document.getElementById(divupdate).innerHTML = str;
    }	
    }
    function updatepage(divupdate,str){
    
    var subtotal = str.match(/Sub_Total\(([^\)]*)\)/);
    if (subtotal && subtotal[1]) {
    	document.getElementById('total_price').innerHTML = subtotal[1];
    }
    var goto = str.match(/gotoXurl\(\"([^\"]*)\"\)/);
    if (goto && goto[1]) {
    	gotoXurl(goto[1]);
    }
    var itemtotal = str.match(/Item_Price\[([^\]]*)]\(([^\)]*)\)/);
    if (itemtotal && itemtotal[1]) {
    	if (document.getElementById('item_price['+itemtotal[1]+']')) {
    		document.getElementById('item_price['+itemtotal[1]+']').innerHTML = itemtotal[2];
    
    	}
    } else {
    	document.getElementById(divupdate).innerHTML = str;
    }	
    var itemtotal = str.match(/Item_Total\[([^\]]*)]\(([^\)]*)\)/);
    if (itemtotal && itemtotal[1]) {
    	if (document.getElementById('item_total['+itemtotal[1]+']')) {
    		document.getElementById('item_total['+itemtotal[1]+']').innerHTML = itemtotal[2];
    	}
    } else {
    	document.getElementById(divupdate).innerHTML = str;
    }
    var itemtotal = str.match(/Default_Price\[([^\]]*)]\(([^\)]*)\)\(([^\)]*)\)/);
    if (itemtotal && itemtotal[1]) {
    	if (document.getElementById('default_price['+itemtotal[1]+']')) {
    		document.getElementById('default_price['+itemtotal[1]+']').innerHTML = itemtotal[2];
    		//alert (document.getElementById('default_price['+itemtotal[2]+']').value);
    		if ( itemtotal[2] != itemtotal[3] ) {
    			document.getElementById('default_price['+itemtotal[1]+']').style.display = "block";
    		} else {
    			document.getElementById('default_price['+itemtotal[1]+']').style.display = "none";
    		}
    	}
    } else {
    	document.getElementById(divupdate).innerHTML = str;
    }	
    
    }
    function updateforeign(divupdate,str){
    //alert("Updatei:"+divupdate+str);
    if (obj_caller) {
    	var obj_target = (obj_caller ? obj_caller.document.getElementById(divupdate) : null);
    	if (obj_target) {
    		obj_target.innerHTML = str;
    	}
    	else {
    		alert("Can't find object "+divupdate+"!");
    	}
    /*		var goto = str.match(/gotoXurl\(\"([^\"]*)\"\)/);
    	if (goto && goto[1]) {
    		obj_caller.location = goto[1];
    	}*/
    }
    }
    
    var delayer_count = 0;
    
    function delayer(strURL,divsend,divupdate) {
    if (--delayer_count == 0) {
    	xmlhttpPost(strURL,divsend,divupdate);
    }
    }
    
    var pullup_div;
    
    function pullup(divid,cnt){
    if (cnt <= 0) return;
    pullup_div = divid;
    document.getElementById(pullup_div).style.height=  cnt + 'px';;
    cnt-=3;
    setTimeout('pullup(pullup_div,'+cnt+');',1);
    }
    var last_spinner;
    function spinner_off()
    {
    if (last_spinner) {
    	divonoff(last_spinner,"none");
    }
    }
    function divonoff(whichLayer,dvalue)
    {
    if (document.getElementById) {
    	// this is the way the standards work
    	if (document.getElementById(whichLayer)) {
    		var style2 = document.getElementById(whichLayer).style;
    		style2.display = dvalue;
    	}
    }
    else if (document.all) {
    	// this is the way old msie versions work
    	if (document.all[whichLayer]){
    		var style2 = document.all[whichLayer].style;
    		style2.display = dvalue;
    	}
    }
    else if (document.layers) {
    	// this is the way nn4 works
    	if (document.layers[whichLayer]) {
    		var style2 = document.layers[whichLayer].style;
    		style2.display = dvalue;
    	}
    }
    }
    function spinner_on(whichLayer)
    {
    last_spinner = whichLayer;
    divonoff(whichLayer,"block");
    }
    
    function xmlhttpPost(strURL,divsend,divupdate) {
    
    var xmlHttpReq = false;
    var self = this;
    //document.getElementById(divupdate).style.cursor = 'wait';
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
    	self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
    	self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
    	if (self.xmlHttpReq.readyState == 4 || self.xmlHttpReq.readyState == "complete") {
    		updatepage(divupdate,self.xmlHttpReq.responseText);
    		spinner_off();
    	//document.getElementById(divupdate).style.cursor = 'auto';
    	}
    }
    self.xmlHttpReq.send(getquerystring(divsend,false));
    //alert('deleted');
    }
    /* END AJAX stuff */
    </script>
    <!-- header //-->
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    
    <!-- body //-->
    <table border="0" width="100%" cellspacing="3" cellpadding="3">
     <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
    <!-- left_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
    <!-- left_navigation_eof //-->
    </table></td>
    <!-- body_text //-->
    <td width="100%" valign="top">
    <h1 class="pageHeading">
     <?php echo tep_image_2ma_template(bts_select(images, 'table_background_cart.png'), HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>
     <?php $firstname = tep_db_prepare_input($_POST['firstname']);
    		if (tep_session_is_registered('customer_id')) { echo tep_customer_carrello();?> - <?php } echo HEADING_TITLE; ?>
    </h1>
    <?php
     if ($cart->count_contents() > 0) { ?>
    <?php 
    $info_box_contents = array();
    $info_box_contents[0][] = array('params' => 'class="Venticinque"',
    								'text' => TABLE_HEADING_REMOVE);
    $info_box_contents[0][] = array('params' => 'class="Venticinque"',
    								'text' => TABLE_HEADING_PRODUCTS);
    $info_box_contents[0][] = array('params' => 'class="Venticinque"',
    								'text' => TABLE_HEADING_QUANTITY);
    $info_box_contents[0][] = array('params' => 'class="Venticinque"',
    								'text' => TABLE_HEADING_TOTAL);
    $info_box_contents[0][] = array('params' => 'class="Table_templateClear"',
    								'text' => '<br />');
    
    $any_out_of_stock = 0;
    $products = $cart->get_products();
    
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    // Push all attributes information in an array
      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    	while (list($option, $value) = each($products[$i]['attributes'])) {
    	  echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
    	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
    								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
    								  where pa.products_id = '" . (int)$products[$i]['id'] . "'
    								   and pa.options_id = '" . (int)$option . "'
    								   and pa.options_id = popt.products_options_id
    								   and pa.options_values_id = '" . (int)$value . "'
    								   and pa.options_values_id = poval.products_options_values_id
    								   and popt.language_id = '" . (int)$languages_id . "'
    								   and poval.language_id = '" . (int)$languages_id . "'");
    	  $attributes_values = tep_db_fetch_array($attributes);
    
    	  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
    	  $products[$i][$option]['options_values_id'] = $value;
    	  $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
    	  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
    	  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
    	}
      }
    }
    
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    
    $cur_row = sizeof($info_box_contents) - 1;
    
      $products_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' 
    				  . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br />' 
    				  . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><span class="b">' 
    				  . $products[$i]['name'] . '</span></a>';
      if (STOCK_CHECK == 'true') {
    	$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
    	if (tep_not_null($stock_check)) {
    	  $any_out_of_stock = 1;
    	  $products_name .= $stock_check;
    	}
      }
      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    	reset($products[$i]['attributes']);
    	while (list($option, $value) = each($products[$i]['attributes'])) {
    	  $products_name .= ' - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'];
    	}
      } 
    
       $info_box_contents[$cur_row][] = array('params' => '',
    
    	 'text' => '<form id="cart_quantity['. $i .']" action="'. tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product') .'" method="post">
    <div id="div'. $i .'" style="height: 100px; overflow:hidden;">
    			<table width="100%">
    			   <tr>
    				 <td style="width: 385px; text-align: left; " >
    				   <table>
    					 <tr>
    					   <td>
    					   '. $products_name . '</td>
    					 </tr>
    				   </table>
    
    				   </td>
    				 <td style="width: 50px; text-align:right; padding-right: 10px;">
    				 '
      //TotalB2B start
    				   . '<div id="item_price[' . $products[$i]['id'] . ']" style="font-weight: bold; color: #000000;"><span class="b">' . $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . '</span></div>'.
      //TotalB2B end 
      '</td>
    				 <td style="width: 80px; text-align:center; padding-right: 15px;">
    				   <div style="display:inline;">
    						<img src="images/indicator.gif" id="spinner'. $i .'" 
    						style="display:none; vertical-align:bottom; float:left;"/>
    					<input type="text" name="cart_quantity" value="'. $products[$i]['quantity'] .'" size="3" onKeyUp="spinner_on("spinner'. $i .'");delayer_count++;setTimeout("delayer(\'ajax_chart.php\',\'cart_quantity['. $i .']\',\'div'. $i .'\');",800);" /><input type="hidden" name="products_id['. $i .']" value="'. $products[$i]['id'] .'"/>
    					</div>
    				 </td>
    				 <td style="width:50px; text-align:center; padding-right: 10px;">		
    					<a href="ajax_chart.php?pid='. $products[$i]['id'] .'"
    						onclick="
    						if (confirm("You are going to delete\n High Capacity Solar Charger Battery for PC Laptop + Mobile Phone\nfrom your shoping cart.  \n\n Are you sure that you want to perform this action? ")) {
    								pullup("div'. $i .'","100");
    								setTimeout("xmlhttpPost(\'ajax_chart.php\',\'hidden_product_id='. $products[$i]['id'] .'&action=delete\',\'div'. $i .'\');",1000);
    						} 
    						return false;
    
    					">
    					<img src="images/bin1.gif" alt="Delete this item" title="Delete this item"></a>
    					</td>
    				 <td style="width: 100px; text-align:right;">
    						<div id="item_total['. $products[$i]['id'] .']" style="font-weight: bold; color: #000000; ">
    							<b>'. $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b>
    						</div>	
    					</td>
    				</tr>
    
    			</table><input type="hidden" name="hidden_product_id" value="'. $products[$i]['id'] .'"/>
    					<input type="hidden" name="post_i" value="'. $i .'"/>
    					<input type="hidden" name="hidden_product_final" value="'. $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'"/><input type="hidden" name="hidden_price" value="'. $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'"/></div>
    </form>
    <br />');
    } 
    
    new productListingBox($info_box_contents);
    
    //for end
    // frase rottura stock
    if ($any_out_of_stock == 1) {
      if (STOCK_ALLOW_CHECKOUT == 'true') {
    ?>
    
    	<br /><br /><span class="ColorRed"><br /><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></span>
    <?php
      } else {
    ?>
    	<br /><br /><span class="ColorRed"><br /><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></span><br /><br />
    <?php
      }
    }
    // fine frase rottura stock
    
    // minimum order total
    if ($cart->show_total() < MIN_ORDER_AMOUNT) {
    ?>
      <br /><br /><span class="ColorRed"><?php echo sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)); ?></span><br /><br />
    <?php
    }
    ?>
    
    <div class="Clear"><br /></div><br />
    <br />
    <div id="subtotal_field">
    <p class="b" align="right"><span class="testo_grigio"><?php echo SUB_TITLE_SUB_TOTAL; ?></span> <span class="prezzo_carrello"><?php 
    	//TotalB2B start
    	  global $customer_id;
    	  $query_price_to_guest = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'ALLOW_GUEST_TO_SEE_PRICES'");
    	  $query_price_to_guest_result = tep_db_fetch_array($query_price_to_guest);
    	  if ((($query_price_to_guest_result['configuration_value']=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {
    		 echo '<div id="total_price">' . $currencies->format($cart->show_total()) . '</div>'; 
    	  } else {
    		 echo PRICES_LOGGED_IN_TEXT;
    	  }
    	  //TotalB2B end
    	?></span></p></div><?php //;
    ?>
    <br class="Clear" />
    <br />
    <div class="CinquantaL">
    	  <?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue_shopping.png', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>
    </div><div class="CinquantaR">
    <?php
    // minimum order total
    if ($cart->show_total() < MIN_ORDER_AMOUNT) {
    
    echo tep_image_button('button_checkout.png', IMAGE_BUTTON_CHECKOUT, 'disabled="disabled"'); 
    
    } else {
    
    echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.png', IMAGE_BUTTON_CHECKOUT) . '</a>'; 
    
    }
    ?>	  
    </div>
    <div class="CinquantaL">
    <a href="<?php echo tep_href_link(basename($PHP_SELF), 'action=clear_cart', 'NONSSL');?>" onclick="var x=confirm('<?php echo IMAGE_BUTTON_REMOVE_PRODUCT; ?>'); if (x==false) { return false; }"><?php echo tep_image_submit('button_clear_cart.gif', IMAGE_BUTTON_CLEAR_CART)?>
    </a>  
    <noscript><?php echo tep_image_submit('button_update_cart.png', IMAGE_BUTTON_UPDATE_CART, 'id="update_cart_button_img"'); ?></noscript>
    </div>
    <?php
     $initialize_checkout_methods = $payment_modules->checkout_initialization_method();
    
    if (!empty($initialize_checkout_methods) && ($cart->show_total() > MIN_ORDER_AMOUNT)) {
      echo TEXT_ALTERNATIVE_CHECKOUT_METHODS . '<br />';
      reset($initialize_checkout_methods);
      while (list(, $value) = each($initialize_checkout_methods)) {
      echo $value . '<br />';
      }
    }
     } else {
    ?>
    	  <?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?><br />
    	  <?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.png', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>
    <?php
     }
    ?>
    </td>
    <!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
    <!-- right_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
    <!-- right_navigation_eof //-->
    </table></td>
     </tr>
    </table>
    <!-- body_eof //-->
    
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    <br>
    </body>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

     

    and this is code the ajax_chart.php:

     

    <?php
    
    require_once("includes/application_top.php");
    // make sure we set the right character set
    //header('Content-type: text/html; charset=ISO-8859-1');
    
    // Check to see if item should be removed
    if(isset($_POST['hidden_product_id']) && isset($_POST['action'])) {
    // customer wants to remove the product from their shopping cart
    $cart->remove($_POST['hidden_product_id']);
    }
    
    //Check to see if a ChangeQty was sent.
    if(isset($_POST['cart_quantity'])) {
    
    // customer wants to update the product quantity in their shopping cart
    	  $prid = $_POST['products_id'];
    	  $attributes = explode('{', substr($prid, strpos($prid, '{')+1));
    
    	  for ($i=0, $n=sizeof($attributes); $i<$n; $i++) {
    		$pair = explode('}', $attributes[$i]);
    
    		if (is_numeric($pair[0]) && is_numeric($pair[1])) {
    		  $_POST['id'][$pair[0]] .= $pair[1];
    		} 
    	  }
    
    //$cart->add_cart($_POST['products_id'], $_POST['cart_quantity'], $_POST['id'], false);
    $cart->add_cart($_POST['hidden_product_id'], $_POST['cart_quantity'], $_POST['id'], false);
    
      $info_box_contents = array();
    $info_box_contents[0][] = array('params' => '',
    								'text' => '');
    $info_box_contents[0][] = array('params' => '',
    								'text' => '');
    $info_box_contents[0][] = array('params' => '',
    								'text' => '');
    $info_box_contents[0][] = array('params' => '',
    								'text' => '');
    $info_box_contents[0][] = array('params' => '',
    								'text' => '');
    
    $any_out_of_stock = 0;
    $products = $cart->get_products();
    
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    // Push all attributes information in an array
      if (isset($products[$_POST['post_i']]['attributes']) && is_array($products[$_POST['post_i']]['attributes'])) {
    	while (list($option, $value) = each($products[$_POST['post_i']]['attributes'])) {
    	  echo tep_draw_hidden_field('id[' . $products[$_POST['post_i']]['id'] . '][' . $option . ']', $value);
    	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
    								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
    								  where pa.products_id = '" . (int)$products[$_POST['post_i']]['id'] . "'
    								   and pa.options_id = '" . (int)$option . "'
    								   and pa.options_id = popt.products_options_id
    								   and pa.options_values_id = '" . (int)$value . "'
    								   and pa.options_values_id = poval.products_options_values_id
    								   and popt.language_id = '" . (int)$languages_id . "'
    								   and poval.language_id = '" . (int)$languages_id . "'");
    	  $attributes_values = tep_db_fetch_array($attributes);
    
    	  $products[$_POST['post_i']][$option]['products_options_name'] = $attributes_values['products_options_name'];
    	  $products[$_POST['post_i']][$option]['options_values_id'] = $value;
    	  $products[$_POST['post_i']][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
    	  $products[$_POST['post_i']][$option]['options_values_price'] = $attributes_values['options_values_price'];
    	  $products[$_POST['post_i']][$option]['price_prefix'] = $attributes_values['price_prefix'];
    	}
      }
    }
    
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    
    $cur_row = sizeof($info_box_contents) - 1;
    
      /*$products_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['hidden_product_id']) . '">' 
    				  . tep_image(DIR_WS_IMAGES . $_POST['products_image'], $_POST['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br />' 
    				  . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['hidden_product_id']) . '"><span class="b">' 
    				  . $_POST['products_name'] . '</span></a>';*/
      $products_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$_POST['post_i']]['id']) . '">' 
    				  . tep_image(DIR_WS_IMAGES . $products[$_POST['post_i']]['image'], $products[$_POST['post_i']]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br />' 
    				  . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$_POST['post_i']]['id']) . '"><span class="b">' 
    				  . $products[$_POST['post_i']]['name'] . '</span></a>';
    
      if (STOCK_CHECK == 'true') {
    	$stock_check = tep_check_stock($products[$_POST['post_i']]['id'], $products[$_POST['post_i']]['quantity']);
    	if (tep_not_null($stock_check)) {
    	  $any_out_of_stock = 1;
    	  $products_name .= $stock_check;
    	}
      }
      if (isset($products[$_POST['post_i']]['attributes']) && is_array($products[$_POST['post_i']]['attributes'])) {
    	reset($products[$_POST['post_i']]['attributes']);
    	while (list($option, $value) = each($products[$_POST['post_i']]['attributes'])) {
    	  $products_name .= ' - ' . $products[$_POST['post_i']][$option]['products_options_name'] . ' ' . $products[$_POST['post_i']][$option]['products_options_values_name'];
    	}
      } 
    
       $info_box_contents[$cur_row][] = array('params' => '',
    
    	 'text' => '<form id="cart_quantity['. $_POST['post_i'] .']" action="'. tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product') .'" method="post">
    <div id="div'. $_POST['post_i'] .'" style="height: 100px;">
    			<table width="100%">
    			   <tr>
    				 <td style="width: 385px; text-align: left; " >
    				   <table>
    					 <tr>
    					   <td>
    					   '. $products_name . '</td>
    					 </tr>
    				   </table>
    
    				   </td>
    				 <td style="width: 50px; text-align:right; padding-right: 10px;">
    				 '
      //TotalB2B start
    				   . '<div id="item_price[' . $products[$_POST['post_i']]['id'] . ']" style="font-weight: bold; color: #000000;"><span class="b">' . $currencies->display_price_nodiscount($products[$_POST['post_i']]['final_price'], tep_get_tax_rate($products[$_POST['post_i']]['tax_class_id'])) . '</span></div>'.
      //TotalB2B end 
      '</td>
    				 <td style="width: 80px; text-align:center; padding-right: 15px;">
    				   <div style="display:inline;">
    						<img src="images/indicator.gif" id="spinner'. $_POST['post_i'] .'" 
    						style="display:none; vertical-align:bottom; float:left;"/>
    					<input type="text" name="cart_quantity" value="'. $products[$_POST['post_i']]['quantity'] .'" size="3" onKeyUp="spinner_on("spinner'. $_POST['post_i'] .'");delayer_count++;setTimeout("delayer(\'ajax_chart.php\',\'cart_quantity['. $_POST['post_i'] .']\',\'div'. $_POST['post_i'] .'\');",800);" /><input type="hidden" name="products_id['. $_POST['post_i'] .']" value="'. $products[$_POST['post_i']]['id'] .'"/>
    					</div>
    				 </td>
    				 <td style="width:50px; text-align:center; padding-right: 10px;">		
    					<a href="ajax_chart.php?pid='. $products[$_POST['post_i']]['id'] .'"
    						onclick="
    						if (confirm("You are going to delete\n High Capacity Solar Charger Battery for PC Laptop + Mobile Phone\nfrom your shoping cart.  \n\n Are you sure that you want to perform this action? ")) {
    								pullup("div'. $_POST['post_i'] .'","100");
    								setTimeout("xmlhttpPost(\'ajax_chart.php\',\'hidden_product_id='. $products[$_POST['post_i']]['id'] .'&action=delete\',\'div'. $_POST['post_i'] .'\');",1000);
    						} 
    						return false;
    
    					">
    					<img src="images/bin1.gif" alt="Delete this item" title="Delete this item"></a>
    					</td>
    				 <td style="width: 100px; text-align:right;">
    						<div id="item_total['. $products[$_POST['post_i']]['id'] .']" style="font-weight: bold; color: #000000; ">
    							<b>'. $currencies->display_price_nodiscount($products[$_POST['post_i']]['final_price'], tep_get_tax_rate($products[$_POST['post_i']]['tax_class_id']), $products[$_POST['post_i']]['quantity']) .'</b>
    						</div>	
    					</td>
    				</tr>
    
    			</table>
    			<input type="hidden" name="hidden_product_id" value="'. $products[$_POST['post_i']]['id'] .'"/>
    			<input type="hidden" name="post_i" value="'. $_POST['post_i'] .'"/>
    			<input type="hidden" name="hidden_product_final" value="'. $currencies->display_price_nodiscount($products[$_POST['post_i']]['final_price'], tep_get_tax_rate($products[$_POST['post_i']]['tax_class_id']), $products[$_POST['post_i']]['quantity']) .'"/>
    			<input type="hidden" name="hidden_price" value="'. $currencies->display_price_nodiscount($products[$_POST['post_i']]['final_price'], tep_get_tax_rate($products[$_POST['post_i']]['tax_class_id']), $products[$_POST['post_i']]['quantity']) .'"/></div>
    </form>
    <br />');
    } 
    
    new productListingBox($info_box_contents);
    
    
    } 
    
    ?>

    The method works well to remove the product, however, to the change of the quantity It always works but the total price of a product change only the first change of quantity! If you update the page then you see that the total price is changed. Another error and the Sub-total that does not update. I have posted here the things so we do a Ajax shopping cart viable and stable.

    I hope that someone will work with me to finish this project.

    bye

    Antonello

  2. Hello everyone I have installed oscthumb and I am very well with this great contribution, but I will validate the site according to the standard w3c and not This contribution will allow me because it adds the character & images, I have tried to replace it with & but doing so you do n't see the images...

    Someone has any idea?? Maybe an integration with Ultimate SEO URLs?

    Thanks to all :rolleyes:

    Antonello

    OK, I have resolved by putting nooffsitelink_enabled on false. Now I have noticed that the images in PNG not maintain the transparency on versions lower than IE7, while I have seen this contribution that can do: http://addons.oscommerce.com/info/2226! Could you not integrate?

  3. Hello everyone I have installed oscthumb and I am very well with this great contribution, but I will validate the site according to the standard w3c and not This contribution will allow me because it adds the character & images, I have tried to replace it with & but doing so you do n't see the images...

    Someone has any idea?? Maybe an integration with Ultimate SEO URLs?

    Thanks to all :rolleyes:

    Antonello

  4. Hello,

    I want to put in my osCommerce NETeller as type of payment, but turning I have not found any contribution!

    I ca n't created because I understand little of PHP and I wanted to know if anyone there is successful or if it succeeds I would a great favour.

    Thank you ;)

    Antonello

  5. Looks like more than one problem. The missing constants are likely a problem with catalog/includes/languages/english/checkout_shipping.php. Check that the file exists and that it is not corrupted. Also check that this line exists [near line 178] in catalog/checkout_shipping.php:
      require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);

    The mess at the bottom should probably be in the right column. That's likely an error in editing catalog/checkout_shipping.php that is messing up the HTML. That error could be in a number of different places, so you'll need to go through your edits and check each one carefully. If you have no other edits to that file, you could use the one from the MVS distribution instead.

     

    Regards

    Jim

    Thanks Jim ;) ;)

  6. Hello everyone.

    I introduce myself, I'm Antonello and I have just writing the Forum.

    Excuse me if my English is not good, but I am trying to improve it. :blush:

    However we return to us: :thumbsup:

    I have a problem with MVS 1.1, that I have installed everything to perfection, but in the procedure for checkout in checkout_shipping.php seems to me so:

    Immagine.JPG

    Anybody knows how can I do to remedy?

    Thanks to all

    Antonello

×
×
  • Create New...