我正在尝试在 Codeingiter 购物车中添加负价格,但不能。
$coupon = array(
'id' => $result->id,
'name' => $result->name,
'qty' => '1',
'price' => $result->discount,
'options' => array(
'info' => 'coupon',
'qty_description' => '')
);
$this->cart->insert($coupon);
Where$result->discount
取自数据库,是十进制数-20
。
当我使用此代码时,我将商品放入购物车,但它会将其变为 (+)20 而不是 -20。有什么理由和帮助吗?