Skip to Content
Menu
This question has been flagged
1 Reply
3133 Views

Hello i'm working on a table like this

https://drive.google.com/open?id=1de_8vJPLPEA-C9v2AH4cB6ahHX_c-bfe

I'm using a module called "Website Variant Cart by webkul" but i've customized it to make it look like the img before

as you can see i have color variants in 1 colum but i need to set each of the color buttons to change the variant img in the product img as odoo works by default..

This is the code that i am using


<td id="colors-variant">
<t t-if="variant_id.attribute_value_ids" t-foreach="variant_id.attribute_value_ids" t-as="p_attribute_value">
<div>
<span>
<label t-attf-style="background-color:#{p_attribute_value.html_color}" t-attf-class="css_attribute_color #{'active' if first_possible_combination == p_attribute_value else ''}">
<input type="radio" name="attrib"/>
</label>
</span>

</div>
</t>
</td>


This works to render the color in my column but i need to click on it and change the variant img as odoo do it with the original function 

Avatar
Discard
Author

Thank you @Ravi Gadhia

I tried what you said, but i get this error *'product.product' object has no attribute 'attribute_id' *

i'm trying diferent things but i don't figure it out how to set it correctly

Best Answer

you have to set all/required attributes on input radio element like in original code 
https://github.com/odoo/odoo/blob/12.0/addons/sale/views/sale_product_configurator_templates.xml#L295

Avatar
Discard
Related Posts Replies Views Activity
4
Oct 22
3939
0
Feb 24
331
2
Jun 20
2691
1
Jul 19
3230
1
Dec 24
161