Fórum OpenCart Brasil

Por um e-commerce livre, confiável e profissional

Suporte geral sobre problemas técnicos para OpenCart v1.x.
#11220
O meu so esta aparecendo da segunda e da terca opcao de tamanho.
O que eu faço para aparecer onde está com + 0,000?

Opçao 1 Produto - Valor
opção 2 Produto - Valor +1
Opção 3 Produto - Valor + 2

A opção dois e tres..funcionando, depois de ter feito o que está a cima..mas o da opção um que nao possui valor a mais..não..
O que devo fazer..

Ab'racos..
#25497
2100928 escreveu:Olá Grande Renato,

Muito boa a dica, já tinha utilizado, mas agora na nova versão 1.5.3.x, não funciona mais.
Pode ajustar?

Fico grato
Resolvido, fui direto ao ficheiro e removi o - e +.
#39572
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 '&nbsp; &nbsp;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 '&nbsp; &nbsp;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 ;)
#40016
brunoujs escreveu: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 '&nbsp; &nbsp;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 '&nbsp; &nbsp;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 ;)
Use as referências que passei (número da linha). Sei que há mais ocorrências, mas o número da linha te guiará.
#40701
É bem provavel que o problema esteja no:
Arquivo catalog/controller/product/product.php

Por que na versão 1.5.5.1 não tem os mesmos códigos ou pelo menos estão modificados.


[quote="Renato Frota"]CONSEGUI

Arquivo catalog/controller/product/product.php

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,
Esse código está na linha 352 da versão 1.5.5.1
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}

E ao incluir esses novos códigos
Código: Selecionar todos
								'price_unformatted'                   => (float)$option_value['price'] ? $option_value['price'] : false,
dá erro.
Eu acho que é por ai que tem que alterar, nessa nova linha que é inclusa.
#41740
Renato Frota escreveu:CONSEGUI

Arquivo catalog/controller/product/product.php

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 '&nbsp; &nbsp;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 '&nbsp; &nbsp;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 ;)

Na versão 1.5.5.1 não funciona!! como faz????