Archives for 

Tutorial

How to Add an `Edit Product` Link for Interspire Shopping Cart

Why can’t I just click a link to edit the product I’m viewing?

Interspire, I love ya, but the Interspire Shopping Cart has some silly omissions. Like a simple “Edit Product” link if you’re logged in as an administrator. Instead, you have to go to the backend, search for the product, then edit it…which takes a solid 20 seconds.

Well, I got tired of that, so here’s a way to generate a proper Edit Product link.

Part 1: Generate the link

In includes/display/ProductDetails.php:

Find $this->SetProductVariations();. Add this in a line below it:

$this->SetEditProductLink();

Add this following code just before the last, closing curly bracket in the file }

/**
 * Create a link to allow users with permission to edit products from the products page
 */
public function SetEditProductLink()
{
	$GLOBALS['EditProductLink'] = '';
	if(!isset($GLOBALS['ISC_CLASS_ADMIN_AUTH'])) { $GLOBALS['ISC_CLASS_ADMIN_AUTH'] = GetClass('ISC_ADMIN_AUTH'); }
	if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Products)) {
		$GLOBALS['EditProductLink'] = sprintf('<a title="%3$s" class="Action" href="'.$GLOBALS['ShopPath'].'/admin/index.php?ToDo=editProduct&productId=%2$d">%1$s</a>', 'Edit Product', $GLOBALS['ProductId'], "Edit product ‘{$GLOBALS['ProductName']}’" ;
	}
}

Part 2: Place the link

Now the link will be generated in the global variable EditProductLink in your template’s ProductDetails panel.

  • Go to your template
  • Find Panels/ProductDetails.html
  • Add %%GLOBAL_EditProductLink%% to your template where you want the link. I like it after the add to cart button (%%SNIPPET_ProductAddToCart%%).
  • You’re all set!

Lots of time saved by all…

Hopefully this helps save you some frustration while polishing your Interspire store.

Related posts:

  1. Preview Hidden Products in Interspire Shopping Cart
  2. Add ‘Customers Also Purchased’ to the Cart Page on Interspire Shopping Cart
  3. Improve Interspire Shopping Cart Search with Smart Redirections