Jump to content


JReviews is the best selling Joomla Reviews Component and WordPress Reviews Plugin. It's also in a class of its own as a Business Directory.
Photo
- - - - -

Currency option in Restaurant Menu


Best Answer Alejandro , 01 December 2016 - 08:37 AM

Since the structure for the restaurant menu is already setup as an array for each section it wouldn't be possible to add the currency there unless you do it for each section, which doesn't make sense. So the best way is to have a new JReviews custom field where users can choose the currency and then you read the value of that field and use it in the restaurant menu theme where we now have hardcoded the currency as $.

 

Joomla: /components/com_jreviews/jreviews/views/themes/default/fields_phpformat/restaurant_menu.thtml

 

WordPress: /wp-content/plugins/jreviews/jreviews/views/themes/default/fields_phpformat/restaurant_menu.thtml

 

You can access your currency custom field as:

<?php echo $CustomFields->field('jr_menucurrency', $entry);?>
Go to the full post


  • Please log in to reply
5 replies to this topic

#1 Peter Kocsis

Peter Kocsis

    Member

  • Members
  • PipPip
  • 13 posts

Posted 01 December 2016 - 08:06 AM

Hi There,

 

How can I add one more item in Restaurant Menu, where the users can choose a currency for their Menu? I would like to change the current $ sign for the choosen one.

 

Thanks in advance.

 



#2 Alejandro

Alejandro

    Advanced Member

  • Administrators
  • 31940 posts

Posted 01 December 2016 - 08:37 AM   Best Answer

Since the structure for the restaurant menu is already setup as an array for each section it wouldn't be possible to add the currency there unless you do it for each section, which doesn't make sense. So the best way is to have a new JReviews custom field where users can choose the currency and then you read the value of that field and use it in the restaurant menu theme where we now have hardcoded the currency as $.

 

Joomla: /components/com_jreviews/jreviews/views/themes/default/fields_phpformat/restaurant_menu.thtml

 

WordPress: /wp-content/plugins/jreviews/jreviews/views/themes/default/fields_phpformat/restaurant_menu.thtml

 

You can access your currency custom field as:

<?php echo $CustomFields->field('jr_menucurrency', $entry);?>


#3 Peter Kocsis

Peter Kocsis

    Member

  • Members
  • PipPip
  • 13 posts

Posted 01 December 2016 - 09:18 AM

Hi Alejandro,

 

Thanks it would be perfect, but I tried it and is not working for me. This field does not visible in Menu, but I think the set up is correct because I tried to show this field any other place with the above mentioned code and it works. So I don't understand where is the error. 



#4 Alejandro

Alejandro

    Advanced Member

  • Administrators
  • 31940 posts

Posted 01 December 2016 - 09:56 AM

I tried it before when I was replying to make sure that it worked and it did for me. You removed the dollar sign just to make sure that changes to the file are reflected? Can you try the code at the very top of the file, even before the opening <?php tag to see if it works? If still nothing submit a ticket so we can check.



#5 Alejandro

Alejandro

    Advanced Member

  • Administrators
  • 31940 posts

Posted 01 December 2016 - 12:20 PM

I updated my code above with the correct solution which was to use $entry instead of $listing.



#6 Peter Kocsis

Peter Kocsis

    Member

  • Members
  • PipPip
  • 13 posts

Posted 02 December 2016 - 07:06 AM

Thanks, it works properly!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users