Hi all, I am new to Umbraco and also Razor, so please excuse my lack of knowledge, I have a lot to learn.
So far, I have managed to put together a site where a user can easily upload a product into a number of pre-defined categories (shown below, seating, lighting etc). The items are displayed in a gallery style grid, where each item is also clickable and has its own child page with extra info. Each category is a page in itself, e.g this is the "tables and desks" test page:
This part is all working fine, hoorah! But now I'm stuck..
Now I would like to add two extra pages, a "new stock" page, and a "sold" page. I would like the "new stock" page to display six of the most recently uploaded items in the same gallery format as the above page. It needs to gather items from all categories, is this possible? If so, how would I go about doing this? My content structure is here:
Secondly, I'd like each item to have a "sold" checkbox in the CMS for the user to tick when he has sold an item. The item will then be transferred to the "sold" page, and again displayed in the gallery format.
Thank you in advance for any advice on this! Am happy to post any code on request :).
Apologies for the delayed response, and thank you for your answer!!
I have only just managed to get this working (I haven't had much free time), it's nearly doing what I want, it's showing the 6 newest item categories in my gallery format.
However I require it to go one page deeper and get the latest actual item from each category.. If it is easier I can have it gather the latest 2 items per category, rather than the latest 6 items uploaded to the whole site, if that makes sense!!
I'm guessing I need some sort of child of children statement?!
Worth considering too as your stock inventory grows - it will be faster to grab the appropriate items from the Examine index rather than traversing the content tree.
Gather newest items and display on separate page
Hi all, I am new to Umbraco and also Razor, so please excuse my lack of knowledge, I have a lot to learn.
So far, I have managed to put together a site where a user can easily upload a product into a number of pre-defined categories (shown below, seating, lighting etc). The items are displayed in a gallery style grid, where each item is also clickable and has its own child page with extra info. Each category is a page in itself, e.g this is the "tables and desks" test page:
This part is all working fine, hoorah! But now I'm stuck..
Now I would like to add two extra pages, a "new stock" page, and a "sold" page. I would like the "new stock" page to display six of the most recently uploaded items in the same gallery format as the above page. It needs to gather items from all categories, is this possible? If so, how would I go about doing this? My content structure is here:
Secondly, I'd like each item to have a "sold" checkbox in the CMS for the user to tick when he has sold an item. The item will then be transferred to the "sold" page, and again displayed in the gallery format.
Thank you in advance for any advice on this! Am happy to post any code on request :).
Hi
Will try to be simple and point you in the right direction - you may have to play with it a bit . . .
New Stock
For Sold - add a property of Sold to your doctype of type "True/False". Then use the above code but add a Where statement.
ie - .Where("sold" == "true") the exact order you can determine. Probably OrderBy then Where then Take.
As said, this is not a perfect answer, but all is possible just need to get the properties correct.
Hope it helps
G
Hello,
Apologies for the delayed response, and thank you for your answer!!
I have only just managed to get this working (I haven't had much free time), it's nearly doing what I want, it's showing the 6 newest item categories in my gallery format.
However I require it to go one page deeper and get the latest actual item from each category.. If it is easier I can have it gather the latest 2 items per category, rather than the latest 6 items uploaded to the whole site, if that makes sense!!
I'm guessing I need some sort of child of children statement?!
Thanks in advance for any help :)
Hi Milly
Can you post some code?
Will be easier to help.
Regards
Gary
Hello,
I have managed to figure out a solution which works, however I have resorted to using Umbraco.Content("id").. is there any downside to using this?
This is my working code:
Now for the "sold" page..
Thanks!
Hi again,
Just a heads up that I've managed to get all of the pages working as I'd liked, so thank you very much for your help, much appreciated!
M
Worth considering too as your stock inventory grows - it will be faster to grab the appropriate items from the Examine index rather than traversing the content tree.
is working on a reply...