If you use the Shopp plugin for WordPress, you’ve likely found something frustrating: you click on the “Edit Post” link, and you get to edit the Store page, not the product in Shopp.
Here’s a quick fix: add the following to your theme’s functions.php file:
function edit_product_link($link = 'Edit Product', $before = '', $after = '') {
global $post, $Shopp;
if ( $post->post_type == 'page' ) {
if ( !current_user_can( 'edit_page', $post->ID ) )
return;
} else {
if ( !current_user_can( 'edit_post', $post->ID ) )
return;
}
if (shopp('product','found')) {
$page = 'shopp-products-edit';
$id = shopp('product','id','return=true');
}
$url = admin_url("/admin.php?page=$page&id=$id");
$link = '<a title="' . attribute_escape( __( 'Edit product' ) ) . '" href="'.$url.'">' . $link . '</a>';
echo $before . $link . $after;
}
Then add edit_product_link() into your template, and you can edit products directly from your website. Woot!.
