TurtlePie Posted November 23, 2012 Share Posted November 23, 2012 Hello, I use Presta 1.52, and have a problem with the products who has combination attribute, If the default combination will run out of stock the other combination will not make default combination by itself, so if a customer click on that product it will see that it's out of stock ... but in fact we have it but wit a different model or a different size .. This is very important, cause we cant every time set manually the default combination, we have hundred product, and also most customer will not click the detail product if in product list there is note "out of stock" please help me 1 Link to comment Share on other sites More sharing options...
ininna Posted November 24, 2012 Share Posted November 24, 2012 Hello, I have absolutely the same problem. I hope that Prestashop can decide it or add possibility to disable out of stock products 1 Link to comment Share on other sites More sharing options...
ininna Posted December 2, 2012 Share Posted December 2, 2012 May be somebody can help with this problem? Link to comment Share on other sites More sharing options...
TurtlePie Posted December 29, 2012 Author Share Posted December 29, 2012 same problem with me. today i try the new upgrade presta 1.5.3, this problem seems no more, but the problem emerge when updating from 1.5.2 to 1.5.3, cant add new product or edit. so i back again to 1.5.2, maybe someone expert can help see the code inside 1.5.3 to be implement in 1.5.2 about this problem Link to comment Share on other sites More sharing options...
ininna Posted December 31, 2012 Share Posted December 31, 2012 This problem still present in new version 1.5.3. It is very terrible that developers don't give any attentions to this important problem. About you problem "when updating from 1.5.2 to 1.5.3, cant add new product or edit" , I had tha same and I solved it with it Use MyPHPAdmin, go to your database, choose SQL tab and paste this: alter table ps_product add column redirect_type int (10) ; alter table ps_product_shop add column redirect_type int (10) ; then click GO button on the bottom right. Regards Inna 1 Link to comment Share on other sites More sharing options...
the.rampage.rado Posted December 31, 2012 Share Posted December 31, 2012 This problem still present in new version 1.5.3. It is very terrible that developers don't give any attentions to this important problem. About you problem "when updating from 1.5.2 to 1.5.3, cant add new product or edit" , I had tha same and I solved it with it Use MyPHPAdmin, go to your database, choose SQL tab and paste this: alter table ps_product add column redirect_type int (10) ; alter table ps_product_shop add column redirect_type int (10) ; then click GO button on the bottom right. Regards Inna They probably don't give a **** because it's new year's eve... If many of the users here are active it doesn't necessary mean all people that get paid to use/make Presta will be online at this time.. Cheers! Link to comment Share on other sites More sharing options...
ininna Posted December 31, 2012 Share Posted December 31, 2012 They probably don't give a **** because it's new year's eve... If many of the users here are active it doesn't necessary mean all people that get paid to use/make Presta will be online at this time.. I do not ask to give attention today, But the information about this issue was published on 23 November, and since then no answers or solutions from developers Preastashop. All users are hoping the new version 1.5.3, but this version was not a good gift for New Year, but by a forum, only brought new problems and headaches users. Happy New Year! Link to comment Share on other sites More sharing options...
orotoi Posted March 10, 2013 Share Posted March 10, 2013 any solution about it? its a real big deal to have the attribute (in stock) change to default automaticaly prestashop guys... suggest something! it could be done i guess with some sql... but we have little documentation on db Link to comment Share on other sites More sharing options...
sabio Posted November 13, 2013 Share Posted November 13, 2013 Hi, Have the same problem - is there a module for this? Regards, Oscar Link to comment Share on other sites More sharing options...
div369 Posted June 15, 2014 Share Posted June 15, 2014 Hello! Is there any solution? Regards, div Link to comment Share on other sites More sharing options...
Chibs Posted September 8, 2014 Share Posted September 8, 2014 Up !! The problem is still here even with PS 1.6.0.9. 1 Link to comment Share on other sites More sharing options...
orotoi Posted October 15, 2014 Share Posted October 15, 2014 ....still *bump* cmon there is a way for sure Link to comment Share on other sites More sharing options...
designproducers Posted October 30, 2014 Share Posted October 30, 2014 Problem solved? Need help to! Link to comment Share on other sites More sharing options...
Nick_K Posted November 17, 2014 Share Posted November 17, 2014 So, it's been 2 years and no solution yet? I am searching for it as well.. Link to comment Share on other sites More sharing options...
mickeyboy1 Posted November 17, 2014 Share Posted November 17, 2014 Surely it can't be that hard for a coder to put product.attribute.quantity into an array, then if the default product.attribute.quantity=0 then go to the next one which has at least one???? Link to comment Share on other sites More sharing options...
designproducers Posted November 18, 2014 Share Posted November 18, 2014 (edited) Please see the solution below It worked for me, just change attribute ean13 to the attribute you want. Add lieferzeit field to combinations. diff --git a/themes/prestashop/js/product.js b/themes/prestashop/js/product.js index 01acb56..a9332c4 100644 --- a/themes/prestashop/js/product.js +++ b/themes/prestashop/js/product.js [spam-filter] -50,7 +50,7 [spam-filter] function oosHookJsCode() } //add a combination of attributes in the global JS sytem -function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, unit_price, minimal_quantity) +function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, unit_price, minimal_quantity, ean13) { globalQuantity += quantity; [spam-filter] -64,6 +64,7 [spam-filter] function addCombination(idCombination, arrayOfIdAttributes, quantity, price, eco combination['reference'] = reference; combination['unit_price'] = unit_price; combination['minimal_quantity'] = minimal_quantity; + combination['ean13'] = ean13; combinations.push(combination); } [spam-filter] -104,6 +105,7 [spam-filter] function findCombination(firstTime) //combination of the user has been found in our specifications of combinations (created in back office) selectedCombination['unavailable'] = false; selectedCombination['reference'] = combinations[combination]['reference']; + selectedCombination['ean13'] = combinations[combination]['ean13']; $('#idCombination').val(combinations[combination]['idCombination']); $('#ipa_customization').val(combinations[combination]['idCombination']); [spam-filter] -270,6 +272,17 [spam-filter] function updateDisplay() else $('#product_reference:visible').hide('slow'); + if (selectedCombination['ean13'] || productEan13) + { + if (selectedCombination['ean13']) + $('#product_ean13 span').text(selectedCombination['ean13']); + else if (productEan13) + $('#product_ean13 span').text(productEan13); + $('#product_ean13:hidden').show('slow'); + } + else + $('#product_ean13:visible').hide('slow'); + //update display of the the prices in relation to tax, discount, ecotax, and currency criteria if (!selectedCombination['unavailable'] && productShowPrice == 1) { diff --git a/themes/prestashop/product.tpl b/themes/prestashop/product.tpl index 2d89cf7..b1da9f5 100644 --- a/themes/prestashop/product.tpl +++ b/themes/prestashop/product.tpl [spam-filter] -61,6 +61,7 [spam-filter] var maxQuantityToAllowDisplayOfLastQuantityMessage = {$last_qties}; var noTaxForThisProduct = {if $no_tax == 1}true{else}false{/if}; var displayPrice = {$priceDisplay}; var productReference = '{$product->reference|escape:'htmlall':'UTF-8'}'; +var productEan13 = '{$product->ean13|escape:'htmlall':'UTF-8'}'; var productAvailableForOrder = {if (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}'0'{else}'{$product->available_for_order}'{/if}; var productShowPrice = '{if !$PS_CATALOG_MODE}{$product->show_price}{else}0{/if}'; var productUnitPriceRatio = '{$product->unit_price_ratio}'; [spam-filter] -109,7 +110,7 [spam-filter] var fieldRequired = '{l s='Please fill in all required fields, then save the cus {if isset($groups)} // Combinations {foreach from=$combinations key=idCombination item=combination} - addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity}); + addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity}, '{$combination.ean13}'); {/foreach} // Colors {if $colors|@count > 0} [spam-filter] -321,6 +322,7 [spam-filter] var fieldRequired = '{l s='Please fill in all required fields, then save the cus <p id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}><label for="product_reference">{l s='Reference :'} </label><span class="editable">{$product->reference|escape:'htmlall':'UTF-8'}</span></p> + <p id="product_ean13" {if isset($groups) OR !$product->ean13}style="display: none;"{/if}><label for="product_ean13">{l s='Lieferzeit :'} </label><span class="editable">{$product->ean13|escape:'htmlall':'UTF-8'}</span></p> <!-- quantity wanted --> <p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <label>{l s='Quantity :'}</label> remove_validation.diff Disable ean13 validation. diff --git a/classes/Validate.php b/classes/Validate.php index c015822..699aa0e 100644 --- a/classes/Validate.php +++ b/classes/Validate.php [spam-filter] -595,9 +595,9 [spam-filter] class ValidateCore */ public static function isEan13($ean13) { - return !$ean13 OR preg_match('/^[0-9]{0,13}$/', $ean13); + return true; } upgrade_1.5.diff diff --git a/classes/Product.php b/classes/Product.php index 83d1cab..1b5d3d9 100644 --- a/classes/Product.php +++ b/classes/Product.php [spam-filter] -2899,7 +2899,7 [spam-filter] class ProductCore extends ObjectModel $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`, - product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, + product_attribute_shop.`default_on`, pa.`reference`, pa.`ean13`, product_attribute_shop.`unit_price_impact`, pa.`minimal_quantity`, pa.`available_date`, ag.`group_type` FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa').' diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 28508ee..d298304 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php [spam-filter] -394,6 +394,7 [spam-filter] class ProductControllerCore extends FrontController $combinations[$row['id_product_attribute']]['weight'] = (float)$row['weight']; $combinations[$row['id_product_attribute']]['quantity'] = (int)$row['quantity']; $combinations[$row['id_product_attribute']]['reference'] = $row['reference']; + $combinations[$row['id_product_attribute']]['ean13'] = $row['ean13']; $combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact']; $combinations[$row['id_product_attribute']]['minimal_quantity'] = $row['minimal_quantity']; $combinations[$row['id_product_attribute']]['available_date'] = $available_date; Edited November 18, 2014 by designproducers (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted December 2, 2014 Share Posted December 2, 2014 (edited) I build a fix for 1.6.0.9 Im willing to share my code if someone interested Edited December 11, 2014 by michaelhjulskov (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted December 5, 2014 Share Posted December 5, 2014 I think this is what need to be overridden:classes/product.php public static function getDefaultAttribute($id_product, $minimum_quantity = 0) { static $combinations = array(); if (!Combination::isFeatureActive()) return 0; if (!isset($combinations[$id_product])) $combinations[$id_product] = array(); if (isset($combinations[$id_product][$minimum_quantity])) return $combinations[$id_product][$minimum_quantity]; // override starts here $sql = 'SELECT product_attribute_shop.id_product_attribute FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : ''). ' WHERE product_attribute_shop.default_on = 1 ' .($minimum_quantity > 0 ? ' AND IFNULL(stock.quantity, 0) >= '.(int)$minimum_quantity : ''). ' AND pa.id_product = '.(int)$id_product; $result = Db::getInstance()->getValue($sql); if (!$result) { $sql = 'SELECT product_attribute_shop.id_product_attribute FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.($minimum_quantity > 0 ? Product::sqlStock('pa', 'pa') : ''). ' WHERE pa.id_product = '.(int)$id_product .($minimum_quantity > 0 ? ' AND IFNULL(stock.quantity, 0) >= '.(int)$minimum_quantity : ''); $result = Db::getInstance()->getValue($sql); } if (!$result) { $sql = 'SELECT product_attribute_shop.id_product_attribute FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' WHERE product_attribute_shop.`default_on` = 1 AND pa.id_product = '.(int)$id_product; $result = Db::getInstance()->getValue($sql); } if (!$result) { $sql = 'SELECT product_attribute_shop.id_product_attribute FROM '._DB_PREFIX_.'product_attribute pa '.Shop::addSqlAssociation('product_attribute', 'pa').' WHERE pa.id_product = '.(int)$id_product; $result = Db::getInstance()->getValue($sql); } $combinations[$id_product][$minimum_quantity] = $result; return $result; } Link to comment Share on other sites More sharing options...
heyho Posted February 27, 2015 Share Posted February 27, 2015 (edited) Here is the Solution: This Modul sets a new default product variant if product quantity is 0 after checkout (actionValidateOrder). So a user always see products that are available. After installation a user can manually arrange all default product variants. Working in Prestashop 1.5 - 1.7 http://addons.prestashop.com/de/front-office-features-prestashop-module/19020-default-product-variant.html Greez! Edited May 22, 2018 by heyho (see edit history) Link to comment Share on other sites More sharing options...
capar Posted April 28, 2015 Share Posted April 28, 2015 It should not decide on the products listing page if a product is in stock or not according to the default combination as I believe. Since the customers see out of stock text and think that no product is in sale even there are stock available on other combinations of the product. Michael can you share your code with me? I'm interested in it. Thanks... Link to comment Share on other sites More sharing options...
Attrexx Posted January 26, 2017 Share Posted January 26, 2017 Since this is a feature that should have been implemented in the PS core functionalities and for over 2 years NO solutions were given except 2 paid modules, I am going to SPAM all the threads that address this matter.I am sorry but it doesn't seem fair at all that such an important base feature is made available via paid module when it should have been rolled out in a PS update long time ago I've seen so many PS stores losing customers because they see an Out of Stock message on a product that actually HAS stock on other combinations. It's already beyond ridiculous, this silence of the PS staff. This a call of desperation to the PS staff, of a lot of PS users, not just mine. Let the solution reveal itself at last!#MegaBump 3 Link to comment Share on other sites More sharing options...
elleonard Posted April 17, 2017 Share Posted April 17, 2017 I have te same problem... Link to comment Share on other sites More sharing options...
peter750 Posted July 5, 2017 Share Posted July 5, 2017 Is thee any update, or should we make a bug request for the devs, such a basic function ... pffff Link to comment Share on other sites More sharing options...
Recommended Posts