Two column pricing for menu

Support Area Forums Moonrise Two column pricing for menu

Viewing 8 posts - 1 through 8 (of 8 total)
URL to the page in question:
  • Author
    Posts
  • #12429
    Oscar Lutteroth
    Participant

    Hi Bill,

    My menu is for a sushi restaurant and for “Nigiri & Sashimi” it is standard to offer 2 piece and 5 piece pricing. I tried to set this up by hard-coding spaces in the “Item Cost” field for each food entry. In theory it works:

    Link: http://imgur.com/yXetVwV

    You’ll notice though that since the two prices are separated by spaces, the left prices do not align.

    Is there a better way for me to do this so I can maintain a 2 column price structure but have the prices align vertically?

    Thanks in advance

    Additional links for reference are below:

    Food Section in WP Admin: http://imgur.com/o2RAz73
    Edit Food Item View: http://imgur.com/aDVgo5k

    #12434
    Bill Robbins
    Moderator

    Oscar,

    Good question. Since different letters are different widths (a l is narrower than a W), it’s next to impossible to force a couple of columns to line up perfectly using spaces. Really the only way to do that is to create a new price spot in the theme that’s next to the other original one and define a width for it. That would line up the items pretty well without using a table.

    Here’s what you’d need to do to make that happen:

    1. If you’re not editing files on your local computer, then go to the Plugins section and select Add New.
    2. Search for the WP Editor plugin and install/activate it.
    3. Go to the Appearance section and select Theme Editor.
    4. From the list of files and folders on your right, choose the includes folder and then the post-types folder.
    5. Edit the food.php file and find this spot:
      
      <p class="price"><?php echo get_post_meta($post->ID, "_price", TRUE); ?></p>
      
    6. Replace that with this:
    7. Save your changes.
    8. Next also in the includes folder, open the custom-meta-boxes folder and edit the moonrise.php file and find this (line 70):
      
      	$meta_boxes[] = array(
      		'id'         => 'price_metabox',
      		'title'      => 'Price',
      		'pages'      => array( 'food', 'service' ), // Post type
      		'context'    => 'side',
      		'priority'   => 'high',
      		'show_names' => true, // Show field names on the left
      		'fields'     => array(
      			array(
      				'name' => 'Item Cost',
      				'desc' => '',
      				'id'   => '_price',
      				'type' => 'text',
      			),
      		),
      	);
      
    9. Replace that with this:
      
      	$meta_boxes[] = array(
      		'id'         => 'price_metabox',
      		'title'      => 'Price',
      		'pages'      => array( 'food', 'service' ), // Post type
      		'context'    => 'side',
      		'priority'   => 'high',
      		'show_names' => true, // Show field names on the left
      		'fields'     => array(
      			array(
      				'name' => 'Item Cost',
      				'desc' => '',
      				'id'   => '_price',
      				'type' => 'text',
      			),
      			array(
      				'name' => 'Alt Cost',
      				'desc' => '',
      				'id'   => '_right_price',
      				'type' => 'text',
      			),
      		),
      	);
      
    10. Save your changes.
    11. Next go to the Theme Options page and select the Styling tab. Scroll down to the very bottom and add this to the Custom CSS box:
      
      span.right-price { width: 30px; margin-left: 5px; }
      

      and update your settings.

    That should give you a new box where you can add in another price (it’ll appear on the right). Once you’ve added in a few, you may need to change the width or the margin to give them the right spacing.

    Also if you’re using version 1.1.0 or higher of the theme, make sure to disable theme updates so you don’t accidentally overwrite these changes.

    If you have any trouble, let me know.

    Have fun,
    Bill

    #12436
    Oscar Lutteroth
    Participant

    Hi Bill,

    Thanks for the thorough response. I made the edits to the files and to theme options.

    The alt price field is showing up. Link: http://imgur.com/2bal7jz,SVxuiqb,gzzhGAt#0

    On the website though I’m only seeing what is entered in the “item cost” field: http://imgur.com/2bal7jz,SVxuiqb,gzzhGAt#1

    When I look at the source code I see that it’s not outputting the content from “Alt cost” so I don’t believe it’s a styling issue: http://imgur.com/2bal7jz,SVxuiqb,gzzhGAt#2

    I reviewed the code you sent over for all three sections and nothing is jumping out at me. Please let me know if I’m missing something.

    Thanks

    #12437
    Bill Robbins
    Moderator

    If you’re not loading your menu groups via the shortcode, you’ll also have to change the price line in the taxonomy-menu-group.php file too. Also if you’re using the home page menu block widget, you’ll need to edit menu-group-list.php. Sorry to have three spots to edit, but that should catch them all if you’re using version 1.1 or later.

    Let me know if you have any trouble and if possible, send over a link too,
    Bill

    #12451
    Oscar Lutteroth
    Participant

    Hi Bill,

    This might be the problem, I’m actually running version 1.0.8 of the Moonrise theme.

    I replaced the price line in ‘taxonomy-menu-group.php’ but I didn’t see ‘menu-group-list.php’ (which I assume was added in a later version). I edited the price line in ‘layouts > home-menu.php’ but still did not see the price being update on the website so I changed that back to the original.

    Here is a link to the site: http://bit.ly/e2N4nm

    #12453
    Bill Robbins
    Moderator

    Gotcha. In 1.0.8 there was a different home page set-up. You’ll also need to edit the home-menu.php file. In that file though, there that line occurs 10 times, so you’ll need to edit them all. Give that a shot and see if it works for you.

    Let me know if you have any trouble,
    Bill

    #12466
    Oscar Lutteroth
    Participant

    That did the trick Bill. Site looks great, thanks again!

    #12467
    Bill Robbins
    Moderator

    That’s great to hear. If you need anything else, let me know.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Two column pricing for menu’ is closed to new replies.