Content Relating to content addon

Permalink 1 user found helpful
I am building a portfolio site where I want pieces to be related to each other. For example if you go into a detail page a piece, at the bottom you may see something like, "You may also like this piece in this collection." - similar to what you get on amazon.

Thanks for the help.

Luan

View Replies:
jordanlev replied on at Permalink Reply
jordanlev
Are you looking for something that automatically determines what's related, or just a way to manually put in your own related links?

If the former, nothing exists to do this in the C5 world. I know there's a wordpress plugin or feature that does this but I've honestly never found it to really be worthwhile -- it just kind of does a blind word matching thing and the content is never really that related.

If you just need a way to denote related content on your own, just add a content block to the sidebar and insert some links to other pages in the site.

-Jordan
wagdi replied on at Permalink Reply
wagdi
luan replied on at Permalink Reply
Thanks for the help guys. Jordan, I am looking for something I can manage, But I don't want to go into every piece and enter in their relation to other pieces, that would take way too long. So I picture setting up a category and marking this piece is in this category and simply dumping that category as the relation. So if a piece is a painting and drawing, it will be placed in related work in the bottom as both painting and drawing. Not sure if I made sense.

Thanks Wagdi, I'm not looking for anything ecommerce, but the random block seems really cool and useful.
jordanlev replied on at Permalink Reply 1 Attachment
jordanlev
Here, try this. You will need to create a page attribute with the handle "related_content_category" (name it whatever you want, I used "Related Content Category"), and it must be a "select" attribute. Make it so multiple selections are allowed.

After you add the attribute, go to some pages in the site, edit them, click the "Properties" button, click the "Custom Attributes" tab, and add the "Related Content Category" from the "**Add Attribute**" dropdown menu. Then check a box or two for which category it's in.

After you have a few pages put into a category, go to another page and add this block. In the edit dialog, choose the category you want, and the related content pages (the ones you checked the appropriate category for up above) should appear in the list.

If it works for you, let me know -- would be nice to throw this up on the marketplace (would want some testing first though).

-Jordan
luan replied on at Permalink Reply
Thank Jordan. I will give this a try and let you know.
cannonf700 replied on at Permalink Reply
cannonf700
Jordan,
where do you put this file? If I put it in the Packages folder nothing happens and if I put it in the blocks folder I get an error message that renders my site useless until I delete the block out of the folder...

Thanks,
Ryan
12345j replied on at Permalink Reply
12345j
put it in root/models/attribute/types
jordanlev replied on at Permalink Reply
jordanlev
This is just a block, not a package (and not a model/attribute/type thing -- I think 12345J got this confused with something else).

What you have to do is put it in YOURSITE/blocks/ (not in YOURSITE/packages and not in YOURSITE/concrete/blocks/). But note that sometimes when you unzip this is might get unzipped into 2 nested folders -- you want to make sure that the folder you put in your blocks directory doesn't itself contain sub-folders -- it should just be a folder called "related_content", and inside that folder should be some files (add.php, auto.js, controller.php, etc.).
MathiasB replied on at Permalink Reply
MathiasB
Dear Jordan,
I did exactly what you wrote... But I still cannot insert the block into a page. The folder is located in mysite/blocks and it has no subfolders. I cleared the cache and refreshed the database.. Do you know what's wrong?

Best
Mathias
MathiasB replied on at Permalink Reply
MathiasB
Dear Jordan,
I did exactly what you wrote but the block is not shown in the list...
Do you know, what could be wrong?

Best Mathias
MathiasB replied on at Permalink Reply
MathiasB
Sorry!!!!
I found out the way to display that block...
But I have another question now:
Could this function be hardcoded in a template?

I am building a site for some lectures with several professors.

Under the personal data of a professor, I would like to display a list with the lectures of that professor.
And under every abstract of a lecture I would like to display the name of the professor.

I think, there must be a way to do that by filtering attributes.

Best Mathias
Domb182 replied on at Permalink Reply
I needed to have a link to a specific brand on each "product" page. Nice one Jordan - this is exactly what I needed. Great package!
RadiantWeb replied on at Permalink Reply
RadiantWeb
http://www.concrete5.org/marketplace/addons/related-pages/
admin replied on at Permalink Reply
jordanlev:
This is awesome. Thanks for posting this! It's almost exactly what I'm looking for in this thread:
http://www.concrete5.org/community/forums/customizing_c5/how-do-i-a...

What would it take to add a page type selector to this block? This way I could select Page Type = "Patent" (or "** All **") and also select the related content value.
jordanlev replied on at Permalink Reply
jordanlev
It's been a while since I wrote that -- I think to add a page_type selector you'd add a field for collectionTypeHandle to the db.xml file, then add a dropdown menu to the edit.php file so users can choose that (look through the collection_type model in the concrete/models directory for a function that will list all page types). Then in the controller where it's using the PageList API query stuff, add a filter for CollectionTypeHandle.

(In case you weren't aware, the terms "page" and "collection" are for the most part interchangeable in the C5 API, so "collection type handle" means the same thing as "page type handle" for example).

Good luck!
waynethorley replied on at Permalink Reply
ah! wish I would have found this thread before. It would have saved me several hours. I ended up doing it this way...

$pl = new PageList();
    $pl->sortBy('cvDatePublic', 'desc');
    $pl->filter('p1.cID', $c->getCollectionID(), '!=');
    $categories = explode("\n", $c->getCollectionAttributeValue('categories'));
    $query_parts = array();
    foreach ($categories as $cat) {
        $query_parts[] = "'%\n".$db->escape($cat)."\n%'";
    }
    $catQuery = implode(' OR ak_categories LIKE ', $query_parts);
    $pl->filter(false, '(ak_categories LIKE '.$catQuery.')');


not sure if it's the right way to go about it...
bridgetdesigns replied on at Permalink Reply
Thank you so much for this! I am making a biography site and needed a way to list pages by category. Brilliant.