2013-06-17 2 views
1

열린 장바구니가있는 사이트에서 각 옵션을 조정 가격으로 표시하고자합니다.Opencart category.php 가격을 업데이트하지 않습니다

컨트롤러에서 모든 옵션을 가져 와서 반복하고 최종 결과를 간단히 추가/형식 지정합니다. 그러나 그것의 다만 작동하지 않으며, 나는 절대적으로 왜 모른다. 템플릿에 렌더링 할 때의 가격에는 결과 가격 + 123이 표시되지 않습니다.

내 코드는 다음과 같습니다.

$options = $this->model_catalog_product->getProductOptions($result['product_id']); 

      foreach ($options as $option) { 
       foreach($option['option_value'] as $option_value) { 
        $option_value['price'] = $result['price'] = $option_value['price']; 
       } 
      } 

      $this->data['products'][] = array(
       'options'  => $options, 
       'product_id' => $result['product_id'], 
       'thumb'  => $image, 
       'name'  => $result['name'], 
       'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..', 
       'price'  => $price, 
       'special'  => $special, 
       'tax'   => $tax, 
       'rating'  => $result['rating'], 
       'reviews'  => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), 
       'href'  => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url) 
      ); 

답변

1
$option_value['price'] = $result['price'] = $option_value['price']; 

당신은 너무 특별 가격을 포함 있는지 확인하려면 실제로

$option_value['price'] = $result['price'] + $option_value['price']; 

비록이어야한다, 당신은 사용할 수

$option_value['price'] = $option_value['price'] + (empty($result['special']) ? $result['price'] : $result['special']); 
관련 문제