Edit Product Link for Shopp Plugin

Shopp PluginIf 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!.

Author: Zack Katz

Zack Katz is the President of Katz Web Services and the developer of WordPress plugins with over 700,000 downloads. He lives in Southwest Colorado with his wife and two cats.

6 thoughts on “Edit Product Link for Shopp Plugin”

  1. Has anyone else had problems ordering the Shopp Plugin?

    I recently placed an order for the Shopp Plugin based on reviews I’ve seen but ran into a problem during the order. Though my payment went through on PayPal, the Shopp site wouldn’t let me download the plugin. It says “awaiting payment.”

    I tried to go through the company’s support process with no success. Jonathan Davis responding to my support request initially, but now will not respond. I would have liked to use the plugin, but since I can’t even place a successful order for it and download it, I wonder if it doesn’t work very well for virtual/downloadable products. Now I have to go through the hassle of PayPal dispute resolution to try to get Ingenesis Limited to give me my money back.

    1. It would seem that shopp('product','found') didn’t find a product for you….

      I would try this:

      if (shopp('product','found')) {
      	$page = 'shopp-products-edit';
      	$id = shopp('product','id','return=true');
      }
      // Add the following code:
      elseif($Shopp->Product) {
      	$page = 'shopp-products-edit';
      	$id = $Shopp->Product->id;
      }

      I’ve had no problems with the original code, but that should help your issue…Let me know!

  2. Well, for some stranges reasons your firs code seems working for me now, thank you very much and I hope you’ll publish some others good tips about Shopp !

  3. Hey experts, I have a question maybe you can help with. Shop seems to be putting the products in a Alpha or Numeric list order by title. This is kinda/very cheesy, does anyone know how to edit the order in which the products show?

  4. Hey experts, I have a question maybe you can help with. Shop seems to be putting the products in a Alpha or Numeric list order by title. This is kinda/very cheesy, does anyone know how to edit the order in which the products show?

Leave a Reply

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