3

I've created a content type: seller and with pathauto module I've set this content type to be seller/[node:title] so every new seller content will be www.example.com/seller/[name_of_the_seller].

I want to add gmap objects in every seller page with only their objects will be visible. (for this detail I'll open a new thread, 'cos I'm not sure how to filter that)

With Views module I've added a page with url: /seller/%

and in contextual filters I've added Content: Nid. In When the filter value is NOT in the URL I've selected Provide default value and in the field bellow I've put seller. That didn't worked, so I've tried with Raw value from URL and checked Use path alias. That didn't worked too. I've searched couple of other threads, but I didn't find like my problem.

UPDATE

I've solved the problem by creating a block that is displayed seller/*. The two content types has a same taxonomy terms and with contextual filters Content: Has taxonomy term ID, Provide default value, Taxonomy term ID from URL, I've marked Load default filter from node page, that's good for related taxonomy blocks and Limit terms by vocabulary and I've selected the seller taxonomy.

1
  • Could you please explain in real world terms what you are trying to acomplish. I think you are misunderstanding how a contextual filter works.
    – Triskelion
    Commented Jun 28, 2013 at 16:07

2 Answers 2

2

Since your contextual filter is expecting an nid (you said your contextual filter is set up as 'Content: Nid') - you really have to provide it with an nid even when that filter is not present in the URL. You can't give it 'seller' as an argument or anything like that because that's not an nid, so it won't help it pull up the correct node.

So to get it to work in those cases, what you really want for your view to do is grab the nid of the current node it appears on. It's OK if that page has a custom URL, the nid can still be gotten.

Just select 'Content ID from URL' as the default value when an URL argument doesn't exist! That'll work even if it has a custom alias for the URL.

3
  • Thank you for your comment, Boriana. I've tried that too before, but it didn't worked. In my view page the path is seller/% and Configure contextual filter: Content: Nid with option Provide default value/Content ID from URL. Is that correct, or I'm missing something? Commented Jun 28, 2013 at 20:08
  • I feel like I'm going in wrong direction. My idea is to display gmaps in every seller page with only objects created by the user. I've managed to do that in their user page like this: a views page with path: user/% and contextual filters Content: Author uid / Provide default value: User ID from logged in user. In their user page there is a gmap with object created from user and is working great. Is this possible to do in every sellers page? I know it's difficult to explain well, but if you some suggestion, I'll try to add more details about my idea. Commented Jun 28, 2013 at 20:29
  • Perhaps one easy way to do that would be if you include the seller's uid in the custom path you've made for the seller's pages. Then you can use the 'Raw value from URL' and specify to use the 2nd, 3rd or whatever path portion the uid is embedded in. Then the view will use the correct uid when you place it on a seller's page. Would that work? Commented Jul 1, 2013 at 22:49
0

I've solved the problem by creating a block that is displayed seller/*. The two content types has a same taxonomy terms and with contextual filters Content: Has taxonomy term ID, Provide default value, Taxonomy term ID from URL, I've marked Load default filter from node page, that's good for related taxonomy blocks and Limit terms by vocabulary and I've selected the seller taxonomy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.