Olá, boa noite.
Tenho o Opencart Versão 1.5.5.1 e estava com a mesma necessidade de mostrar o valor total nas opções.
Lí e fiz as modificações que o Renato Frota postou...
Porém no Arquivo
catalog/view/theme/default/template/product/product.tpl do tema que utilizo, tem 4 vezes o código (abaixo) que precisava ser substituído em lugares diferentes:
Código: Selecionar todos (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
Estou bem confuso e não sei mais o que substituir!
... fui substituindo aleatoriamente para ver se dava certo e o máximo que acontecia era sumir o sinal de + e o valor ao lado ficava 0,00.
Galera, agradeço desde já a atenção por terem lido minha dificuldade. Espero que alguém possa me ajudar!
Abraço à todos.
Renato Frota escreveu:
Procurar linha 259:
Código: Selecionar todos 'price' => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
Incluir nova linha (observação, eu disse INCLUIR):
Código: Selecionar todos 'price_unformatted' => (float)$option_value['price'] ? $option_value['price'] : false,
Arquivo catalog/view/theme/default/template/product/product.tpl (ou arquivo correspondente do seu tema)
Procurar (deve estar na linha 72):
Código: Selecionar todos (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
Substituir por:
Código: Selecionar todos <?php if (!$special) { ?>
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['price'] - $option_value['price_unformatted'] : $product_info['price'] + $option_value['price_unformatted']; ?><?php echo '- '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
<?php } else { ?>
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['price'] - $option_value['price_unformatted'] : $product_info['price'] + $option_value['price_unformatted']; ?><?php echo '- de '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['special'] - $option_value['price_unformatted'] : $product_info['special'] + $option_value['price_unformatted']; ?><?php echo ' por '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
<?php } ?>
Obs: as linhas 77 e 78 ficarão iguais, mesmo!
Procure por (deve estar na linha 95):
Código: Selecionar todos (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
Substituir por:
Código: Selecionar todos <?php if (!$special) { ?>
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['price'] - $option_value['price_unformatted'] : $product_info['price'] + $option_value['price_unformatted']; ?><?php echo '- '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
<?php } else { ?>
<span class="price-old">
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['price'] - $option_value['price_unformatted'] : $product_info['price'] + $option_value['price_unformatted']; ?><?php echo '- de '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
</span>
<span class="price-new">
<?php $option_price = ($option_value['price_prefix'] == '-') ? $product_info['special'] - $option_value['price_unformatted'] : $product_info['special'] + $option_value['price_unformatted']; ?><?php echo ' por '.$this->currency->format($this->tax->calculate($option_price, $product_info['tax_class_id'], $this->config->get('config_tax'))); ?>
</span>
<?php } ?>
Agora, as linhas 104 e 105 serão idênticas, também.
Espero ter ajudado 