special-promo.xml adlı modul, indirimli ürünler sayfasında resimlere % olarak indirim etiketi koyuyor. Ben buna ek yaparak kategori sayfasında da % indirim yaptım. Ancak indirimli olmayan ürünlerde de %100 çıkıyor. Php bilemediğim için gerekli düzenlemeyi yapamadım. special-promo.xml 94. satırda düzenlemeye yardımcı olabilir misiniz lütfen?
Kod:
<modification>
<id><![CDATA[special-promo-image]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[2.1.6]]></vqmver>
<author><![CDATA[All Rights Reserved-BIDatw.com]]></author>
<file name="catalog/view/theme/*/template/module/special.tpl" >
<operation>
<search position="after"><![CDATA[
<?php if ($product['thumb']) { ?>
]]></search>
<add><![CDATA[<div>
<div class="specialPercent" style="background: url('../image/promo3.png') no-repeat;
width: 50px;
height: 46px;
text-align: center;
color: #fff;
font-weight: bold;
padding-top: 15px;
text-shadow: 0 -1px 1px #CE5016;
position: absolute;
float: right;
font-size: 14px;">
<?php
//Get Currency Symbol
$symLeft = $this->currency->getSymbolLeft();
$symRight = $this->currency->getSymbolRight();
if($symLeft != NULL){
$currCode = $this->currency->getSymbolLeft();
}else{
$currCode = $this->currency->getSymbolRight();
}
//Get the percentage discount
$normal = strip_tags(str_replace($currCode,'', $product['price']));
$normalP = strip_tags(str_replace(',','', $normal));
$special = strip_tags(str_replace($currCode,'', $product['special']));
$specialP = strip_tags(str_replace(',','', $special));
$percent = ($normalP-$specialP)/$normalP*100;
echo round($percent) . $this->language->get('text_off');
?>
</div>
</div>]]></add>
</operation>
</file>
<file name="catalog/language/*/module/special.php">
<operation>
<search position="after"><![CDATA[
<?php
]]></search>
<add><![CDATA[
$_['text_off'] = '%</small><br>';
$_['text_left'] = '<span class="left">left</span>';
]]></add>
</operation>
</file>
<file name="catalog/controller/product/category.php">
<operation>
<search position="after" index="1"><![CDATA[
$this->data['products'][] = array(
]]></search>
<add><![CDATA[
'ozel' => $special,
]]></add>
</operation>
</file>
<file name="catalog/controller/product/category.php">
<operation>
<search position="after" index="1"><![CDATA[
'thumb' => $image,
]]></search>
<add><![CDATA[
'thumb_etiket' => ($special)?$this->model_tool_image->resize('promo3.png', 240, 240):null,
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/product/category.tpl">
<operation>
<search position="replace"><![CDATA[
<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>"
]]></search>
<add><![CDATA[
<?php if ($product['thumb_etiket'] != null) { ?><img style="position: absolute; pointer-events: none; " title="" alt="" /><?php } ?>
<div>
<div class="specialPercent" style="background: url('../image/promo3.png') no-repeat;
width: 50px;
height: 46px;
text-align: center;
color: #fff;
font-weight: bold;
padding-top: 15px;
text-shadow: 0 -1px 1px #CE5016;
position: absolute;
float: right;
font-size: 14px;">
<?php
//Get Currency Symbol
$symLeft = $this->currency->getSymbolLeft();
$symRight = $this->currency->getSymbolRight();
if($symLeft != NULL){
$currCode = $this->currency->getSymbolLeft();
}else{
$currCode = $this->currency->getSymbolRight();
}
//Get the percentage discount
$normal = strip_tags(str_replace($currCode,'', $product['price']));
$normalP = strip_tags(str_replace(',','', $normal));
$special = strip_tags(str_replace($currCode,'', $product['special']));
$specialP = strip_tags(str_replace(',','', $special));
$percent = ($normalP-$specialP)/$normalP*100;
echo $this->language->get('text_off') . round($percent) ;
?>
</div>
</div>
<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>"
]]></add>
</operation>
</file>
<file name="catalog/language/*/product/category.php">
<operation>
<search position="after"><![CDATA[
<?php
]]></search>
<add><![CDATA[
$_['text_off'] = '<small>%</small>';
$_['text_left'] = '<span class="left">left</span>';
]]></add>
</operation>
</file>
</modification>