problema funzione oscommerce
-
Salve a tutti, ho un problema nel mio shop oscommerce, ho istallato una contribution che permette di impostare da lato admin il numero massimo di un prodotto inserito nel carrello (se ho 2 maglie non ti fa comprare 3 uguali riportando il carrello in automatico a 2)
il problema sta che se voglio comprare lo stesso articolo sia bianco che nero, dopo aver aggiornato il carrello la seconda maglia sparice.
Il tutto deriva da questo pezzo di codice://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 codequancuno sa il punto esatto del problema?
ho notato anche che lasciando cosi,nel carrello di lato al prodotto appare il colore scelto solo della prima inserita mentr per la seconda appare un -.
Mettendo false dove dice "cart_skip_prod" la seconda taglia viene memorizzata, ma facendo aggiorna sparice il prodotto dal carrello.
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi