Post by dunnbombat » Sun May 03, 2020 11:37 pm

Hi,

I'm just wondering if there is a way to place custom $price in plain numbers (not using database) that will change when currency changed accordingly?

I have solution for the currency symbol: <?php echo $text_currency; ?> It will change currency symbol accordingly by currency selected.

But I don't have solution for the plain numbers. I don't want to mess with database cause it can cause issues with my current modules. I want to add printing price in product.tpl (catalog/view/theme/template/product) that are the same on every product, but would change accordingly by currency selected.

My code looks like this:

Code: Select all

              <tr style="flex-basis: 33.33333333%; display: flex; flex-wrap: wrap; align-content: flex-start; float: left; width: 33.33333333%;">
                  <td style="flex-basis: 100%; white-space: nowrap;">Printing*</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>10.25</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>9.23</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>8.82</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>8.41</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>8.00</td>
                  <td style="flex-basis: 100%;"><?php echo $text_currency; ?>7.59</td>
              </tr>
Any bright mind can help me out with this? Any shortcut to this without adding values to phpmyadmin, editing controller etc.?
Last edited by straightlight on Mon May 04, 2020 12:56 am, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Sun May 03, 2020 11:30 pm

Post by straightlight » Mon May 04, 2020 2:08 am

Instead of using a 100% each rows, simply divide the numbers to the closest integer range and add the total row percentage on the top instead of using 33.33333333% . Alternatively, you could try with CSS.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dunnbombat » Mon May 04, 2020 5:11 am

It's 1/3 part of the code and it's not important

I try explain: "<?php echo $text_currency; ?>" this line anywhere in catalog/view/theme/default/template will add currency symbol which will change when store currency is changed. You select dollars it shows $, you select euros it shows €

I want: "<?php echo $text_currency; ?>10.25" that number 10.25 would be treated as $price and would be transformed to another currency.

The way to make it is to create vqmod module, edit controller etc add values to database and get what i want. I only need 5 numbers (printing price) that would be same on all product pages and would change accordingly to set currency rate when currency in store is changed.

Newbie

Posts

Joined
Sun May 03, 2020 11:30 pm
Who is online

Users browsing this forum: No registered users and 382 guests