MediaPicker in Taxonomies

Mar 21, 2012 at 11:23 AM
Edited Mar 21, 2012 at 11:39 AM

You cannot browse using mediapicker in Taxonomies since it does not contain "/admin/" in the url. 

Quick fix, need to change the line in Orchard.MediaPicker/Scripts/MediaPicker.js

var�adminIndex�=�
location.href.toLowerCase()
.indexOf("/admin/")

to

var locationHref = location.href.toLowerCase();
        var adminIndex = locationHref.indexOf("/admin/");
        var taxIndex = locationHref.indexOf("/taxonomies/");
        if (adminIndex === -1 && taxIndex === -1) return;
        if (adminIndex === -1) {
            adminIndex = taxIndex;
        }

No idea what I did to this post..

Mar 27, 2012 at 11:49 AM

Some advice, next time copy/paste to notepad (or any other regular text editor), and copy/paste that in here.

Should get rid of all the 'markup' ;)

Apr 23, 2013 at 4:48 AM
Hey Hazza!

Can we revisit this topic? My goal is to, via a custom controller, display a list of product categories by which the user can "drill down" to product sets by clicking on a category (parent term), then subcategory (child term), and the product item itself.

I wanted to attach a mediapicker field to the TermPart so that I can display this category image. Do you get what I am looking for?

You're saying it's impossible to attach a mediapicker to a taxonomy?
Apr 23, 2013 at 10:48 AM
Nope this is perfectly possible, I was just pointing out a discrepancy between MediaPicker requiring /admin/ in the Url and Taxonomies not providing this. I'm not sure if this is still the case, but I would assume so. All you need to do is make the suggested change above, or a better one if you have such, and you will be good to go :)