我创建了opencart电子商务结帐系统......
我为每个产品添加了额外的字段,所以当我结帐产品时,我想从总购物车数量中减去我的总首付金额....
example for my cart
product1 10, downpayment 5 (number means US dollar)
product1 15, downpayment 8
my total amount is 25
total Downpayment is 13
我希望从总金额中减去首期付款,并将此值回显到总金额以下... 如果得到结果,它将是这样的:
total amount = 25
downpayment = 13
remaining balance = 12
任何人都请帮帮我。 sory我的英语不完美......我是PHP新手......
我已经从我的数据库创建了产品表.. 如下所示,它是一个上传的产品字段......
===Database q8marketz == Table structure for table product |------ |Field|Type|Null|Default |------ |//**product_id**//|int(11)|No| |model|varchar(64)|No| |downpayment|varchar(32)|No| |sku|varchar(64)|No| |upc|varchar(12)|No| |ean|varchar(14)|No| |jan|varchar(13)|No| |isbn|varchar(13)|No| |mpn|varchar(64)|No| |location|varchar(128)|No| |quantity|int(4)|No|0 |stock_status_id|int(11)|No| |image|varchar(255)|Yes|NULL |manufacturer_id|int(11)|No| |shipping|tinyint(1)|No|1 |price|decimal(15,4)|No|0.0000 |points|int(8)|No|0 |tax_class_id|int(11)|No| |date_available|date|No| |weight|decimal(15,8)|No|0.00000000 |weight_class_id|int(11)|No|0 |length|decimal(15,8)|No|0.00000000 |width|decimal(15,8)|No|0.00000000 |height|decimal(15,8)|No|0.00000000 |length_class_id|int(11)|No|0 |subtract|tinyint(1)|No|1 |minimum|int(11)|No|1 |sort_order|int(11)|No|0 |status|tinyint(1)|No|0 |date_added|datetime|No|0000-00-00 00:00:00 |date_modified|datetime|No|0000-00-00 00:00:00 |viewed|int(5)|No|0 == Dumping data for table product |886|BA-HANDBAGS-001ss|8| | | | | | |aaaa|95|7|data/hand-bags.jpg|7|0|25.0000|25|0|2012-09-03|0.00000000|1|0.00000000|0.00000000|0.00000000|1|1|1|1|1|2012-09-25 13:00:18|2012-09-25 14:15:09|0
答案 0 :(得分:0)
这可能很容易在购物车的PHP代码中完成,如:
$total=25;
$downpayment=13;
$remainingBalance = $total-$downpayment;
echo $remainingBalance;
基于此和您之前的问题,我会真的建议您查看一些基本的PHP和SQL教程。某些事情like this可能会帮助您解决您遇到的这类问题。现在,我不是说不要问,我在想,你可能会在途中学到很多东西。