O
O
Oleg Korolenko2017-10-31 11:54:43
PHP
Oleg Korolenko, 2017-10-31 11:54:43

How to display variable among php properties?

Here is a code that displays an inscription near the basket .. that is, it decides what to display, product, product or product ..

<span class="quantity"><strong><?php echo $cart_count_products; ?> <?php echo \Custom\Helper\CommonHelper::pluralize($cart_count_products, 'товар', 'товара', 'товаров'); ?></strong> на</span>

I'm doing a translation.. I
write the translations in variables and display them in this way. It follows:
<?php echo $this->language->get('переменная'); ?>
<span class="quantity"><strong><?php echo $cart_count_products; ?> <?php echo \Custom\Helper\CommonHelper::pluralize($cart_count_products, '<?php echo $this->language->get('переменная1'); ?>', '<?php echo $this->language->get('переменная2'); ?>', '<?php echo $this->language->get('переменная3'); ?>'); ?></strong> на</span>

But this gives an error, and the site crashes)
How to output correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2017-10-31
@legoex

<span class="quantity">
<strong>
<?php echo $cart_count_products; ?>
<?php echo \Custom\Helper\CommonHelper::pluralize(
  $cart_count_products,
  $this->language->get('переменная1'),
  $this->language->get('переменная2'),
  $this->language->get('переменная3')
); ?>
</strong>
</span>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question