wireaudio Posted March 12, 2011 Share Posted March 12, 2011 Hello everyone,the idea i had was to add a quantity text field so customers can change the quantity in the shopping cart - something that i believe 1.4 already has integrated, but i'm too scared to switch until it's final I searched everywhere and all i could find was how to add a box that increases quantity by the quantity in the box... and that's not quite what i needed.What does this do?Replaces the quantity listed in the shopping cart summary with a editable text box where number can be changed to whatever customer wants, and adds a button under the text box named "Update" to change the quantity.(see attachments for pictures)This has only been tested on products without any customization quantities or non-quantitative products. (In other words, it's tested only on regular products). I will not do any more testing do to the lack of need for it.Note: Each product has its own update button. I might consider changing this in the future, but for now, it will be like this.PLEASE MAKE SURE TO BACKUP classes/Cart.php and themes/prestashop/shopping-cart-product-line.tpl before you begin!!!The changes are quite simple and require editing of just two files, adding some code in one and replacing some code on the other:Step 1:First edit classes/Cart.phpFind: elseif ($operator == 'down') { $qty = '`quantity` - '.intval($quantity); $newQty = $result['quantity'] - intval($quantity); } Add immedialy after: elseif ($operator == 'setto') { $result2 = Db::getInstance()->getRow(' SELECT '.($id_product_attribute ? 'pa' : 'p').'.`quantity`, p.`out_of_stock` FROM `'._DB_PREFIX_.'product` p '.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '').' WHERE p.`id_product` = '.intval($id_product). ($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.intval($id_product_attribute) : '')); $productQty = intval($result2['quantity']); $newQty = intval($quantity); $qty = intval($quantity); if (!Product::isAvailableWhenOutOfStock(intval($result2['out_of_stock']))) if (intval($newQty) > $productQty) return false; } It should look like this: . . . elseif ($operator == 'down') { $qty = '`quantity` - '.intval($quantity); $newQty = $result['quantity'] - intval($quantity); } elseif ($operator == 'setto') { $result2 = Db::getInstance()->getRow(' SELECT '.($id_product_attribute ? 'pa' : 'p').'.`quantity`, p.`out_of_stock` FROM `'._DB_PREFIX_.'product` p '.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '').' WHERE p.`id_product` = '.intval($id_product). ($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.intval($id_product_attribute) : '')); $productQty = intval($result2['quantity']); $newQty = intval($quantity); $qty = intval($quantity); if (!Product::isAvailableWhenOutOfStock(intval($result2['out_of_stock']))) if (intval($newQty) > $productQty) return false; } else return false; . . . Step 2:Open themes/prestashop/shopping-cart-product-line.tplFind: {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if} Replace with: <form action="{$base_dir}cart.php" method="post"> <input type="hidden" name="token" value="{$token_cart}" /> <input type="hidden" name="id_product" value="{$product.id_product|intval}" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="ipa" value="{$product.id_product_attribute|intval}" /> <input type="hidden" name="op" value="setto" /> <input align="left" type="text" name="qty" class="text" value="{$product.cart_quantity-$quantityDisplayed}" size="3" maxlength="5" /><br /> <input type="submit" name="Submit" value="{l s='Update'}" /></p> </form> 2 Link to comment Share on other sites More sharing options...
transat Posted April 15, 2011 Share Posted April 15, 2011 Hello, and thanks for this precious tip which I used, and it worked perfectly on a local host.BUT, once on a remote server, it caused some bug when trying to change product quantities and returned this error : "you already have the maximum quantity available for this product" even if there is enough products in stock.Hope it will help to improve the original code.May be useful for people who still use an old version of Prestashop, but as said before, it certainly has to be done without a hack with the 1.4 new release... Link to comment Share on other sites More sharing options...
joaowizard Posted June 1, 2011 Share Posted June 1, 2011 Hello, thank you very much for share this code, it's really good.I use this code and I made some modification, nothing big, but I got a problem, all works fine except the first element of the product list, I mean, If I have 4 different product on my cart, I can change the quantities for the 2nd, the 3rd and 4th, but never I can do for the first one, when I make click on update on the first element then it submits all form and not only the update quantity, it's very rarely, because as I write before all other elements make the update good.Finally, I can add that I put all code like you show on this post, and the same error for the first element is shown, please if you have any idea of that let me know, I try to change so many thing but I can't make that this first element works fine.In advance thank you very much.PS: I forgot, I try with different product like the first of the list, and with all makes same, the problem is always with the first element of the list. Link to comment Share on other sites More sharing options...
wireaudio Posted June 2, 2011 Author Share Posted June 2, 2011 Hello Joa,I am testing the box on my servers, and they all seem to act fine. Feel free to see if it does it on my site as well, maybe i'm not duplicating it right. You can go to www.powerprolighting.com or www.exitretrofit.com, they both use the same code as listed above. Let me know. Link to comment Share on other sites More sharing options...
joaowizard Posted June 2, 2011 Share Posted June 2, 2011 Thank you very much for your fast answer !!Well, I try to check those websites but I can´t see the one page checkout on them, maybe you disable this option.I try all day to check all code but I can´t make it works fine, I mean, all works fine except the first element of the list, and if the cart has only one element or product then it does not works fine, it´s like if the first product in the cart when I click UPDATE then the cart page is summited to the next step, but always the first product only.Well, I´ll try to fix that, if I have any update I will post here.Thank you very much !! Link to comment Share on other sites More sharing options...
wireaudio Posted June 2, 2011 Author Share Posted June 2, 2011 Ok, i will re-enable the 1 page checkout once i have some time and i'll try to figure out the bug, however i'm leaving town until monday. Please post back here to remind me sometime next week if you don't hear from me.Take care. Link to comment Share on other sites More sharing options...
Spaceray Posted January 5, 2012 Share Posted January 5, 2012 Hello, this is really great and very interesting and useful BUT regretably I can´t make it to work Using Prestashop 1.4.5 and the Glossy Template 1.4 and I am not using the one page checkout, using 5 steps. I think that probably I am relacing or making the change wrongly, also there seems to be some missing text in the above post where there is two empty squares that have more text content but it invisble. Please could anyone tell what is the right way to do it and if there is something wrong? Thanks very much Here below is my final cart.php after making the change /* Update quantity if product already exist */ if ($result) { if ($operator == 'up') { $result2 = Db::getInstance()->getRow(' SELECT '.(!empty($id_product_attribute) ? 'pa' : 'p').'.`quantity`, p.`out_of_stock` FROM `'._DB_PREFIX_.'product` p '.(!empty($id_product_attribute) ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '').' WHERE p.`id_product` = '.(int)($id_product). (!empty($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '')); $productQty = (int)$result2['quantity']; $newQty = (int)$result['quantity'] + (int)$quantity; $qty = '+ '.(int)$quantity; if (!Product::isAvailableWhenOutOfStock((int)$result2['out_of_stock'])) if ($newQty > $productQty) return false; } elseif ($operator == 'down') { $qty = '`quantity` - '.intval($quantity); $newQty = $result['quantity'] - intval($quantity); } *____________________________________this here is the new part added__________________________________ elseif ($operator == 'setto') { $result2 = Db::getInstance()->getRow(' SELECT '.($id_product_attribute ? 'pa' : 'p').'.`quantity`, p.`out_of_stock` FROM `'._DB_PREFIX_.'product` p '.($id_product_attribute ? 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '').' WHERE p.`id_product` = '.intval($id_product). ($id_product_attribute != NULL ? ' AND `id_product_attribute` = '.intval($id_product_attribute) : '')); $productQty = intval($result2['quantity']); $newQty = intval($quantity); $qty = intval($quantity); if (!Product::isAvailableWhenOutOfStock(intval($result2['out_of_stock']))) if (intval($newQty) > $productQty) return false; } *______________________________this is the end of the part added_______________________________ else return false; if ($newQty < $minimalQuantity AND $minimalQuantity > 1) return -1; } else return false; /* Delete product from cart */ AND THEN ALSO THE - shopping-cart-product-line.tpl with the added and replaced form <a class="cart_quantity_down" style="opacity: 0.3;" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}" title="{l s='You must purchase a minimum of '}{$product.minimal_quantity}{l s=' of this product.'}"> <img src="{$img_dir}icon/quantity_down.gif" width="14" height="9" alt="{l s='Subtract'}" /> </a> {/if} </div> <input type="hidden" value="<form action="{$base_dir}cart.php" method="post"> <input type="hidden" name="token" value="{$token_cart}" /> <input type="hidden" name="id_product" value="{$product.id_product|intval}" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="ipa" value="{$product.id_product_attribute|intval}" /> <input type="hidden" name="op" value="setto" /> <input align="left" type="text" name="qty" class="text" value="{$product.cart_quantity-$quantityDisplayed}" size="3" maxlength="5" /><br /> <input type="submit" name="Submit" value="{l s='Update'}" /></p> </form>" /> <input size="2" type="text" class="cart_quantity_input" value="{<form action="{$base_dir}cart.php" method="post"> <input type="hidden" name="token" value="{$token_cart}" /> <input type="hidden" name="id_product" value="{$product.id_product|intval}" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="ipa" value="{$product.id_product_attribute|intval}" /> <input type="hidden" name="op" value="setto" /> <input align="left" type="text" name="qty" class="text" value="{$product.cart_quantity-$quantityDisplayed}" size="3" maxlength="5" /><br /> <input type="submit" name="Submit" value="{l s='Update'}" /></p> </form>" /> {/if} </td> <td class="cart_total"> <span class="price" id="total_product_price_{$product.id_product}_{$product.id_product_attribute}"> Link to comment Share on other sites More sharing options...
Spaceray Posted January 6, 2012 Share Posted January 6, 2012 Please, anyone could know how to use this here, OR have any other different solution for replacing the +- buttons for a "update" button ? It is very important and needed for me Thanks very much Link to comment Share on other sites More sharing options...
Spaceray Posted January 18, 2012 Share Posted January 18, 2012 Please, anyone else have already changed the + - buttons and have replaced them with an update button as shown here ? It is very interesting to add a new update button in the prestashop cart instead of the + - buttons but regretably I have followed the instructions but it does not work for me. It seems that there is MORE code than what is shown in the post. Please, could anyone be so kind to tell me how to do it, and what is needed to change?. Thanks very much. Kindest regards. Link to comment Share on other sites More sharing options...
PatriceJV Posted September 20, 2012 Share Posted September 20, 2012 (edited) I have worked on this because I found one bug and display problem. I have also corrected a bug from Prestashop, the available/not avavailable icon that was not working. Find attached the file you need to have it works. This works on Prestashop 1.4.8.2 1) Put the Cart.php in the YourShopRoot/override/classes 2) Save the file YourShopRoot/themes/YourTheme/shopping-cart-product-line.tpl under a new name (shopping-cart-product-line.tpl.orig for example) 3) Copy the attached shopping-cart-product-line.tpl in the same folder 4) Copy refresh.gif and delete.gif in the YourSitesRoot/themes/YourTheme/img/icon folder 5) In global.css look for .cart_quantity_input, delete this line and copy : .cart_quantity_input { float: left; margin: 5px 1px 0 0; } .cart_quantity_udate { float: left; margin: 5px 10px 0 2px; border-width: 0px;} Enjoy Patrice Cart.zip Edited September 20, 2012 by PatriceVigier (see edit history) 2 Link to comment Share on other sites More sharing options...
PatriceJV Posted September 20, 2012 Share Posted September 20, 2012 Cart.php code : <?php /* * 2007-2012 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2012 PrestaShop SA * @version Release: $Revision: 14001 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class Cart extends CartCore { /** * Update product quantity * * @param integer $quantity Quantity to add (or substract) * @param integer $id_product Product ID * @param integer $id_product_attribute Attribute ID if needed * @param string $operator Indicate if quantity must be increased or decreased */ public function updateQty($quantity, $id_product, $id_product_attribute = NULL, $id_customization = false, $operator = 'up') { $product = new Product((int) $id_product, false, (int) Configuration::get('PS_LANG_DEFAULT')); /* If we have a product combination, the minimal quantity is set with the one of this combination */ if (!empty($id_product_attribute)) $minimalQuantity = (int) Attribute::getAttributeMinimalQty((int) $id_product_attribute); else $minimalQuantity = (int) $product->minimal_quantity; if (!Validate::isLoadedObject($product)) die(Tools::displayError()); if (isset(self::$_nbProducts[$this->id])) unset(self::$_nbProducts[$this->id]); if (isset(self::$_totalWeight[$this->id])) unset(self::$_totalWeight[$this->id]); if ((int) $quantity <= 0) return $this->deleteProduct((int) $id_product, (int) $id_product_attribute, (int) $id_customization); else if (!$product->available_for_order OR Configuration::get('PS_CATALOG_MODE')) return false; else { /* Check if the product is already in the cart */ $result = $this->containsProduct((int) $id_product, (int) $id_product_attribute, (int) $id_customization); /* Update quantity if product already exist */ if ($result) { if ($operator == 'up') { $result2 = Db::getInstance()->getRow(' SELECT ' . (!empty($id_product_attribute) ? 'pa' : 'p') . '.`quantity`, p.`out_of_stock` FROM `' . _DB_PREFIX_ . 'product` p ' . (!empty($id_product_attribute) ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '') . ' WHERE p.`id_product` = ' . (int) ($id_product) . (!empty($id_product_attribute) ? ' AND `id_product_attribute` = ' . (int) $id_product_attribute : '')); $productQty = (int) $result2['quantity']; $newQty = (int) $result['quantity'] + (int) $quantity; $qty = '+ ' . (int) $quantity; if (!Product::isAvailableWhenOutOfStock((int) $result2['out_of_stock'])) if ($newQty > $productQty) return false; } elseif ($operator == 'down') { $qty = '- ' . (int) $quantity; $newQty = (int) $result['quantity'] - (int) $quantity; if ($newQty < $minimalQuantity AND $minimalQuantity > 1) return -1; } //Ajout Patrice elseif ($operator == 'setto') { $result2 = Db::getInstance()->getRow(' SELECT ' . ($id_product_attribute ? 'pa' : 'p') . '.`quantity`, p.`out_of_stock` FROM `' . _DB_PREFIX_ . 'product` p ' . ($id_product_attribute ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '') . ' WHERE p.`id_product` = ' . intval($id_product) . ($id_product_attribute != NULL ? ' AND `id_product_attribute` = ' . intval($id_product_attribute) : '')); $productQty = intval($result2['quantity']); $newQty = intval($quantity); $qty = intval($quantity); if (!Product::isAvailableWhenOutOfStock(intval($result2['out_of_stock']))) if (intval($newQty) > $productQty) return false; } //Fin ajout Patrice else return false; /* Delete product from cart */ if ($newQty <= 0) return $this->deleteProduct((int) $id_product, (int) $id_product_attribute, (int) $id_customization); else if ($newQty < $minimalQuantity) return -1; else Db::getInstance()->Execute(' UPDATE `' . _DB_PREFIX_ . 'cart_product` SET `quantity` = ' . $qty . ', `date_add` = NOW() WHERE `id_product` = ' . (int) $id_product . (!empty($id_product_attribute) ? ' AND `id_product_attribute` = ' . (int) $id_product_attribute : '') . ' AND `id_cart` = ' . (int) $this->id . ' LIMIT 1'); } /* Add product to the cart */ else { $result2 = Db::getInstance()->getRow(' SELECT ' . (!empty($id_product_attribute) ? 'pa' : 'p') . '.`quantity`, p.`out_of_stock` FROM `' . _DB_PREFIX_ . 'product` p ' . (!empty($id_product_attribute) ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON p.`id_product` = pa.`id_product`' : '') . ' WHERE p.`id_product` = ' . (int) $id_product . (!empty($id_product_attribute) ? ' AND `id_product_attribute` = ' . (int) $id_product_attribute : '')); if (!Product::isAvailableWhenOutOfStock((int) $result2['out_of_stock'])) if ((int) $quantity > $result2['quantity']) return false; if ((int) $quantity < $minimalQuantity) return -1; if (!Db::getInstance()->AutoExecute(_DB_PREFIX_ . 'cart_product', array('id_product' => (int) $id_product, 'id_product_attribute' => (int) $id_product_attribute, 'id_cart' => (int) $this->id, 'quantity' => (int) $quantity, 'date_add' => date('Y-m-d H:i:s')), 'INSERT')) return false; } } // refresh cache of self::_products $this->_products = $this->getProducts(true); $this->update(true); if ($product->customizable) return $this->_updateCustomizationQuantity((int) $quantity, (int) $id_customization, (int) $id_product, (int) $id_product_attribute, $operator); else return true; } } shopping-cart-product-line.tpl code {* * 2007-2012 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2012 PrestaShop SA * @version Release: $Revision: 14008 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <script type='text/javascript' charset='utf-8'> {literal} function required() { var len = document.getElementsByName('qty').length; var txtValue = document.getElementsByName('qty'); var i = 0; while (i<len || txtValue[i].value >0) { if((txtValue[i].value == 0) || (txtValue[i].value == "0") || (txtValue[i].value == "")) { //alert("{/literal} {l s=' Quantity zero is not allowed, to delete the product, \n click on delete function located on the right of the line.'} {literal}"); alert("La quantité à zéro n\'est pas autorisée, \n pour supprimer l\'article, \n cliquez sur la fonction supprimer, à droite de la ligne."); txtValue[i].focus(); return false; break; } i++ } } {/literal} </script> <tr id="product_{$product.id_product}_{$product.id_product_attribute}" class="{if $smarty.foreach.productLoop.last}last_item{elseif $smarty.foreach.productLoop.first}first_item{/if}{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item"> <td class="cart_product"> <a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a> </td> <td class="cart_description"> <h5><a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.name|escape:'htmlall':'UTF-8'}</a></h5> {if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if} </td> <td class="cart_ref">{if $product.reference}{$product.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td> <td class="cart_availability"> {if $product.active AND $product.quantity <= $product.stock_quantity AND $product.available_for_order AND !$PS_CATALOG_MODE} <img src="{$img_dir}icon/available.gif" alt="{l s='Available'}" width="14" height="14" /> {else} <img src="{$img_dir}icon/unavailable.gif" alt="{l s='Out of stock'}" width="14" height="14" /> {/if} </td> <td class="cart_unit"> <span class="price" id="product_price_{$product.id_product}_{$product.id_product_attribute}"> {if !$priceDisplay}{convertPrice price=$product.price_wt}{else}{convertPrice price=$product.price}{/if} </span> </td> <td class="cart_quantity"{if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0} style="text-align: center;"{/if}> {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}<span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}" >{$product.customizationQuantityTotal}</span>{/if} {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0} <form name = "form1" onsubmit="return required(document.form1.qty)" action="{$base_dir}cart.php" method="post" > <input type="hidden" name="token" value="{$token_cart}" /> <input type="hidden" name="id_product" value="{$product.id_product|intval}" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="ipa" value="{$product.id_product_attribute|intval}" /> <input type="hidden" name="op" value="setto" /> <input align="left" type="text" name="qty" class="cart_quantity_input" value="{$product.cart_quantity-$quantityDisplayed}" size="1" maxlength="4" onblur="required(document.form1.qty)"/> <input class="cart_quantity_udate" type="image" title="{l s='Update quantity'}" src="{$img_dir}icon/refresh.gif" alt="{l s='Update'}" width="16" height="16" /> </form> {/if} </td> <td class="cart_total"> <span class="price" id="total_product_price_{$product.id_product}_{$product.id_product_attribute}"> {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)} {if !$priceDisplay}{displayPrice price=$product.total_customization_wt}{else}{displayPrice price=$product.total_customization}{/if} {else} {if !$priceDisplay}{displayPrice price=$product.total_wt}{else}{displayPrice price=$product.total}{/if} {/if} <a rel="nofollow" class="cart_quantity_delete" id="{$product.id_product}_{$product.id_product_attribute}" href="{$link->getPageLink('cart.php', true)}?delete&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&token={$token_cart}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="icon" width="14" height="14" /></a> {*Patrice -fin*} </span> </td> </tr> 2 Link to comment Share on other sites More sharing options...
jmaybes Posted September 27, 2012 Share Posted September 27, 2012 Thanks Patrice! This is great, made some css adjustments to go with my custom theme. But love it, wanted to thank you my friend Link to comment Share on other sites More sharing options...
benjamin utterback Posted September 27, 2012 Share Posted September 27, 2012 Hello all!, I just wanted to say thank you Patrice for this awesome contribution. This has helped jmaybes, and I'm sure many more of our members will enjoy it. I will go ahead and mark this thread as solved. Thank you for choosing PrestaShop! 1 Link to comment Share on other sites More sharing options...
NewLizard Posted November 7, 2012 Share Posted November 7, 2012 i was not able to resolve this issue..I am using the latest prestashop 1.5.2 - copied the files from the zip file and replaced each file to its folder..as well modified the global.css. i get errors in all pages of shopping after doing that. Link to comment Share on other sites More sharing options...
NewLizard Posted November 7, 2012 Share Posted November 7, 2012 (edited) Hi my mistake I replaced the cart.php in YourShopRoot/classes instead of YourShopRoot/override/classes I now replaced the cart.php in the override/classes folder. But now i get a new error when i checkout or add to cart You already have the maximum quantity available for this product." even when i enough products in stock. Edited November 7, 2012 by NewLizard (see edit history) Link to comment Share on other sites More sharing options...
h0m1e Posted January 25, 2013 Share Posted January 25, 2013 thanks , it works very nicely Link to comment Share on other sites More sharing options...
mohamadeffazuan Posted February 5, 2013 Share Posted February 5, 2013 Hi Patrice, You did a great job. Thank you very much. I'm using PS 1.5.1 and it's works. Link to comment Share on other sites More sharing options...
Donia Posted March 21, 2013 Share Posted March 21, 2013 Hi my mistake I replaced the cart.php in YourShopRoot/classes instead of YourShopRoot/override/classes I now replaced the cart.php in the override/classes folder. But now i get a new error when i checkout or add to cart You already have the maximum quantity available for this product." even when i enough products in stock. same problem here Link to comment Share on other sites More sharing options...
tozi Posted January 30, 2014 Share Posted January 30, 2014 Have anyone solution for prestashop 1.5.6.1? Link to comment Share on other sites More sharing options...
frieurieud Posted June 11, 2014 Share Posted June 11, 2014 Hi ! Somebody does a solution have for prestashop 1.5.6.1 please ? Because having clicked the button, nothing takes place. The quantity does not change and the rate either (necessarily). Thank you in advance. Link to comment Share on other sites More sharing options...
frieurieud Posted June 12, 2014 Share Posted June 12, 2014 Well, I find error. So it's for ps 1.5.6.2, and I let you test for other versions. First : copy code of PatriceVigier to modify Cart.php and shopping-cart-product-line.tpl (with picture if you want) Secondly : in Cart.php, change $productQty to $product_qty and $newQty to $new_qty (because it's for ps 1.4) and Thirdly : always in Cart.php, find /* Delete product from cart */ if ($new_qty <= 0) return $this->deleteProduct((int)$id_product, (int)$id_product_attribute, (int)$id_customization); else if ($new_qty < $minimal_quantity) return -1; else Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'cart_product` SET `quantity` = '.$qty.', `date_add` = NOW() WHERE `id_product` = '.(int)$id_product. (!empty($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '').' AND `id_cart` = '.(int)$this->id.(Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery() ? ' AND `id_address_delivery` = '.(int)$id_address_delivery : '').' LIMIT 1' ); Change this line SET `quantity` = `quantity` '.$qty.', `date_add` = NOW() by SET `quantity` = '.$qty.', `date_add` = NOW() I declare this post is twice resolved. Thank you very much to PatriceVigier. 1 Link to comment Share on other sites More sharing options...
vixensjlin Posted July 15, 2014 Share Posted July 15, 2014 Hey, you guys are awsome! Does this work in PS 1.6? Thanks! Link to comment Share on other sites More sharing options...
frieurieud Posted July 16, 2014 Share Posted July 16, 2014 Hello, Sorry I don't know I stayed in the version 1.5.6.2 and I don't know if there is a lot of difference between them. You can try but think of copy to protect the original files. If that works, thank you for letting it know, that will interest certainly somebody. 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