Datafeedr Support Forums

Datafeedr Support Forums (
-   Questions (
-   -   redirect product pages to the parent category instead (

dhilditch August 24th, 2012 12:07 PM

Hi Eric,

Thanks for your help - that did the trick.

I have another question - We don't send users to the product description view although we ARE using the product description view to enable likes on facebook.

What I would really like to do, is if someone clicks a link from facebook, they will land on the product detail page - what I want to do is redirect them to the parent category instead.

I understand that each product can have multiple categories but is there a shortcode that returns these categories?

1) I can modify the php file to check the referred field and not perform this redirect for facebook robot
2) On the category page, I will know which product the redirect came from and then scroll the user to that product and highlight it.

Any help appreciated.


Eric August 24th, 2012 01:02 PM


You can use the following PHP function to get the relative URL of the category page (substitute my category ID 591459 with yours):

PHP Code:


This returns something like:



dhilditch August 29th, 2012 09:48 PM

Is there a similar function which will accept a productid and take me to (any of) the parent category?

Eric August 29th, 2012 10:07 PM


If you have the product ID, you will already have the category ID to pass to that function. The product's category ID can be found using this variable:

PHP Code:


Here's all of the possible variables of the $product object:


All times are GMT -5. The time now is 06:59 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.