2016-06-30 4 views
0

OpenCart에서 선택한 통화별로 쿠폰 코드를 제한 할 수 있습니까?쿠폰 코드 제한 OpenCart에서 선택한 통화 구매

예. 쇼핑몰에는 두 개의 통화 XX 및 YY가 있습니다. 구매자가 XX 통화를 선택하면 장바구니에 쿠폰 코드 필드가 표시됩니다. 다른 경우 (선택한 통화 YY)가 아닙니다.

OpenCart 2.0.3.1

+0

너는 지금까지 일 해왔다. – Andrej

답변

0

예를 열고이 파일 : 버전 catalog/controller/checkout/coupon.php 2.0.3.1

찾기 :

if (empty($this->request->post['coupon'])) { 
     $json['error'] = $this->language->get('error_empty'); 

     unset($this->session->data['coupon']); 
    } elseif ($coupon_info) { 
     $this->session->data['coupon'] = $this->request->post['coupon']; 

     $this->session->data['success'] = $this->language->get('text_success'); 

     $json['redirect'] = $this->url->link('checkout/cart'); 
    } else { 
     $json['error'] = $this->language->get('error_coupon'); 
    } 

변화 그것에 :이 무엇

if (empty($this->request->post['coupon'])) { 
     $json['error'] = $this->language->get('error_empty'); 

     unset($this->session->data['coupon']); 
    } elseif ($coupon_info) { 
     // here I use USD for example 
     if($this->session->data['currency'] == 'USD'){ 
      $this->session->data['coupon'] = $this->request->post['coupon']; 

      $this->session->data['success'] = $this->language->get('text_success'); 

      $json['redirect'] = $this->url->link('checkout/cart'); 
     } else { 
      // Write your custom error message here 
      $json['error'] = 'This coupon is only available in USD'; 

      unset($this->session->data['coupon']); 
     } 
    } else { 
     $json['error'] = $this->language->get('error_coupon'); 
    }