Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Ошибка Division by zero in - Opencart 2.x


Recommended Posts

Помогите с ошибкой, в витрине магазина, на товаре со скидкой выдает ошибку: Notice Undefined index: special2 in /home/h001278042/h001278042.nichost.ru/docs/catalog/view/theme/tt_domino1/template/module/octabproductslider.tpl on line 46 Notice: Undefined index: price2 in /home/h001278042/h001278042.nichost.ru/docs/catalog/view/theme/tt_domino1/template/module/octabproductslider.tpl: Undefined index: price2 in 47 Warning: Division by zero in /home/h001278042/h001278042.nichost.ru/docs/catalog/view/theme/tt_domino1/template/module/octabproductslider.tpl on line 48

 

Вот часть кода, отвечаюещёго за это

 

<?php if ((isset($product['is_new']) && $product['is_new']) || $productTab['id'] == "latest_product"):
                                        if($product['special']): ?>
                                            <div class="label-pro-sale">
                        <?php if($product['special']){
                          $a = ($product['special2']);
                          $b = ($product['price2']);
                          $c = round(($a-$b)/$b,2)*100;
                        }?> 
                        <?php if($product['special']){?>
                          <div class="sale-percent"><?php echo $c;?>%</div>
                        <?php }?>
                      </div>

Link to comment
Share on other sites


<?php if($product['special']){
    $a = ($product['special2']);
    $b = ($product['price2']);
    $c = round(($a-$b)/$b,2)*100;
} ?> 

-->

<?php if($product['special']){
    $a = ($product['special2'] ? $product['special2'] : $product['special']);
    $b = ($product['price2'] ? $product['price2'] : $product['price']);
    $c = round(($a-$b)/$b,2)*100;
} ?>

p.s. *овнокод detected

Link to comment
Share on other sites

30 минут назад, Baco сказал:
<?php if($product['special']){
    $a = ($product['special2']);
    $b = ($product['price2']);
    $c = round(($a-$b)/$b,2)*100;
} ?> 

-->

<?php if($product['special']){
    $a = ($product['special2'] ? $product['special2'] : $product['special']);
    $b = ($product['price2'] ? $product['price2'] : $product['price']);
    $c = round(($a-$b)/$b,2)*100;
} ?>

p.s. *овнокод detected

ик и ваш код от нотисов не спасет. isset нужен

  • +1 1
Link to comment
Share on other sites

36 минут назад, Baco сказал:
<?php if($product['special']){
    $a = ($product['special2']);
    $b = ($product['price2']);
    $c = round(($a-$b)/$b,2)*100;
} ?> 

-->

<?php if($product['special']){
    $a = ($product['special2'] ? $product['special2'] : $product['special']);
    $b = ($product['price2'] ? $product['price2'] : $product['price']);
    $c = round(($a-$b)/$b,2)*100;
} ?>

p.s. *овнокод detected

Не помогает

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.