Fórum OpenCart Brasil

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

#60836
Olá...uma dica bem legal pra galera, que penei pra fazer funcionar e compartilho com os amigos:

1 Baixe o vqmod Display Label in Special Products em https://www.opencart.com/index.php?rout ... e735ec3a54 e siga as instruções para instalação do desenvolvedor.

1.1
1- vá em public_html/vqmod/xml/special-promo.xml
2- ache a linha: <file name="catalog/view/theme/*/template/product/category.tpl" >
3- copie tudo de <file name=... até </file>
4- Abaixo de </file> digite <!-- inicio nova linha--> <!--Fim nova linha--> (Para organizar, pode ser nomeado do jeito que achar melhor)
5- Cole o conteúdo copiado anteriormente dentro de: <!-- inicio nova linha--> <!--Fim nova linha--> e ficara assim:
Código: Selecionar todos
<!--INICIO NOVA LINHA-->
	<file name="catalog/view/theme/*/template/product/*.tpl" >
	<operation>
		   <search position="iafter"><![CDATA[
      <div class="image">
      ]]></search>	
		   
		   <add><![CDATA[<div style="position:relative">
		   
	                           <?php 
                           if ($product['special']) { ?>  
                  <div class="specialPercent" style="color: #fff; font-weight: bold; position: absolute; background-color:#F00; top:1em;right:2em;padding:0.5em">
                  <?php 
                  $string_price = str_replace(",","",$product['price']);
				  $string  = preg_match_all('!\d+(?:\.\d+)?!', $string_price, $matches);
				  $float_ori = array_map('floatval', $matches[0]);
				  $ori_val  = $float_ori[0];

                  $string_special = str_replace(",","",$product['special']);
				  $string_s  = preg_match_all('!\d+(?:\.\d+)?!', $string_special, $matches_s);
				  $float_spe = array_map('floatval', $matches_s[0]);
				  $spe_val  = $float_spe[0];
				  

				  $price_diff = $ori_val-$spe_val;
				  $percentage_val = ($price_diff*100)/$ori_val;
				  echo round($percentage_val) . "% OFF";
                  ?>
                  </div>
                  <?php } ?>	   
		   
		</div>]]></add>
		    </operation>
	</file>
	<!--FIM NOVA LINHA-->
1.2
para que o as etiquetas apareçam em Fabricantes, Promoções(Specials) e Prodtudos:
encontre <file name="catalog/view/theme/*/template/product/category.tpl e substitua por <file name="catalog/view/theme/*/template/product/*.tpl" >

1.3
para que as etiquetas apareçam na pagina inicial em Produtos Destaque, Specials, e Recent( se vc tiver adicionado tais itens)
encontre: catalog/view/theme/default/template/module/feature.tpl ou catalog/view/theme/default/template/module/special.tpl or catalog/view/theme/default/template/module/recent.tpl e siga os mesmos passos do passo 1.2

salve as alterações e atualize, atualize a página e seja feliz!

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
ENGLISH VERSION:
Hello ... a cool tip for guys, that sieve to make it work and share with friends:

1 Download the vqmod Display Label in Special Products in https://www.opencart.com/index.php?rout ... e735ec3a54 and follow the instructions developer installation.

1.1
1- go public_html / vqmod / xml / special-promo.xml
2 find the line: <file name = "catalog / view / theme / * / template / product / category.tpl">
3 Copy all of <file name = ... to </ file>
4- Below </ file> type <- new line start -> <! - New line End -> (To organize, can be named the way you see fit)
5 Paste the contents previously copied within: <! - New line start -> <! - New line End -> and will look exactly like this:
Código: Selecionar todos
 <!-- BEGIN NEW LINE -->
<File name = "catalog / view / theme / * / template / product / *. Tpl">
<Operation>
<Search position = "iafter"> <! [CDATA [
      <Div class = "image">
      ]]> </ Search>

<Add> <! [CDATA [<div style = "position: relative"!>

<? Php
                           if ($ product ['special']) {?>
                  <Div class = "specialPercent" style = "color: #fff; font-weight: bold; position: absolute; background-color: # F00; top: 1em; right: 2em; padding: 0.5em">
                  <? Php
                  $ String_price = str_replace ("", "", $ product ['price']);
$ String = preg_match_all (:, $ string_price, $ matches '\ d + (\ \ d +) ?!!?.');
$ Float_ori = array_map ('floatval', $ matches [0]);
$ $ Float_ori ori_val = [0];

                  $ String_special = str_replace ("", "", $ product ['special']);
$ String_s = preg_match_all:, (, $ string_special, $ matches_s' \ d + (\ \ d +) ?!!?. ")
Float_spe array_map = $ ('floatval' $ matches_s [0]);
$ $ Float_spe spe_val = [0];


Price_diff = $ $ $ ori_val- spe_val;
Percentage_val $ = ($ price_diff * 100) / $ ori_val;
echo round ($ percentage_val). "% Off";
                  ?>
                  </ Div>
                  <? Php}?>

</ Div>]]> </ add>
</ Operation>
</ File>
<!-- NEW LINE END --> 
1.2
so the labels appear on manufacturers, Specials (Specials) and Prodtudos:
find <file name = "catalog / view / theme / * / template / product / category.tpl and replace it with <file name =" catalog / view / theme / * / template / product / *. tpl ">

1.3
so the labels appear on the home page Featured Products, Specials, and Recent (if u have added such items)
find: catalog / view / theme / default / template / module / feature.tpl or catalog / view / theme / default / template / module / special.tpl or catalog / view / theme / default / template / module / recent.tpl and follow the same steps from step 1.2

save the changes and update, refresh the page and be happy!

Gente preciso de ajuda urgente. Na migraç&a[…]

Caro @reds , muito obrigado pela resposta.

PHP 8+ incompatibilidade

Toda tradução para a versão 3[…]

Ola @alex3257 Se você precisa apenas ver […]