123julien Posted December 17, 2009 Share Posted December 17, 2009 Bonjour à tous,Je me permets de revenir vers vous avec une nouvelle question.Je ne pense pas que cela soit bien compliqué mais ma recherche sur le forum n'a pas été très efficace.Je souhaiterai en fait simplement proposé en fonction de la catégorie de produits deux listes de quantités pour la mise au panier.J'ai pour l'instant ce morceau de code sur ma page product.tpl quantity == 0) || $virtual} style="display:none;"{/if}> {l s='Quantity :'} 3 6 9 12 18 24 30 36 42 48 54 60 Mais j'aimerai que pour la catégorie 17 la liste soit uniquement 1,2,3,4,5 donc je suppose qu'il faut jouer avec un {if} mais je n'arrive pas à trouver quelle serait la bonne solution.D'avance merci pour votre aide,Julien Link to comment Share on other sites More sharing options...
123julien Posted December 18, 2009 Author Share Posted December 18, 2009 Je me permets un petit UP.D'avance merciJu Link to comment Share on other sites More sharing options...
Yoya Posted December 18, 2009 Share Posted December 18, 2009 Hello, {if $category->id_category EQ 2} 3 6 9 12 18 24 30 36 42 48 54 60 {/if} {if $category->id_category EQ 7} 5 8 {/if} Cdlt,Pierre. Link to comment Share on other sites More sharing options...
123julien Posted December 18, 2009 Author Share Posted December 18, 2009 Ok super merci beaucoup.Tu m'as mis sur la voie.Voici le code final {if $category->id_category EQ 18} 1 2 3 4 5 {elseif $category->id_category EQ 19} 1 2 3 4 5 {elseif $category->id_category EQ 21} 1 2 3 4 5 {else} 3 6 9 12 18 24 30 36 42 48 54 60 {/if} Encore merciJu Link to comment Share on other sites More sharing options...
123julien Posted December 30, 2009 Author Share Posted December 30, 2009 Re-bonjour à tous,yoya971 aurais-tu une idée pour que cette modif affecte également le + et - du panier afin que le client ne puisse pas modifier la quantité à l'unité une fois dans le panier?D'avance merci beaucoup et bonnes fêtesJulien Link to comment Share on other sites More sharing options...
Yoya Posted December 30, 2009 Share Posted December 30, 2009 Salut julien,j'ai bien une idée qui ma prise 30 mn ... Dans cart.php modifier : if ($qty == 0) $errors[] = Tools::displayError('null quantity'); elseif (!$idProduct) $errors[] = Tools::displayError('product not found'); else { $producToAdd = new Product(intval($idProduct), false, intval($cookie->id_lang)); if ((!$producToAdd->id OR !$producToAdd->active) AND !$delete) $errors[] = Tools::displayError('product is no longer available'); else { /* Check the quantity availability */ if ($idProductAttribute AND is_numeric($idProductAttribute)) { if (!$delete AND !$producToAdd->isAvailableWhenOutOfStock($producToAdd->out_of_stock) AND !Attribute::checkAttributeQty(intval($idProductAttribute), intval($qty))) $errors[] = Tools::displayError('product is no longer available'); } par .... if ($qty == 0) $errors[] = Tools::displayError('null quantity'); elseif (!$idProduct) $errors[] = Tools::displayError('product not found'); else { $producToAdd = new Product(intval($idProduct), false, intval($cookie->id_lang)); if ((!$producToAdd->id OR !$producToAdd->active) AND !$delete) $errors[] = Tools::displayError('product is no longer available'); else { //**** TEST/HELP 30/12/2009 : ajout par lot $catId=$producToAdd->id_category_default; if($catId!=18 AND $catId!=19 AND $catId!=21) { $addQtyArray = array(3, 6, 9, 12, 18, 24, 30, 36, 42, 48, 54, 60); $row=$cart->containsProduct(intval($idProduct), intval($idProductAttribute), $customizationId); $currentQty=$row['quantity']; for ($index = 0; $index < count($addQtyArray); $index++) { if($currentQty==$addQtyArray[$index]) { if(Tools::getValue('op', 'up')=='up') { if($index != count($addQtyArray)-1) { $qty=$addQtyArray[$index+1]-$addQtyArray[$index]; } else { $errors[] = Tools::displayError('you already have the maximum quantity available for this product'); } } else { $qty=$addQtyArray[$index]-$addQtyArray[$index-1]; } break; } } } //**** fin modif /* Check the quantity availability */ if ($idProductAttribute AND is_numeric($idProductAttribute)) { if (!$delete AND !$producToAdd->isAvailableWhenOutOfStock($producToAdd->out_of_stock) AND !Attribute::checkAttributeQty(intval($idProductAttribute), intval($qty))) $errors[] = Tools::displayError('product is no longer available'); } Voila ...Pierre. Link to comment Share on other sites More sharing options...
123julien Posted December 30, 2009 Author Share Posted December 30, 2009 Ok parfait. C'est juste nickel. Joli cadeau de noel...Bon à tout hasard je la tente si tu avais la moindre idée à propos de mon problème ca serait magique : http://www.prestashop.com/forums/viewthread/34666/graphisme/2_questions_a_propos_du_panierBonnes fêtesJulien Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now