the store needed to withdraw 2 prices, in the current currency and in the "denominated" side by side. In the basket, it turned out to be done, but there is no source in the product card

if ((int)$params->get('summa_show', 1)) { echo '<p class="uk-margin-remove"><span class="price-total-value uk-text-small">' . $zoo->jbmoney->toFormat($summa, $currency) . '</span></p>'; } 

shopping cart with two prices works

 if ((int)$params->get('summa_show', 1)) { echo '<p class="uk-margin-remove vitaly-go-price"><span class="price-total-value uk-text-small">' . $zoo->jbmoney->toFormat($summa, $currency) . '</br><i>&nbsp;' . ($summa / 10000) . 'руб.</i></span></p>'; } 

product card original

 <?php if ($discount[ 'value']==0 ) : ?> <span class="total uk-text-bold"><?php echo $base['total']; ?></span> <?php endif; ?> 

product card does not work

 <?php if ($discount[ 'value']==0 ) : ?> <span class="total uk-text-bold"><?php echo $base['total'] / 10000; ?></span> <?php endif; ?> 

As a result, a significantly lower value is displayed in the product card than is necessary, for example, the original price of 2561000 rubles. price after incorrectly dividing 0.0002 price required 256.1р. and besides incorrect division disappears and "p." how to fix it I can not find the problem

  • Looks you share 2 times. Once somewhere on the code and the second in the template. - E_p
  • one
    No, this is not the case, I came to the conclusion that only 1 digit falls under my division, that is, if the price is 6,321,000 rubles, only 6 are divided, and then there is a space and after it all the other symbols do not fall under the division. In fact, I do not share the price from the price, but the price that is already processed than at the time of the addition of spaces "for beauty". - Vitaly Kachan

1 answer 1

You are trying to divide the string into a number. Ideally, you should divide the original unformatted price.

If that doesn't work, use this code.

  <?php if ($discount[ 'value']==0 ) : ?> <span class="total uk-text-bold"><?php echo str_replace(' ', '', $base['total']) / 10000; ?></span> <?php endif; ?>