跳至内容
菜单
此问题已终结
1 回复
3839 查看

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 

形象
丢弃
编写者

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

最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
4
10月 22
4870
0
2月 24
1064
2
6月 20
3545
1
7月 19
4178
3
5月 25
1184