تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
32026 أدوات العرض

Hi all,

Here i want inherit and replace a inherited template in a separate folder, i want inherit the below code. and its located in addons/website_sale/views/templates.xml


<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">

<xpath expr="//div[@class='product_price']" position="inside">

<input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>

<t t-if="len(product.product_variant_ids) == 1">

<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>

</t>

<t t-if="len(product.product_variant_ids) &gt; 1">

<a class="btn btn-default btn-xs fa fa-shopping-cart" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"/>

</t>

</xpath>

</template>

Thanks in advance......

الصورة الرمزية
إهمال
أفضل إجابة
<template id="website_sale.products_add_to_cart" inherit_id="website_sale.products_add_to_cart" active="False" customize_show="True"></template>

This will completely delete the origin template, not recommended instead I recommend to you to use a different id and modify inside whatever you want.

الصورة الرمزية
إهمال
أفضل إجابة

hello i have try this but don't work there is any kind of bug on override template????

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 24
1672
1
مارس 24
1315
18
ديسمبر 22
36883
1
يوليو 22
3049
2
نوفمبر 21
8149