Where Does Custom Order Data Show on Orders in Shopp?

I’ve covered a bunch of topics in the past about how to customize Shopp in the past few months.  They’ve all been about how to do things that are externally facing on the website to date and today I am going to talk about where to find the custom order data generated by order-data tags on orders in the Shopp UI in WordPress.

The custom order data tags which I talked about in an article I wrote called “How to Customize the Shopp Checkout.php Template for WordPress” are collected on orders however I’ve found it can be confusing for users as to where this data so I am going to show you where this data is located and how to customize the heading for this section on your orders so that its easier to find.

In order to customize the header of where this custom order data is located on your orders generated by Shopp you’ll need to first locate the ui.php file and download it from your instance of Shopp and WordPress to your computer.  The path to get to this PHP file when you are in your FTP client is /wp-content/plugins/shopp/core/ui/orders/ui.php.  What this file controls is the User Interface for the Orders when you are in the backend of WordPress in Shopp viewing Orders.  Now let’s talk about how you can customize this file to change the header where the data collected by the custom order data tags is shown.  Have a look at the following snippet of code from the ui.php file as a reference.

function orderdata_meta_box ($Purchase) {
$_[] = ‘<ul>’;
foreach ($Purchase->data as $name => $value) {
if (empty($value)) continue;
$classname = ‘shopp_orderui_orderdata_’.sanitize_title_with_dashes($name);
$listing = ‘<li class=”‘.$classname.’”><strong>’.$name.’:</strong> <span>’;
if (strpos($value,”\n”)) $listing .= ‘<textarea name=”orderdata['.esc_attr($name).']” readonly=”readonly” cols=”30″ rows=”4″>’.esc_html($value).’</textarea>’;
else $listing .= esc_html($value);
$listing .= ‘</span></li>’;
$_[] = apply_filters($classname,$listing);
}
$_[] = ‘</ul>’;
echo apply_filters(‘shopp_orderui_orderdata’,join(“\n”,$_));
}
if (!empty($Shopp->Purchase->data) && is_array($Shopp->Purchase->data) && join(“”,$Shopp->Purchase->data) != “”
|| apply_filters(‘shopp_orderui_show_orderdata’,false)) {
add_meta_box(‘order-data’, __(‘Details’,’Shopp’).$Admin->boxhelp(‘order-manager-details’), ‘orderdata_meta_box’, ‘toplevel_page_shopp-orders’, ‘normal’, ‘core’);
}

Look at the line of code “add_meta_box(‘order-data’, __(‘Details’,’Shopp’).$Admin->boxhelp(‘order-manager-details’)” and change ‘Details’ to whatever you want to call this section.  Save it and upload it to your site and you should be all set to view the custom order data collected from your customized Checkout.php page.

Comments

  1. Dustin says

    When I input this code into my ui.php file I receive all types of PHP errors. Can you post the code in text mode so the website doesn’t convert into invalid characters?

Leave a Reply

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.