I am using this free Odoo data slider module on website. https://www.odoo.com/apps/modules/9.0/website_snippet_data_slider/ A nice module and works well too.I need to add "price" field in to this as currently it displays product name only.
Accordingly to this module we can add fields to slider from product.template to this section
have tried to add price field like this
this.priceField = this.widgetOptions.data_price_field; this.fields = [this.priceField, 'lst_price'];
unfortunate it doesn't work.Can anyone point me the reason and fix?
Thanks
Basically you need to map the value of the price to an html element. I have not tested this however if you take a look at data_slider.js just follow what is done for the display_name (product name data_name_field
) from top to bottom.
You will also want to do some formatting for currency and so on. This should get you going in the right direction. Good luck!
In data_slider.js
try making the following changes.
Below line 27 add:
data_price_field: 'price',
Below line 125 add:
this.priceField = this.widgetOptions.data_price_field;
Replace line 131 with:
this.fields = [this.nameField, this.priceField, 'id'];
Below line 96 add:
var $price = $('<h5>').text("Price " + record[this.fields[1]]);
Replace line 97 with:
var $caption = $('<div class="caption">').append($title).append($price);