yaloe2017 1 Posted August 18, 2017 Posted August 18, 2017 (edited) Hello, My shop is almost finished. There is one thing i cannot archive. I want my shoe sizes to be greyed out when the are out of stock. I know I can hide them via the backend (Display unavailable product attributes on the product page) Thank you! Edited August 18, 2017 by yaloe2017 (see edit history) Share this post Link to post Share on other sites
yaloe2017 1 Posted August 18, 2017 Posted August 18, 2017 (edited) I fixed this issue: In product.tpl (add the black lines) <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} //product higher then 0 is stock <li class="input-container float-left"> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </li> {/if} {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1} // product lower then -1 is out of stock <li class="input-container out-of-stock-float-left"> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </li> {/if} {/foreach} </ul> You can style using CSS: For example to use color red and line through: /* out of stock css */ li.input-container.out-of-stock-float-left { float: left !important; color: red !important; } li.input-container.out-of-stock-float-left span.radio-label { text-decoration: line-through; } /* end out of stock css */ Cheers Edited August 18, 2017 by yaloe2017 (see edit history) 1 Share this post Link to post Share on other sites
Piter17 1 Posted October 7, 2019 Posted October 7, 2019 Hello, I need the same solution, but for presta 1.7. Anyone can help me? Share this post Link to post Share on other sites
Piter17 1 Posted April 10, 2020 Posted April 10, 2020 BUMP Share this post Link to post Share on other sites
Knowband Plugins 141 Posted April 10, 2020 Posted April 10, 2020 Can need to make the similar changes in the following file for PS1.7 theme/{your_theme}/templates/catalog/partials/product-variants.tpl 1 Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 Hi! I use Prestashop 1.7.5.1 theme/{your_theme}/templates/catalog/partials/product-variants.tpl I have make changes but don't working fine. Can anyone help me how to fix it? <div class="product-variants"> {foreach from=$groups key=id_attribute_group item=group} {if !empty($group.attributes)} <div class="clearfix product-variants-item"> <span class="control-label">{$group.name}</span> {if $group.group_type == 'select'} <select class="form-control form-control-select" id="group_{$id_attribute_group}" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option> {/foreach} </select> {elseif $group.group_type == 'color'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} //product higher then 0 is stock <li class="pull-left input-container"> <label> <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if} {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if} ><span class="sr-only">{$group_attribute.name}</span></span> </label> </li> {/if} {/foreach} </ul> {elseif $group.group_type == 'radio'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1} // product lower then -1 is out of stock <li class="input-container pull-left"> <label> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </label> </li> {/if} {/foreach} </ul> {/if} </div> {/if} {/foreach} </div> Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 (edited) Commented text need to be changed. Comment in HTML or TPL is <!-- you comment --> Now the comment is only // (valid for PHP) Find two differences in the original code and in the code I modified. Basic knowledge is required for any HTML, TPL or PHP editing. !!! <div class="product-variants"> {foreach from=$groups key=id_attribute_group item=group} {if !empty($group.attributes)} <div class="clearfix product-variants-item"> <span class="control-label">{$group.name}</span> {if $group.group_type == 'select'} <select class="form-control form-control-select" id="group_{$id_attribute_group}" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option> {/foreach} </select> {elseif $group.group_type == 'color'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} <!-- product higher then 0 is stock --> <li class="pull-left input-container"> <label> <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if} {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if} ><span class="sr-only">{$group_attribute.name}</span></span> </label> </li> {/if} {/foreach} </ul> {elseif $group.group_type == 'radio'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1} <!-- product lower then -1 is out of stock --> <li class="input-container pull-left"> <label> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </label> </li> {/if} {/foreach} </ul> {/if} </div> {/if} {/foreach} </div> Edited April 12, 2020 by D. Tengler (see edit history) Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 thank you! I'm a beginner so I don't have much experience.. I don't understand how to make that red line, that size should be crossed when it is sold out?? Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 Add custom style to TPL code. Quote <li class="input-container pull-left"> to: Quote <li class="input-container pull-left" style="color:red !important; text-decoration: line-through;"> You edit this in the code section where count is <1. In this code section, you need to add a condition when count = 0. If you don't have the knowledge, it's better to hire someone and you're done in a few minutes. Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 now it's red all, i want it to be just sold out red and strikethrough. Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 i want same this Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 upload your product-variants.tpl file here Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 product-variants.tpl Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 I don't want the original, I need the one you modified. Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 sorry, here again. product-variants.tpl Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 You didn't even copy the code that yaloe2017 put here !!! Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 sorry, i has add code but then get error on product page product-variants.tpl Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 Modified code for Prestashop 1.7. In attachment. Disable clicked values and change color to red. product-variants.tpl 2 Share this post Link to post Share on other sites
matejmili 1 Posted April 12, 2020 Posted April 12, 2020 now work, thank you very much! Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 You can click on the gray heart below the posts of all users who posted help here. You will appreciate the effort and time devoted to this thread. 3 2 Share this post Link to post Share on other sites
Piter17 1 Posted April 12, 2020 Posted April 12, 2020 (edited) 50 minut temu, D. Tengler napisał: Modified code for Prestashop 1.7. In attachment. Disable clicked values and change color to red. product-variants.tpl 4.27 kB · 2 downloads Hi, You are invaluable, thank you so much! I have got just a question about disabled attributes. Is it possible to grey them out, but make still active? I need the option: let me know, when the product is available again. P.S I fixed it:) You have to change: <li class="input-container" style="pointer-events: none; float: left !important;"> to <li class="input-container" style="pointer-events: auto; float: left !important;"> Edited April 12, 2020 by Piter17 (see edit history) 1 Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 (edited) I write a module on it to allow more settings, even for a drop-down list or colors. When I have time, I will create a module 😉 Will be free, but download only from my site. Edited November 24, 2020 by D. Tengler (see edit history) 1 Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 12, 2020 Posted April 12, 2020 7 minutes ago, Piter17 said: Hi, You are invaluable, thank you so much! I have got just a question about disabled attributes. Is it possible to grey them out, but make still active? I need the option: let me know, when the product is available again. P.S I fixed it:) <span class="radio-label" style="color:red !important; text-decoration: line-through;background: silver !important;border: 2px solid silver;">...... <li class="input-container" style="float: left !important;"> Share this post Link to post Share on other sites
Mayret Moda Colombia 1 Posted April 13, 2020 Posted April 13, 2020 On 4/12/2020 at 3:59 PM, D. Tengler said: I write a module on it to allow more settings, even for a drop-down list or colors. Tomorrow will be ready 😉 Will be free, but download only from my site. Hi, Do you have any news of that brilliant module? Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 13, 2020 Posted April 13, 2020 I'm doing the last testing. Share this post Link to post Share on other sites
Mayret Moda Colombia 1 Posted April 13, 2020 Posted April 13, 2020 1 hour ago, D. Tengler said: I'm doing the last testing. Ok! I will wait. It will be compatible with PS1.7X? Share this post Link to post Share on other sites
Mayret Moda Colombia 1 Posted April 13, 2020 Posted April 13, 2020 1 hour ago, D. Tengler said: PS 1.6.1 to 1.7.6 Only radio buttons. My test page PS 1.7.6 here: https://e-apps.eu/test/ps-17/women/2-69-brown-bear-printed-sweater.html#/3-velikost-l It looks great, but I have a question, How does it behave with 1 size-color combination? For example: https://e-apps.eu/test/ps-17/men/1-hummingbird-printed-t-shirt.html If there is no stock of black for any size, is black and all sizes disabled? sorry for my english Share this post Link to post Share on other sites
Daniel Tengler 426 Posted April 14, 2020 Posted April 14, 2020 Only sizes radio buttons. For other options I would have to write a java script that checks all the options. This is no longer easy. 1 Share this post Link to post Share on other sites
LucasV 3 Posted April 23, 2020 Posted April 23, 2020 On 4/12/2020 at 3:59 PM, D. Tengler said: I write a module on it to allow more settings, even for a drop-down list or colors. Tomorrow will be ready 😉 Will be free, but download only from my site. Hi! Thanks for your work on this issue. I can't seem to find your module on your website, can I download it somewhere? Thanks. Lucas Share this post Link to post Share on other sites
webmarko 0 Posted May 20, 2020 Posted May 20, 2020 Hello, I would like to do the same thing, this my file template (Prestashop version 1.7.6.5) Thank you so much for your hellp product-variants.tpl Share this post Link to post Share on other sites
ndiaga 339 Posted May 20, 2020 Posted May 20, 2020 Hi, You can read this tutorials : https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ Share this post Link to post Share on other sites
webmarko 0 Posted May 20, 2020 Posted May 20, 2020 I'm confused to use this code for my template file, can you please explain more. Thank you so much Share this post Link to post Share on other sites
ndiaga 339 Posted May 20, 2020 Posted May 20, 2020 (edited) 3 minutes ago, webmarko said: I'm confused to use this code for my template file, can you please explain more. Thank you so much This code was for a custom website but if you read the code carefully you can implement it in your website as well. Edited May 20, 2020 by ndiaga (see edit history) Share this post Link to post Share on other sites
webmarko 0 Posted May 20, 2020 Posted May 20, 2020 I'm having trouble putting this code into my file, could you help me please? Thank you so much Share this post Link to post Share on other sites
bencassell 0 Posted May 23, 2020 Posted May 23, 2020 This doesn't work for 1.7.6.5, I'm guessing because you can disable "out of stock" from view. I'd still really like the combination to show with a red line through it, is there a way to do it? Share this post Link to post Share on other sites
LucasV 3 Posted July 7, 2020 Posted July 7, 2020 I'm also still looking for a solution.. 😬 Share this post Link to post Share on other sites
Aja2800 1 Posted August 27, 2020 Posted August 27, 2020 On 4/14/2020 at 6:44 AM, D. Tengler said: Only sizes radio buttons. For other options I would have to write a java script that checks all the options. This is no longer easy. Did you make this module? I would be happy to pay for it, really need this functionality for my shop Share this post Link to post Share on other sites
ndiaga 339 Posted August 27, 2020 Posted August 27, 2020 (edited) 8 minutes ago, Aja2800 said: Did you make this module? I would be happy to pay for it, really need this functionality for my shop Hi, Yes, I solve a client's problem with a module. Edited August 27, 2020 by ndiaga (see edit history) Share this post Link to post Share on other sites
Aja2800 1 Posted August 27, 2020 Posted August 27, 2020 Just now, ndiaga said: Hi, Yes, I solve a client's problem with a module. Can you send a link? Thanks! Share this post Link to post Share on other sites
ndiaga 339 Posted August 27, 2020 Posted August 27, 2020 Just now, Aja2800 said: Can you send a link? Thanks! Let me PM you. Share this post Link to post Share on other sites
LucasV 3 Posted August 31, 2020 Posted August 31, 2020 Hi, I'm also interested. Share this post Link to post Share on other sites
chemocycling 0 Posted September 26, 2020 Posted September 26, 2020 i need the same think .did you solve this ? i need to strike out the out of stock attributes Share this post Link to post Share on other sites
ndiaga 339 Posted September 26, 2020 Posted September 26, 2020 10 minutes ago, chemocycling said: i need the same think .did you solve this ? i need to strike out the out of stock attributes Yes, I did solve it . I share the code here : https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ Share this post Link to post Share on other sites
ndiaga 339 Posted September 26, 2020 Posted September 26, 2020 On 8/31/2020 at 9:33 AM, LucasV said: Hi, I'm also interested. Read this tutorial : https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ Share this post Link to post Share on other sites
chemocycling 0 Posted September 26, 2020 Posted September 26, 2020 6 minutes ago, ndiaga said: Yes, I did solve it . I share the code here : https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ i dont want to disable . i want to grey out (strike out) the out of stock Share this post Link to post Share on other sites
ndiaga 339 Posted September 26, 2020 Posted September 26, 2020 30 minutes ago, chemocycling said: i dont want to disable . i want to grey out (strike out) the out of stock Yes desable means gray out. Share this post Link to post Share on other sites
chemocycling 0 Posted September 26, 2020 Posted September 26, 2020 (edited) 3 minutes ago, ndiaga said: Yes desable means gray out. ok . 1.can this be clickable ? 2.in what place i put the code in product-variants.tpl ? can you help me product-variants (3).tpl Edited September 26, 2020 by chemocycling (see edit history) Share this post Link to post Share on other sites
ndiaga 339 Posted September 26, 2020 Posted September 26, 2020 2 minutes ago, chemocycling said: ok . 1.can this be clickable ? 2.in what place i put the code in product-variants.tpl ? can you help me product-variants (3).tpl 3.45 kB · 0 downloads Yes, in product-variants.tpl . If you don't know how to implement it just send me PM . Share this post Link to post Share on other sites
chemocycling 0 Posted September 26, 2020 Posted September 26, 2020 On 4/12/2020 at 4:59 PM, D. Tengler said: I write a module on it to allow more settings, even for a drop-down list or colors. Tomorrow will be ready 😉 Will be free, but download only from my site. hi where we can download that module . i cant find it thanks Share this post Link to post Share on other sites
Inter Svetainė 6 Posted October 15, 2020 Posted October 15, 2020 On 4/12/2020 at 3:20 PM, D. Tengler said: Add custom style to TPL code. to: You edit this in the code section where count is <1. In this code section, you need to add a condition when count = 0. If you don't have the knowledge, it's better to hire someone and you're done in a few minutes. Please never use !important in CSS. Just add needed styling in custom.css or similar file to overwrite theme or/and global CSS declarations. Share this post Link to post Share on other sites
rosejaafar 1 Posted November 12, 2020 Posted November 12, 2020 (edited) On 8/19/2017 at 4:05 AM, yaloe2017 said: I fixed this issue: In product.tpl (add the black lines) <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} //product higher then 0 is stock <li class="input-container float-left"> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </li> {/if} {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1} // product lower then -1 is out of stock <li class="input-container out-of-stock-float-left"> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label">{$group_attribute.name}</span> </li> {/if} {/foreach} </ul> You can style using CSS: For example to use color red and line through: /* out of stock css */ li.input-container.out-of-stock-float-left { float: left !important; color: red !important; } li.input-container.out-of-stock-float-left span.radio-label { text-decoration: line-through; } /* end out of stock css */ Cheers I have make changes but don't working fine. Can anyone help me how to fix it? Edited November 14, 2020 by rosejaafar (see edit history) Share this post Link to post Share on other sites
Inter Svetainė 6 Posted November 12, 2020 Posted November 12, 2020 Could You try to mark places in screenshot where to look at and what You want to do? Share this post Link to post Share on other sites
rosejaafar 1 Posted November 13, 2020 Posted November 13, 2020 6 hours ago, Inter Svetainė said: Could You try to mark places in screenshot where to look at and what You want to do? my size attributes don't work properly after i make a change and just a certain size appear. it should appear from size S to 3XL and position of the size not well organized .Please help me😕 Share this post Link to post Share on other sites
rosejaafar 1 Posted November 13, 2020 Posted November 13, 2020 6 hours ago, Inter Svetainė said: Could You try to mark places in screenshot where to look at and what You want to do? i want my sizes attributes same like this,,i have use the code but not work well Share this post Link to post Share on other sites
Inter Svetainė 6 Posted November 13, 2020 Posted November 13, 2020 6 hours ago, rosejaafar said: i want my sizes attributes same like this,,i have use the code but not work well How good You are in the programing? HTML from 1 to 10. CSS from 1 to 10. PHP from 1 to 10. Are You familiar with Prestashop 1.7.x structure? I need to know this to help You. Share this post Link to post Share on other sites
rosejaafar 1 Posted November 13, 2020 Posted November 13, 2020 1 hour ago, Inter Svetainė said: How good You are in the programing? HTML from 1 to 10. CSS from 1 to 10. PHP from 1 to 10. Are You familiar with Prestashop 1.7.x structure? I need to know this to help You. I'm IT student and still learning about programming..my HTML knowledge from 8 to 9,,but PHP about 5 to 6...Nope,,im not familiar with Prestashop 1.7 structure,,first time i'm create website use prestashop.Please help me to find the error..This website for my internship project. Share this post Link to post Share on other sites
Daniel Tengler 426 Posted November 14, 2020 Posted November 14, 2020 ./themes/classic/templates/catalog/_partials/product-variants.tpl find: {elseif $group.group_type == 'radio'} change to: {elseif $group.group_type == 'radio'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li class="input-container float-xs-left" {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}style="pointer-events:none;"{/if}> <label> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label" {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}style="color:red;"{/if}>{if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}<strike>{$group_attribute.name}</strike>{else}{$group_attribute.name}{/if}</span> </label> </li> {/foreach} </ul> {/if} 1 1 Share this post Link to post Share on other sites
rosejaafar 1 Posted November 14, 2020 Posted November 14, 2020 Done,, my size attribute greyed out already for out of stock product,,thank you for your help☺️ 1 Share this post Link to post Share on other sites
Daniel Tengler 426 Posted November 14, 2020 Posted November 14, 2020 You can thank me by clicking on the gray heart below my post, posts. 1 1 Share this post Link to post Share on other sites
Inter Svetainė 6 Posted December 4, 2020 Posted December 4, 2020 Please don't use inline styling never ever anywhere. https://softwareengineering.stackexchange.com/questions/319629/why-is-it-bad-to-use-inline-styling-in-html-for-generic-styles Share this post Link to post Share on other sites
JBW 308 Posted December 4, 2020 Posted December 4, 2020 I have released a new module that can disable/grey out attributes including colors that are out of stock and also insert the price impact or total price: https://addons.prestashop.com/en/product.php?id_product=50460 Share this post Link to post Share on other sites
rb10 1 Posted December 14, 2020 Posted December 14, 2020 On 11/14/2020 at 7:58 AM, 4you.software said: ./themes/classic/templates/catalog/_partials/product-variants.tpl find: {elseif $group.group_type == 'radio'} change to: {elseif $group.group_type == 'radio'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li class="input-container float-xs-left" {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}style="pointer-events:none;"{/if}> <label> <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span class="radio-label" {if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}style="color:red;"{/if}>{if {$group.attributes_quantity[{$id_attribute|intval}]} < 1}<strike>{$group_attribute.name}</strike>{else}{$group_attribute.name}{/if}</span> </label> </li> {/foreach} </ul> {/if} hi thanks for you, how i can apply this also for color attribute ? Share this post Link to post Share on other sites
ndiaga 339 Posted December 14, 2020 Posted December 14, 2020 54 minutes ago, rb10 said: hi thanks for you, how i can apply this also for color attribute ? Hi, You can follow the tutorial I shared. Share this post Link to post Share on other sites
rb10 1 Posted December 14, 2020 Posted December 14, 2020 1 minute ago, ndiaga said: Hi, You can follow the tutorial I shared. thanks, where is tutorial link ? Share this post Link to post Share on other sites
ndiaga 339 Posted December 14, 2020 Posted December 14, 2020 12 minutes ago, rb10 said: thanks, where is tutorial link ? https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ Share this post Link to post Share on other sites
rb10 1 Posted December 14, 2020 Posted December 14, 2020 40 minutes ago, ndiaga said: https://blog.prestatuts.com/prestashop-desable-product-combinations-when-out-of-stock/ thanks, but this explain only for radio and not for color i need for this code part (i wanna have color like as grey but clickable) {elseif $group.group_type == 'color'} <ul id="group_{$id_attribute_group}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li class="float-xs-left input-container"> <label> <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}> <span {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if} {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if} ><span class="sr-only">{$group_attribute.name}</span></span> </label> </li> {/foreach} </ul> Share this post Link to post Share on other sites
Daniel Tengler 426 Posted December 14, 2020 Posted December 14, 2020 It's all working for me. Everything can be done, such as a crossed out color and text completion. I don't want anyone to contact me in a private message. If I want to answer, I will answer, if I want to give codes, I will give them. Programming gives me bread, advice in the forum gives me nothing. @ndiaga will definitely advise you. Share this post Link to post Share on other sites
rb10 1 Posted December 14, 2020 Posted December 14, 2020 17 minutes ago, 4you.software said: It's all working for me. Everything can be done, such as a crossed out color and text completion. I don't want anyone to contact me in a private message. If I want to answer, I will answer, if I want to give codes, I will give them. Programming gives me bread, advice in the forum gives me nothing. @ndiaga will definitely advise you. sorry for my message, i understand perfectly! for this result you have used code quoted over, because i can't see part for color. thanks, and sorry again! Share this post Link to post Share on other sites
alebupal 0 Posted January 20 Posted January 20 Hi, thank you very much for the code, but I have a problem that I cannot solve. I have two attributes: size and color. I have: Product X: color red, size L with 5 units. Product X: blue color, size L with 0 units. With this code, the product X with size L and blue color on the web is shown with stock because the stock is the sum of both sizes. Is there any possible solution? Share this post Link to post Share on other sites
MerseyRay 26 Posted Friday at 02:43 PM Posted Friday at 02:43 PM @Daniel Tengler Thankyou, that code is working fine Could something like this code be utilized for an out-of-stock button on the category list of products Something along the lines of this {if variants exist and stock is greater than 1 on any attribute} <Choose options button> {else} {if in-stock} <View Product> {else} <Out of stock button} {/if} Or if that's not possible, how about to add a product flag to the product on category list view saying "Out of stock" Many thanks Share this post Link to post Share on other sites
Daniel Tengler 426 Posted Saturday at 05:58 AM Posted Saturday at 05:58 AM (edited) Product list Here is an example of how to find out if a product has variants, how quantity are in stock, etc ... ./themes/classic/templates/catalog/_partials/miniatures/product.tpl {if $product.main_variants} all variants quantity: {$product.quantity_all_versions} <br /> default variant quantity: {$product.quantity} <br /> {if $product.quantity_all_versions > 0} yes, count quantity all variants in stock <br /> {else} all variant quantity <= 0 <br /> {/if} {if $product.quantity > 0} yes, default variant in stock <br /> {else} default variant quantity <= 0 <br /> {/if} {else} product quantity without variant: {$product.quantity} {if $product.quantity > 0} yes, product in stock <br /> {else} product out of stock, quantity <= 0 <br /> {/if} {/if} Edited Saturday at 06:13 AM by Daniel Tengler (see edit history) Share this post Link to post Share on other sites
MerseyRay 26 Posted Saturday at 05:42 PM Posted Saturday at 05:42 PM (edited) HI Daniel, thanks for the reply and help. Can I just check that the first line is correct ? {if $product.main_variants} Its just that some of my products with variants says this is false so uses the code after the {else} statement. If I remove all that first line, the {else} and the last line {/if} then the variables do show the count for all the variants correctly, so they are fine. Many thanks Ray Edited Saturday at 05:56 PM by MerseyRay (see edit history) Share this post Link to post Share on other sites
Daniel Tengler 426 Posted Sunday at 07:47 AM Posted Sunday at 07:47 AM $product.main_variants It's the same as a function= Product::hasAttributes(). I gave a code sample for Prestashop 1.7.7.0 Share this post Link to post Share on other sites
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