Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Questions (http://www.datafeedr.com/forums/forumdisplay.php?f=67)
-   -   redirect product pages to the parent category instead (http://www.datafeedr.com/forums/showthread.php?t=7546)

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.

Thanks!

Eric August 24th, 2012 01:02 PM

Hi

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:

dfr("url")->query_to_url('view=category&c=591459'

This returns something like:

/store/category/shoes/

Eric

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

Hi

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:

$product->cat_id 

Here's all of the possible variables of the $product object: http://www.datafeedr.com/forums/show...1079#post31079

Eric


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.