Pagina 1 di 2

problema quantita prodotti nel carrello

Inviato: 14/07/2010, 23:50
da deltabiri
Ho appena notato un problema con i prodotti nel carrello.
Se metto nel carrello es. una maglia con opzioni (BIANCA e XL) e poi decido di prendere anche la stessa nella variante (NERO - XL) quando vado nel carrello il secondo oggetto non segna ne opzione colore ne taglia, e se esco e rientro dal carrello il prodotto sparisce.... cosa puo' essere?
non so da quando mi porto dietro quest'errore, solo oggi una cliente me lo ha comunicato :oops:

Re: problema quantita prodotti nel carrello

Inviato: 15/07/2010, 9:11
da deltabiri
ho trovato l'errore, credo che derivi dalla contribution che limita i prodotti nel carrello.
in shopping cart porto questo pezzo

Codice: Seleziona tutto

//MAXIMUM quantity code
if(MAXIMUM_ORDERS == 'true'){
	$max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
	while ($max_order = tep_db_fetch_array($max_order_query))  {
		$products[$i]['max_quant']=$max_order['max_quant']; // set the cart item max var
		if (!empty($products[$i]['max_quant'])) {//add check account for if max_quant is null or '', if it is you can skip all this stuff can it's umlimited
	    // okay if this product already is in basket irregardless of it's attributes selected... keep the old one
		for ($ic = 0; $ic < $i;$ic++) {
		   if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
		   $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<br />'; // notify them they can not do that
	       $cart_skip_prod = true;
		   $cart->remove($products[$i]['id']); // remove this new item from the cart session
		   $cart_skip_prod = true; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
		   }
		   else {
		   //$cart_notice .= ' - okay no match ';
		   }
		   $cart_notice .= '<br />';
		}

		// okay now for products that have no attributes or have identical attributes
		if ($products[$i]['quantity'] > $max_order['max_quant'] ) { //add check account for if max_quant is null or '', if so let it go through.
			$products[$i]['quantity']=$products[$i]['max_quant'];
			$cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']); // update the qty
			$cart_notice .= sprintf(MAXIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["max_quant"]); // notify them they can not do that
		}
		}
	}
}

if ($cart_skip_prod) { // still need to skip displaying the item still stuck in $products array even though we removed it from $cart
   break;
   }
//End MAXIMUM quantity code
sapete come posso risolvere?

Re: problema quantita prodotti nel carrello

Inviato: 17/07/2010, 8:16
da deltabiri
al momento ho cambiato da if(MAXIMUM_ORDERS == 'true') in if(MAXIMUM_ORDERS == 'false') e sembra andare tutto ok, ma la contribution non funziona.
Nessuno sa dove sia l'errore?

Re: problema quantita prodotti nel carrello

Inviato: 20/07/2010, 15:21
da deltabiri
nessuno sa come risolvere? ho ancora il problema :?

Re: problema quantita prodotti nel carrello

Inviato: 21/07/2010, 16:18
da deltabiri
ho provato ha cambiare questi 2 true mettendo false

Codice: Seleziona tutto

// okay if this product already is in basket irregardless of it's attributes selected... keep the old one
		for ($ic = 0; $ic < $i;$ic++) {
		   if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
		   $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<br />'; // notify them they can not do that
	       $cart_skip_prod = false;
		   $cart->remove($products[$i]['id']); // remove this new item from the cart session
		   $cart_skip_prod = false; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
		   }
		   else {
in questo modo segna anche la seconda scelta di colore, ma se faccio aggiorna o proseguo con l'ordine il secondo prodotto sparisce :roll:

Re: problema quantita prodotti nel carrello

Inviato: 22/07/2010, 16:22
da deltabiri
sto continuando ha fare tentativi a casaccio :mrgreen:

Codice: Seleziona tutto

                                  $cart_skip_prod = true;
		  // $cart->remove($products[$i]['id']); // remove this new item from the cart session
		   $cart_skip_prod = false; // 
praticamente quello che cancella il prodotto e' la seconda linea, al momento gli ho messo i due // per disattivare il comando, pero' cosi facendo non cancella il prodotto se uno acquista una quantita maggiore di quella disponibile.
Se qualcuno ne sa qualcosa.....

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 19:16
da xnetus
Ciao, eccomi qui...

Premetto che sto valutando solo i codici che hai inserito... cmq questa condizione potrebbe essere la causa:

Codice: Seleziona tutto

if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 20:41
da deltabiri
che dovrei fare? cancello la riga?o va modificato il codice?

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 21:17
da xnetus
Puoi postare il codice di shopping_cart oppure me lo invii in privato, come preferisci...

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 21:18
da deltabiri
ecco

Codice: Seleziona tutto

<?php
/*
  $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl 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);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<link rel="shortcut icon" href="http://www.tentazionishop.it/sesso.ico" />
<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" />
<script type="text/javascript">
<!--
	function advisecustomer() 
{
  warn_string = <?php echo '"<b><span class=\"errorText\">'.TEXT_UPDATE_WARNING.'</span></b>"'; ?>;

  if (document.getElementById && document.getElementById("update_warning")) {
    document.getElementById("update_warning").innerHTML = warn_string;
  } else if (document.all && document.all["update_warning"]) {
    document.all["update_warning"].innerHTML = warn_string;
  }
}
//-->
</script>
 <!-- SCIPT BOX CATEGORIE //-->
<script type="text/javascript" src="jquery.min.js"></script>

<script type="text/javascript" src="ddaccordion.js">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>


<script type="text/javascript">


ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' alt=''/>", "<img src='images/minus.gif' class='statusicon' alt='' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})


</script>
<!-- FINE SCIPT BOX CATEGORIE //-->
</head>
<body>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<script language="JavaScript1.2">
	function UpdateCartQuantity()
	{
	  document.cart_quantity.submit();
	}
function changeQuantity(i,qty)
	{
	 	document.cart_quantity['qty_'+i].value = Number(document.cart_quantity['qty_'+i].value)+Number(qty);
		UpdateCartQuantity();
	}

function confSubmit(form) {
if (confirm("Sei sicuro di voler eliminare questo prodotto?")) {
form.submit();
}

else {
alert("You decided to not delete the item.");
}
}
 
 function check(checkboxid) {  
 document.getElementById(checkboxid).checked = "checked";  
 
 }  
</script>

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top" class="bar_left"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top" class="centercolor"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"> </td>
          </tr>
          <tr>
            <td class="pageHeading"><table border="0" cellspacing="5" cellpadding="0">
              <tr>
                <td><img src="images/grafica/cart.gif" width="40" height="32" alt="Carrello" /></td>
                <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  if ($cart->count_contents() > 0) {
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td><?php
    $info_box_contents = array();
    $info_box_contents[0][] = array('align' => 'center',
                                    'params' => 'class="productListing-heading"',
                                    'text' => TABLE_HEADING_REMOVE);

    $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
                                    'text' => TABLE_HEADING_PRODUCTS);

    $info_box_contents[0][] = array('align' => 'center',
                                    'params' => 'class="productListing-heading"',
                                    'text' => TABLE_HEADING_QUANTITY);

    $info_box_contents[0][] = array('align' => 'right',
                                    'params' => 'class="productListing-heading"',
                                    'text' => TABLE_HEADING_TOTAL);

    $any_out_of_stock = 0;
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	//MAXIMUM quantity code
if(MAXIMUM_ORDERS == 'true'){
	$max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
	while ($max_order = tep_db_fetch_array($max_order_query))  {
		$products[$i]['max_quant']=$max_order['max_quant']; // set the cart item max var
		if (!empty($products[$i]['max_quant'])) {//add check account for if max_quant is null or '', if it is you can skip all this stuff can it's umlimited
	    // okay if this product already is in basket irregardless of it's attributes selected... keep the old one
		for ($ic = 0; $ic < $i;$ic++) {
		   if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
		   $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<br />'; // notify them they can not do that
	       $cart_skip_prod = true;
		   //$cart->remove($products[$i]['id']); // remove this new item from the cart session
		   $cart_skip_prod = false; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
		   }
		   else {
		   //$cart_notice .= ' - okay no match ';
		   }
		   $cart_notice .= '<br />';
		}

		
		}
	}
}

if ($cart_skip_prod) { // still need to skip displaying the item still stuck in $products array even though we removed it from $cart
   break;
   }
//End MAXIMUM quantity code
// 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 = '" . $products[$i]['id'] . "'
                                       and pa.options_id = '" . $option . "'
                                       and pa.options_id = popt.products_options_id
                                       and pa.options_values_id = '" . $value . "'
                                       and pa.options_values_id = poval.products_options_values_id
                                       and popt.language_id = '" . $languages_id . "'
                                       and poval.language_id = '" . $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++) {
      if (($i/2) == floor($i/2)) {
        $info_box_contents[] = array('params' => 'class="productListing-even"');
      } else {
        $info_box_contents[] = array('params' => 'class="productListing-odd"');
      }

      $cur_row = sizeof($info_box_contents) - 1;

      $info_box_contents[$cur_row][] = array('align' => 'center',
                                             'params' => 'class="productListing-data" valign="top"',
                                              'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], '', 'onClick="confSubmit(this.form);" id="checkbox['.$products[$i]['id'].']"'));
 

      $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                       '  <tr>' .
                       '    <td class="productListing-data" align="center"><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></td>' .
                       '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></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 .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
        }
      }

      $products_name .= '    </td>' .
                        '  </tr>' .
                        '</table>';

      $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
                                             'text' => $products_name);

     if ($products[$i]['quantity']==1) {
$minus_field = tep_image(DIR_WS_IMAGES . 'minusBtn.gif', IMAGE_BUTTON_REMOVE_PRODUCT, '', '',  'onclick="javascript:check(\'checkbox['.$products[$i]['id'].']\'); javascript:document.cart_quantity.submit();"');
} else {
$minus_field = '<a href="javascript:changeQuantity("'.$products[$i]['id'].'",-1)">'.tep_image(DIR_WS_IMAGES .'minusBtn.gif').'</a>';
}
      $info_box_contents[$cur_row][] = array('align' => 'center',
                                             'params' => 'class="productListing-data" nowrap valign="top"',
                                             'text' => $minus_field . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" onChange="UpdateCartQuantity();" id="qty_'.$products[$i]['id'].'"').'<a href="javascript:changeQuantity("'.$products[$i]['id'].'", 1)">'.tep_image(DIR_WS_IMAGES .'plusBtn.gif').'</a>'. tep_draw_hidden_field('products_id[]', $products[$i]['id']));     
      //TotalB2B start
      $info_box_contents[$cur_row][] = array('align' => 'right',
                                             'params' => 'class="productListing-data" valign="top"',
                                             'text' => '<b>' . $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
      //TotalB2B end

    }

    new productListingBox($info_box_contents);
?></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td class="main"><table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td><table width="100%" cellpadding="1" cellspacing="0" border="0">
                <tr>
                  
                  <td align="center" class="main" valign="top" nowrap><img alt="Costo spedizioni" border="0" width="500" height="50" src="http://www.tentazionishop.it/images/grafica/spedizioni_shipping.gif" /></a><br />
				  Acquistando 80,00€ di merce, la spedizione sarà GRATUITA !!</td>
                </tr>
            </table></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table>
        <table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td><table width="100%" cellpadding="1" cellspacing="0" border="0">
              <tr>
                <td class="main"><script type="text/javascript">
<!--
if (!(document.getElementById) && !(document.all)) {
document.write("<b><span class=\"errorText\"><?php echo TEXT_UPDATE_WARNING; ?></span>");
}
else {
document.write("<span id=\"update_warning\" class=\"errorText\"> </span>");
}
//-->
            </script>
                    <noscript>
                    <b><span class="errorText"><?php echo TEXT_UPDATE_WARNING; ?></span></b>
                    </noscript>
                </td>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right" class="main" valign="top" nowrap><b> <?php echo SUB_TITLE_SUB_TOTAL; ?>
                      <?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 $currencies->format($cart->show_total()); 
          } else {
             echo PRICES_LOGGED_IN_TEXT;
          }
          //TotalB2B end

		?>
                </b></td>
              </tr>
            </table></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table></td>
      <tr>
<!-- start Customer Update Cart Reminder 2.0 -->
<td class="main"> 
</td>
<!-- end Customer Update Cart Reminder 2.0 -->
<?php
    if ($any_out_of_stock == 1) {
      if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
      <tr>
        <td class="stockWarning" align="center"><table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="1" height="1" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        
      </tr>
<?php
      } else {
?>
      <tr>
        <td class="stockWarning" align="center"><table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="1" height="1"  alt="" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        
      </tr>
<?php
      }
    }
	//MAXIMUM quantity code
    if ($cart_notice) {
?>
      <tr>
        <td class="stockWarning" align="center"><br /><b><?php echo $cart_notice; ?></b></td>
      </tr>
<?php
      }
// End MAXIMUM quantity code
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
<?php
    $back = sizeof($navigation->path)-2;
    if (isset($navigation->path[$back])) {
?>
                <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
    }
?>
                <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  } else {
?>
      <tr>
        <td align="center" class="main"> </td>
      </tr>
      <tr>
        <td align="center" class="main"><table width="600"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><img src="images/grafica/ang_bianc_alt_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_alt"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_alt_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
          <tr>
            <td class="sf_bar_lat_mar_sx"> </td>
            <td class="main">
              <div align="center"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></div></td>
            <td class="sf_lat_bar_mar_dx"> </td>
          </tr>
          <tr>
            <td><img src="images/grafica/ang_bianc_bs_sx.gif" width="14" height="18" alt="" /></td>
            <td width="100%" class="sf_bar_bas"><img src="images/grafica/null.gif" width="1" height="1" alt="" /></td>
            <td><img src="images/grafica/ang_bianc_bs_dx.gif" width="14" height="18" alt="" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('bottone_continua.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table>
    </form></td>
<!-- body_text_eof //-->
  </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'); ?>

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 21:29
da xnetus
Ho abbozzato una soluzione, ma dovrebbe funzionare:

Codice: Seleziona tutto

             if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
				$first_control = ''; 
				if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
					while (list($option, $value) = each($products[$i]['attributes'])) {
						$first_control .= '{' . $option . ',' . $value . '}';
					}					
				}
				$last_control = '';				
				if (isset($products[$ic]['attributes']) && is_array($products[$ic]['attributes'])) {
					while (list($option, $value) = each($products[$ic]['attributes'])) {
						$last_control .= '{' . $option . ',' . $value . '}';
					}					
				}				
             $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<br />';
              $cart_skip_prod = true;
            if ( $first_control == $last_control) {
				$cart->remove($products[$i]['id']); // remove this new item from the cart session
			} 
             $cart_skip_prod = false; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
             }
             else {
             //$cart_notice .= ' - okay no match ';
             }
             $cart_notice .= '<br />';
Lo sostituisci al contenuto del ciclo for.

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 22:32
da deltabiri
provato, non stabilisce la quantita massima e quando metto il secondo prodotto nel carrello non registra taglia e colore ma appare un trattino -
unica differenza e che aggiornando la pagina non cancella il secondo prodotto

Re: problema quantita prodotti nel carrello

Inviato: 27/07/2010, 23:51
da xnetus
Come ti dicevo dovrei fare delle prove... purtroppo manca il tempo...

Re: problema quantita prodotti nel carrello

Inviato: 29/07/2010, 9:27
da deltabiri
Credo di aver risolto

Codice: Seleziona tutto

//MAXIMUM quantity code
if(MAXIMUM_ORDERS == 'true'){
	$max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
	while ($max_order = tep_db_fetch_array($max_order_query))  {
		$products[$i]['max_quant']=$max_order['max_quant']; // set the cart item max var
		if (!empty($products[$i]['max_quant'])) {//add check account for if max_quant is null or '', if it is you can skip all this stuff can it's umlimited
	    // okay if this product already is in basket irregardless of it's attributes selected... keep the old one
		for ($ic = 0; $ic < $i;$ic++) {
		   if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
		   $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<BR>'; // notify them they can not do that
	       $cart_skip_prod = true;
		   $cart->remove($products[$i]['id']); // remove this new item from the cart session
		   $cart_skip_prod = false; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
		   }
		   else {
		   //$cart_notice .= ' - okay no match ';
		   }
		   $cart_notice .= '<BR>';
		}

		// okay now for products that have no attributes or have identical attributes
		if ($products[$i]['quantity'] > $max_order['max_quant'] ) { //add check account for if max_quant is null or '', if so let it go through.
			$products[$i]['quantity']=$products[$i]['max_quant'];
			$cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']); // update the qty
			$cart_notice .= sprintf(MAXIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["max_quant"]); // notify them they can not do that
		}
		}
	}
}

if ($cart_skip_prod) { // still need to skip displaying the item still stuck in $products array even though we removed it from $cart
   break;
   }
//End MAXIMUM quantity code
se qualcuno vuole fare delle prove di acquisto e' gradito.... non vorrei che salto qualche tipo di opzione, quest'errore me ne sono accorto dopo una segnalazione a distanza di diversi mesi...

Re: problema quantita prodotti nel carrello

Inviato: 29/07/2010, 10:17
da xnetus
Ma ti aggiunge un massimo di 1 pezzo per articolo?