如何在Wordpress插件中编写计算

时间:2019-01-11 17:48:15

标签: wordpress plugins calculation

我正在为名为wp估算表的WordPress插件编写演算

我写了一个术语,即如果用户选择一个项目,则该项目的价格将乘以先前指定的数字,并插入该数字作为最终金额。 像这样:

 if(([item-320_isChecked])) {
 [item-320_price]*[step-68_quantity] 
} 

if(([item-318_isChecked])) {
 [item-318_price]*[step-68_quantity] 
} 

if(([item-321_isChecked])) {
 [item-321_price]*[step-68_quantity] 
} 

if(([item-322_isChecked])) {
 [item-322_price]*[step-68_quantity] 
} 

if(([item-323_isChecked])) {
 [item-323_price]*[step-68_quantity] 
} 

if(([item-324_isChecked])) {
 [item-324_price]*[step-68_quantity] 
} 

if(([item-325_isChecked])) {
 [item-325_price]*[step-68_quantity] 
} 

此部分的问题是,如果用户仅选择一项,则会显示最终价格

但是,如果您选择一个以上的项目,则如果选择了该项目,如果我想将它们相乘的乘积放在一起,则只会将最后一个项目相乘。 现在我不知道如何获得任何条件的结果(如果正确)并获得总体结果

0 个答案:

没有答案
相关问题