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

This entry was posted in Shopp, WordPress and tagged , , , , , . Bookmark the permalink.
  • Tim Smith

    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.

  • http://www.molusk.net Anthony

    Good idea, but it doesn’t work for me… The link returns me an url like this : http://www.molusk.net/wp-admin/admin.php?page=&id= and when I click on the link, WordPress said me that I’m not allowed to access to the page (I’m logged in as administrator…).

    • http://www.seodenver.com Zack Katz

      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!

  • http://www.molusk.net Anthony

    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 !

  • http://fiswebdesign.com Aaron Hemmelgarn

    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?

  • http://fiswebdesign.com Aaron Hemmelgarn

    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?