dougan1330
2015-10-23 14:55
浏览 21
已采纳

如果条件 - opencart中的最小量未定义变量错误

Minimum amount text shows perfectly until it cross the amount of 75 after that its show undefined variable for an eg. I added a $20 product, 2 times so my cart is $40 so my conditions shows "Minimum Order Value $75 to proceed Check out" again now I have added another product of 10 dollars, now my cart is $50 so my conditions shows "Minimum Order Value $75 to proceed Check out" text but the same once my cart crosses $75 its shows the below error

error

Notice: Undefined variable: error_min_amount in C:\xampp\htdocs\optest\catalog\view\theme\default\template\product\product.tpl on line 176

product.tpl view code

 <?php if ($error_min_amount) { ?>
                         <div class="alert alert-danger"> <?php echo $error_min_amount; ?></div>
  <?php } ?>

product.php controller code

        //msg minimum value
              $subtotal = '75';
      // echo $subtotal .'<br />';

              $data['cyc'] = $this->currency->format($subtotal, $this->session->data['currency'], false, false);

      //echo $data['cyc'] .'<br />';

              if($this->session->data['currency'] == 'EUR') : 
      if($this->cart->getSubtotal() < $data['cyc']) :

        $data['error_min_amount'] = 'Minimum Order Value €'.$data['cyc'].' to proceed Check out';


        endif;
        elseif($this->session->data['currency'] == 'USD') :
        if($this->cart->getSubtotal() < $data['cyc']) :
        $data['error_min_amount'] = 'Minimum Order Value $'.$data['cyc'].' to proceed Check out';


        endif; 
        elseif($this->session->data['currency'] == 'GBP') :
        if($this->cart->getSubtotal() < $data['cyc']) :
        $data['error_min_amount'] = 'Minimum Order Value £'.$data['cyc'] .' to proceed Check out';
     endif; 

endif;
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dougu8742 2015-10-23 15:01
    最佳回答

    Add $data['error_min_amount'] = false; after $subtotal = '75';. That's It.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题