[SOLVED] How to display custom fields in order page (web displayed)?

edited December 2013 in Shopping Cart plugin
I created a number of product custom fields. They display in the order PDF, but not on the order details page (your-account/?wpcomethod=order&id=1). Order options, on the other hand, show up fine.

How do I get the custom fields to display on that page? Is there a configuration setting, or do I have to edit the templates?

If templates, which one, and where should I place the custom template I create so it wouldn't disappear with the plugin update (please explain the whole directory three - I read some of the previous comments on templating, and couldn't figure out where things go).

Thank you much, and thanks for answering the previous ticket so quickly! :-)

Comments

  • 3 Comments sorted by
  • Vote Up0Vote Down
    Thank you for your post.

    The view order page for the customers currently shows the global custom fields on the order but it doesn't show the custom fields and variations on the items/products down below.

    Customers can currently click the "Save PDF" link at the top to download a PDF order receipt which will contain the custom fields accordingly.

    You can code this into the plugin though and you can use a child theme like you mentioned. You need the latest v1.6.9.4 of the Shopping Cart plugin to use the child theme functionality though.

    Take the "wp-content/plugins/wp-checkout/views/default/orders/view.php" file and copy it over to "wp-content/themes/*wordpresstheme*/checkout/orders/view.php" where *wordpresstheme* is the folder name of your current WordPress theme that you are using. So checkout/ is the child theme of the plugin's wp-checkout/views/default/

    Best way to add the custom fields is to reference the "wp-checkout/views/email/invoice.php" file in the plugin which is the invoice template file where the custom fields are output in a table format.

    Let me know if this helps and if you need assistance with this.
  • Vote Up0Vote Down
    Hmmm... To the best of my knowledge, I got the right code from invoice.php, but when I paste it into the new template (I checked by entering some extra characters, and the correct file is called up), nothing happens. Please let me know what I'm doing wrong.
    -------------------------------
    I'm including the previous & following td with content - your system won't allow me to paste the entire new version of product table, it's too long.
    ----------------------------
                        <td><?php echo $item -> id; ?></td>
                        <td><?php echo $wpcoHtml -> link(apply_filters($this -> pre . '_product_title', $item -> product -> title), get_permalink($item -> product -> post_id), array('title' => apply_filters($this -> pre . '_product_title', $item -> product -> title))); ?></td>

                                            <td>
                                                <?php foreach ($order -> fields as $ofield) : ?>
                                                    <?php $wpcoDb -> model = $wpcoField -> model; ?>
                                                    <?php if ($field = $wpcoDb -> find(array('id' => $ofield -> field_id))) : ?>
                                                        <div><strong><?php echo $field -> title; ?><?php echo (!empty($field -> addprice) && $field -> addprice == "Y" && !empty($field -> price)) ? ' (' . $wpcoHtml -> currency_price($field -> price) . ')' : ''; ?>:</strong> <?php echo $wpcoField -> get_value($field -> id, $ofield -> value); ?></div>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </td>

                        <td><?php echo $item -> count; ?></td>
  • Vote Up0Vote Down
    Thanks for clearing up where the child themes are supposed to be placed. Still not sure about the code I'm supposed to copy over, and where in view.php I'm supposed to place it.
This discussion has been closed.