julienlightdesign Posted November 3, 2011 Share Posted November 3, 2011 Bonjour à tous, Je suis débutant sur Prestashop (version 1.4.0.17) et j'utilise le générateur de déclinaisons pour les multiples caractéristiques de mes produits. Le problème que j'ai est que je souhaite que mes produits disposent d'un minimum de commande de 500 unités. Or lorsque j'utilise le générateur cela efface le minimum de quantité et il faut que je le remette en manuel par la suite sur les déclinaisons générées. Facile pour 10 déclinaisons mais j'ai un produit complexe qui en a 200, comment faire pour garder le minimum de commande entré dans le premier onglet. Merci par avance, Julien ____________________________________________________________________ J'ai résolu ce problème en achetant le module Store Commander qui permet de faire des copié-collés très rapidement. Link to comment Share on other sites More sharing options...
villechange Posted November 4, 2011 Share Posted November 4, 2011 Bonjour à tous Je suis également interessé par cette question, merci d'avance à tous les bienfaiteurs... Link to comment Share on other sites More sharing options...
julienlightdesign Posted November 5, 2011 Author Share Posted November 5, 2011 Salut à tous, Personne n'a de solutions ? Car je suis bien coincé pour avancer. Merci par avance, Bonne journée, Julien Link to comment Share on other sites More sharing options...
villechange Posted November 6, 2011 Share Posted November 6, 2011 Bonsoir, c'est dommage à priori pas de solution, car il est vrai que c'est un vrai problème.... Link to comment Share on other sites More sharing options...
b2comm Posted May 15, 2012 Share Posted May 15, 2012 Bonjour Un petit Up, car cette question est très intéressante (et toujours d'actualité sur presta 1.4.7). On peut comprendre que ce soit un besoin de souplesse qui fait que la quantité mini soit configurable déclinaison par déclinaison, mais... si on a par exemple un produit avec x variantes (750 variantes) commandables chacune uniquement à partir de 4 articles, il est pratiquement IMPOSSIBLE de le renseigner à la main variante par variante. Je pense que ce cas de figure (plusieurs variantes produits mais 1 seule quantité mini de commande générale) arrive souvent ! Amicalement Link to comment Share on other sites More sharing options...
b2comm Posted May 23, 2012 Share Posted May 23, 2012 Re bonjour si cela intéresse quelqu'un, voici comment ajouter au générateur d'attributs un champ "quantité minimale" avec pour valeur par défaut la quantité minimale du produit en général (voir image 1). De cette façon, une quantité identique est ajoutée d'un seul coup à toutes les déclinaisons ! Attention il s'agit d'un hack qui modifie le coeur de Prestashop. Conserver la version originale des fichiers modifiés ci-dessous ! Dans ../admin/tabs/AdminAttributeGenerator.php 1- Chercher vers ligne 50-55 : if ($this->product->id) { return (array( 'id_product' => (int)($this->product->id), 'price' => (float)($price), 'weight' => (float)($weight), 'ecotax' => 0, 'quantity' => (int)($_POST['quantity']), 'reference' => pSQL($_POST['reference']), 'default_on' => 0)); } return array(); Remplacer par : if ($this->product->id) { return (array( 'id_product' => (int)($this->product->id), 'price' => (float)($price), 'weight' => (float)($weight), 'ecotax' => 0, 'minimal_quantity' => (int)($_POST['minimal_quantity']), 'quantity' => (int)($_POST['quantity']), 'reference' => pSQL($_POST['reference']), 'default_on' => 0)); } return array(); 2 - Chercher vers ligne 300 : echo ' <div style="padding-top:10px; float: left; width: 570px;"> <div style="float:left;"> <label>'.$this->l('Quantity').'</label> <div class="margin-form"> <input type="text" size="20" name="quantity" value="0"/> </div> <label>'.$this->l('Reference').'</label> <div class="margin-form"> <input type="text" size="20" name="reference" value="'.$this->product->reference.'"/> </div> </div> <div style="float:left; text-align:center; margin-left:20px;"> <input type="submit" class="button" style="margin-bottom:5px;" name="generate" value="'.$this->l('Generate').'" /><br /> <input type="submit" class="button" name="back" value="'.$this->l('Back to product').'" /> </div> <br style="clear:both;" /> <div style="margin-top: 15px;">'; Remplacer par : echo ' <div style="padding-top:10px; float: left; width: 570px;"> <div style="float:left;"> <label>'.$this->l('Quantity').'</label> <div class="margin-form"> <input type="text" size="20" name="quantity" value="0"/> </div> <label>'.$this->l('Reference').'</label> <div class="margin-form"> <input type="text" size="20" name="reference" value="'.$this->product->reference.'"/> </div> <label>'.$this->l('Quantite minimale de commande').'</label> <div class="margin-form"> <input type="text" size="20" name="minimal_quantity" value="'.$this->product->minimal_quantity.'"/> </div> </div> <div style="float:left; text-align:center; margin-left:20px;"> <input type="submit" class="button" style="margin-bottom:5px;" name="generate" value="'.$this->l('Generate').'" /><br /> <input type="submit" class="button" name="back" value="'.$this->l('Back to product').'" /> </div> <br style="clear:both;" /> <div style="margin-top: 15px;">'; Désormais lors d'une génération de produit une même quantité mini sera attribuée à chaque déclinaison (et prise en compte lors de l'ajout panier du produit). On veut maintenant afficher cette quantité minimale par attribut dans le tableau récapitulatif de l'onglet "Déclinaisons" (voir image 2) Dans ../admin/tabs/AdminProduct.php, dans la function displayFormAttributes($obj, $languages, $defaultLanguage) 1 - Chercher <tr> <th>'.$this->l('Attributes').'</th> <th>'.$this->l('Impact').'</th> <th>'.$this->l('Weight').'</th> <th>'.$this->l('Reference').'</th> <th>'.$this->l('EAN13').'</th> <th>'.$this->l('UPC').'</th> <th class="center">'.$this->l('Quantity').'</th> <th class="center">'.$this->l('Actions').'</th> </tr>'; Remplacer par <tr> <th>'.$this->l('Attributes').'</th> <th>'.$this->l('Impact').'</th> <th>'.$this->l('Weight').'</th> <th>'.$this->l('Reference').'</th> <th>'.$this->l('EAN13').'</th> <th>'.$this->l('UPC').'</th> <th class="center">'.$this->l('Qte mini').'</th> <th class="center">'.$this->l('Qte stock').'</th> <th class="center">'.$this->l('Actions').'</th> </tr>'; 2 - Chercher echo ' <tr'.($irow++ % 2 ? ' class="alt_row"' : '').($product_attribute['default_on'] ? ' style="background-color:#D1EAEF"' : '').'> <td>'.stripslashes($list).'</td> <td class="right">'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').$product_attribute['price'].($currency->format % 2 == 0 ? ' '.$currency->sign : '').'</td> <td class="right">'.$product_attribute['weight'].Configuration::get('PS_WEIGHT_UNIT').'</td> <td class="right">'.$product_attribute['reference'].'</td> <td class="right">'.$product_attribute['ean13'].'</td> <td class="right">'.$product_attribute['upc'].'</td> <td class="center">'.$product_attribute['quantity'].'</td> <td class="center"> <a style="cursor: pointer;"> <img src="../img/admin/edit.gif" alt="'.$this->l('Modify this combination').'" onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['supplier_reference'].'\', \''.$product_attribute['ean13'].'\', \''.$product_attribute['quantity'].'\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['attribute_minimal_quantity'].'\'); calcImpactPriceTI();" /></a> '.(!$product_attribute['default_on'] ? '<a href="'.$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"> <img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').' <a href="'.$currentIndex.'&deleteProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"> <img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /></a></td> </tr>'; Remplacer par echo ' <tr'.($irow++ % 2 ? ' class="alt_row"' : '').($product_attribute['default_on'] ? ' style="background-color:#D1EAEF"' : '').'> <td>'.stripslashes($list).'</td> <td class="right">'.($currency->format % 2 != 0 ? $currency->sign.' ' : '').$product_attribute['price'].($currency->format % 2 == 0 ? ' '.$currency->sign : '').'</td> <td class="right">'.$product_attribute['weight'].Configuration::get('PS_WEIGHT_UNIT').'</td> <td class="right">'.$product_attribute['reference'].'</td> <td class="right">'.$product_attribute['ean13'].'</td> <td class="right">'.$product_attribute['upc'].'</td> <td class="center">'.$product_attribute['attribute_minimal_quantity'].'</td> <td class="center">'.$product_attribute['quantity'].'</td> <td class="center"> <a style="cursor: pointer;"> <img src="../img/admin/edit.gif" alt="'.$this->l('Modify this combination').'" onclick="javascript:fillCombinaison(\''.$product_attribute['wholesale_price'].'\', \''.$product_attribute['price'].'\', \''.$product_attribute['weight'].'\', \''.$product_attribute['unit_impact'].'\', \''.$product_attribute['reference'].'\', \''.$product_attribute['supplier_reference'].'\', \''.$product_attribute['ean13'].'\', \''.$product_attribute['quantity'].'\', \''.($attrImage ? $attrImage->id : 0).'\', Array('.$jsList.'), \''.$id_product_attribute.'\', \''.$product_attribute['default_on'].'\', \''.$product_attribute['ecotax'].'\', \''.$product_attribute['location'].'\', \''.$product_attribute['upc'].'\', \''.$product_attribute['attribute_minimal_quantity'].'\'); calcImpactPriceTI();" /></a> '.(!$product_attribute['default_on'] ? '<a href="'.$currentIndex.'&defaultProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"> <img src="../img/admin/asterisk.gif" alt="'.$this->l('Make this the default combination').'" title="'.$this->l('Make this combination the default one').'"></a>' : '').' <a href="'.$currentIndex.'&deleteProductAttribute&id_product_attribute='.$id_product_attribute.'&id_product='.$obj->id.'&'.(Tools::isSubmit('id_category') ? 'id_category='.(int)(Tools::getValue('id_category')).'&' : '&').'token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');"> <img src="../img/admin/delete.gif" alt="'.$this->l('Delete this combination').'" /></a></td> </tr>'; That's all ! Link to comment Share on other sites More sharing options...
raphtaar Posted February 2, 2015 Share Posted February 2, 2015 Salut à tous, Est ce que le code que vous avez mis en ligne ( b2comm) est compatible pour la version 1.6 de Prestashop ? Merci d'avance. Link to comment Share on other sites More sharing options...
b2comm Posted February 2, 2015 Share Posted February 2, 2015 Bonjour je ne sais pas (pas testé) mais vu les changements entre prestashop 1.4 et 1.6, ça m'étonnerait beaucoup. !!! Cordialement Link to comment Share on other sites More sharing options...
raphtaar Posted February 2, 2015 Share Posted February 2, 2015 Re bonjour, Non malheureusement cela ne fonctionne pas sous 1.6 en tout cas le code présent ci-dessus n'est pas présent dans les fichiers de presta 1.6. Je vais ouvrir un nouveau sujet à ce propos. Merci. 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