如何在codeigniter中从购物车中获得ASC订单中的5个产品

时间:2017-10-06 09:35:46

标签: php mysql codeigniter codeigniter-3

foreach ($this->cart->contents() as $key) {

    $total = $total + $key['price'];
    $subtotal = $subtotal + $key['price'];
    $clg_id = $key['clg_id'];
    $cityinfo = $this->site_model->selectcity_state($clg_id, "college_id", "tbl_college_details");
    $clg_premium = $this->site_model->select_premium($clg_id);
    $premium = $clg_premium[0];

    // What I would want to be able to do:
    if ($premium->premium == 'Y' && $count == '5') {
        $total = '499';
    } elseif($premium->premium == 'Y' && $count > '5') {

    }

}

我的购物车中有6个产品我想做什么当用户点击按ASC订单按照价格计算前5个产品的付款将计算499而休息一个假设它有400个价格将添加499so为6产品价格将是899

0 个答案:

没有答案