【发布时间】:2018-04-05 07:52:21
【问题描述】:
我目前正在尝试实现一些额外的产品价格属性,它将接受用户输入并据此计算价格。尝试使用价格属性但不工作。任何想法如何做到这一点,因为 magento 中的新功能无法解决这个问题。请注意高度和宽度是输入类型文本,用户可以添加任何值
从前端尝试计算价格,
require([
'jquery','Magento_Catalog/js/price-utils','jquery/ui','Magento_Catalog/js/price-box'
], function($,priceUtils,priceBox){
"use strict";
var priceBoxes = $('[data-role=priceBox]');
$('.product-custom-optionval').change(function () {
var value = $(this).val();
if (value === '') {
$(this).val(0);
updatePriceOnChange(0, $(this).attr('data-attr-id'));
return;
}
disableAddToCartBtn('#product_addtocart_form');
calculatePrice($(this));
enableAddToCartBtn('#product_addtocart_form');
});
****** But after calculating the price what will my approach to update product price, please help *******
【问题讨论】:
-
请准确描述您尝试实现此目标的代码以及您的确切问题。问候。
-
@RohitRai 兄弟,我不知道如何开始。这就是为什么试图得到一些想法
-
@RohitRai 请查看更新后的评论
标签: magento attributes magento2 product