Implementing Views with Arguements in Nodes

Events happening in the community are now at Drupal community events on www.drupal.org.
jaysonragasa's picture

Hi guys... It's my 2 weeks in Drupal and am doing a project which was called "Market Price Watch".

Here in our local city, we have a buy and sell site which I do not own.. most of the sellers put an overpriced item and the admin have no control with it.. (I mean he cannot say to sellers to lower their prices base on the current prices of the gadgets)

So I want to have a partnership with the owner and encourage our local Gadget and Cellphone store to register in my site so the Owner of the Buy and Sell site could put a link into my website for Updated Gadget and Cellphone price tags.. This will help buyers to know that a seller is selling an overpriced item.

My intentions are good but I just couldn't move on due to, I think for you is a simple problem.. but me, it's not. Am not a great English writer so please bear with my sentences and words.

So basically, I want the User be a Store, and their Username is the machine_readable_name.. I could just put a Store Name field in CCK. Registering is by request though so I could make the own Store Page(node)

This store has, of course, a (let's say a simple) products.. Cellphones, Gadgets, or Computers.. So I want to have Product Name, Description, Image, Current Price, and Date Updated fields. Those were all done in CCK :)

I have also made a View in another node to show the latest price update.

The problem comes in when I want show the Store's products in their Store Page (node). The view am using in Store Page is just a clone from the Latest Price Update view.. but this one for Store Page is different because I just want to show the store's products.. I called it "Store_Page_View" So I added a Page Display and in Path, I just change it to "Node/8" So I could just view the sample in that node.. Then I added an Argument using User's UID and PHP Code in "Provide default argument"

my PHP Code is this

<?php
$node
= node_load($user->uid);
return
$node->uid;
?>

So I checked out the the page Node/8 and I was happy to the result! Now I want to show this views with php arguments in different Store Pages so I changed the path from "Node/8" to "Node/%" then I checked out Node/8 page again and it was gone! just a simple change in path, the view was gone? I couldn't even see that in different Store Pages..

Deleting the argument and setting the Path to "Node/%" works in every Store Page but of course.. all products from different stores appears!

Am seeking for help and assistance to make this work..

Please be kind when giving a code, please let me know where to put them. What file or which part.

Comments

You can't use Views to

merlinofchaos's picture

You can't use Views to override the node page. It doesn't actually work right, and it's not something that works. Maybe what you want to do is use views_attach to attach a view to a node. That's probably more in the spirit of what you're trying to accomplish.

Thanks merlinofchaos. Will

jaysonragasa's picture

Thanks merlinofchaos. Will try this one. Does Views Attach module works when I added an Argument into my View? about this "It doesn't actually work right, and it's not something that works" I have a View called "Latest_Price_Update" and this view shows all the latest price update and it's in my "Node/6" and it has no problem showing those items in views?

Overriding an individual node

merlinofchaos's picture

Overriding an individual node can work okay, because it's just one page. It's overriding node/% that can't work. THough when you override just one node, it will never mark the node as having been read.

Thanks for enlightening me

jaysonragasa's picture

Thanks for enlightening me

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: