Forum

Thread tagged as: Question, PayPal

Shop Paypal category_slugs

Hi I am trying to get the product's category to pull to the product.php page. I have added the category_slugs call to the template and it shows and works, until the product is added to two categories, then it combines the categories in the link. How can I get it to publish separate links for each category listed?

https://creative-timbers-furniture-hereford.co.uk/shop/product.php?s=wooden-coat-rack

Thanks Tony

Tony Brooks

Tony Brooks 0 points

  • 6 years ago

Quick update, updated to latest version to see if I could use the Categories templates. Now when I try and save a listing in the back end I get a blank screen!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Here's the error log:

[Tue Sep 08 17:20:51 2015] [error] [client 212.159.151.34] PHP Fatal error: Call to a member function return_instance() on a non-object in /var/www/vhosts/creative-timbers-furniture-hereford.co.uk/httpdocs/perch/core/lib/api/PerchAPI_Form.class.php on line 423, referer: https://creative-timbers-furniture-hereford.co.uk/perch/addons/apps/perch_shop/edit/?id=1

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you updated any installed apps?

I have now. Sorted the white screen issue, thanks. Now back to the category links...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, what's the current issue?

When I pull the tag 'category_slugs', a product in multiple categories will have the link set with all the slugs combined:

<a href="category.php?cat=bespoke-furniture shop">Bespoke Furniture, Shop</a> 

Is there a way to pull them as separate links? You can see the site here:

https://creative-timbers-furniture-hereford.co.uk/shop/product.php?s=wooden-coat-rack

Thanks Tony

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think in the old PayPal app you need to use perch_shop_product_categories() in order to template the individual categories.

Is that as an id?

~~ <perch:shop id="perch_shop_product_categories()" /> ~~

P K

P K 0 points

Tony, I had the same issue, so can help.

In your product.php page, add the following...

<?php

perch_shop_product_categories(perch_get('s'), 'my_category_links.html');

?>

And in your custom 'my_category_links.html' template (in perch/templates/shop), you'll have something like this...

<li><a href="category.php?cat=<perch:shop id="categorySlug" />"><perch:shop id="categoryTitle" /></a></li>

perch_shop_product_categories() is nowhere to be found in the documentation, but is very useful. Critical actually for bringing category information into the product page.

If you're still having issues after doing the above, then it's back to Drew :-)