Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ssougnez 93 posts 319 karma points c-trib
    Apr 11, 2018 @ 10:12
    ssougnez
    0

    Create a shallow copy of a page

    Hi everyone,

    I have a pretty simple site structure composed by the root level, then categories, then products. Basically, the home page will display all categories in boxes and display the five first product of each categories. This is pretty easy to do with queries.

    However, some products can appear in multiple categories, therefore, I'd like to copy a page from one category to another but I don't want content editor to be forced to edit both (or more) pages as the content will always be the same between these pages. So I was wondering if a shallow copy option exist to just put the reference of a page somewhere else in the structure. This way, the content editor do this shallow copy and edit just the main version of the page to update all the other as well.

    Thanks

  • Daniel Chenery 119 posts 465 karma points
    Apr 11, 2018 @ 21:18
    Daniel Chenery
    0

    I think you might be best with a restructure.

    You're easiest way would be to use the tags property built into Umbraco.

    An alternative way would be to have a "Categories" folder, and a "Category" document type.

    Then, from each page you use a multiple content picker to pick a category.

    This way there's only ever one page you need to update.

  • ssougnez 93 posts 319 karma points c-trib
    Apr 11, 2018 @ 21:24
    ssougnez
    1

    Thanks for your answer but to be honest, it sounds more a workaround than a solution (with all due respect).

    The need of having a page located in the structure at different place is not so uncommon. I’m totally not against having to develop something for this, I just need some pointer.

    In the meanwhile, I’ll have a look at your proposal.

    Thanks

  • Nigel Wilson 944 posts 2076 karma points
    Apr 11, 2018 @ 23:38
    Nigel Wilson
    0

    Hi ssougnez

    To expand on Daniel's answer below is a pseudo tree structure:

    -- Home Node -- Category 1 -- Category 2

    -- Products Container -- Product 1 -- Product 2

    Products document type would have a multi node tree picker on it that enables you to pick categories.

    Therefore on the category page you will always get the products associated.

    One caveat is the number of products, and potentially creating a sub folder structure under the Products Container - this could be achieved by allowing a product container to have products AND product containers created below it.

    The possible downside of the above setup is once a user clicks into a product you potentially lose the breadrcumb back to the category - some crafty coding to pass the referencing category might be needed, etc.

    Hope this helps

    Nigel

  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 06:20
    ssougnez
    0

    Well, the requirement is that there is only one breadcrumb even though the page is located at different location.

    The issue with these answers is that I’m losing the nice structure of home/category/product.

    I would like to keep a home node, then some category nodes that contain some product node, it’s very clear for content editor while the proposed solution is way less intuitive.

    By the way, th order is also important so is it possible to define it with a content selector ?

  • Nigel Wilson 944 posts 2076 karma points
    Apr 12, 2018 @ 07:13
    Nigel Wilson
    1

    Hi ssougnez

    I hear what you are saying and I have a new idea that might work.

    So at the moment you have a Product Document Type with the product details.

    How about creating a new "Product Clone" document type and only have a content picker on it - the content picker would let you pick the real product node.

    Then in your product listing partial you can loop through all the children of the product category, firstly determine what document type alias it is and take action accordingly.

    Again then with the breadcrumb issue you could keep it transparent to the end user by structuring your code in partials and referencing the same partial from different templates.

    This is definitely a workable solution, albeit with the "duplicate" product nodes.

    Cheers, Nigel

  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 07:44
    ssougnez
    0

    That is already way closer than the expected answer. I have another question then (sorry for all these questions but I only started to learn Umbraco on Monday so...).

    What will happen if a content editor delete the main product document? Will it be prevented as long as "Product clone" items reference it or will they become "orphaned" ? Because I already imagine the reaction of content editors "yeah, but then I have to know all the location where this product is used to delete manually all the clone prior I delete the main item" and... they would be kind of right.

    I know that I'm a bit picky but one of the main goal of that site is to convince management that Umbraco is way better than SharePoint (that is currently used for the site right now). As this is obvious for me (and probably for a lot of other people), I need to convince people in here and one of the first requirement they mentioned was to be able to have a single page located at different location of the site with dynamic content ^^

    While this solution seems right (and might be the one I choose), I'm really surprised that no one talked about a coded approach. I don't know yet how we can leverage Umbraco with some custom development but isn't it possible to add an option in the options menu of a page where there would be a "Create a reference" item. Then, when the user clicks on it, a dialog like the "Move" one appear to select a location, then an item gets created at the chosen location that actually just redirects the user to the main page. It would not even be a real document, just an item, present in the hierarchy, that would redirect the user to the initial item. Maybe it's out of the scope of what's possible with custom development?

  • Nigel Wilson 944 posts 2076 karma points
    Apr 12, 2018 @ 08:10
    Nigel Wilson
    0

    Good thinking re the orphaned issue - yes it might happen, altho if you code defensively you can minimise the issue and potentially hook up some sort of email alert to report on orphans.

    And yes you could create a simple reference from under one category and redirect to the other category, however I thought you were wanting to preserve the breadcrumbs, so didn't suggest it.

    You can load a property on your document type that has an alias of "umbracoRedirect" and but picking a content node, you get redirected to that node automatically. However there still remains the orphan issue with this.

    So, good luck with the convincing re Sharepoint - personally like you, it is a no brainer, but sometimes others know "best". Arghhh

  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 08:21
    ssougnez
    0

    Maybe I was to succinct in the original post. I tried to keep it simple. Here is the full idea (maybe it won't change your proposal, but you never know :p).

    The site will be composed of 3 levels: the home page, product categories, products. On the homepage, there will be as many boxes as categories and these boxes title (the h2) will be the category name. Then, in these boxes, there will be links to the product of the current category.

    As such, it's very easy to do but the challenge is that a same product can appear in different category. For the breadcrumb, it will actually be unique. So let's imagine that we have a product called "P1" that appears in two categories "C1" and "C2", one of these categories will be the main one (say "C1"). Therefore, whether I click on the link in the "C1" box or in the "C2" box, the breadcrumb will always be "Home > C1 > P1".

    That's why I talked about "shallow copy" of the item in the back office tree structure. This way, in the structure, "P1" exists only under "C1" and the "P1" under "C2" is only a reference to the "P1" of "C1". So even though it's not a real item (just a shallow copy), I need it at these locations, therefore, I can do a simply query in order to get all the product of the current category.

    With the first solution proposed, I lose the tree structure, which is not cool. Your proposal is already closer than what I expected as we keep the tree structure but then, there is the orphaned/breadcrumb issue. I'll try to watch all umbraco.tv video to see what's possible with the API, because the "reference creation" would solve almost all the issues as the shallow item would simply point to the real product, then the breadcrumb will always be the correct one, but I would have to handle orphaned item as well...

    That's actually a tough one :-D

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Apr 12, 2018 @ 09:41
    Kevin Jump
    0

    Hi

    Within Umbraco you have the ability to manipulate and manage the URLs that content is served on.

    to this end you could have (some code - see below) you site serve up the same product on multiple URLs based on the categories that the product is in.

    so if your product has a Multi Node Tree Picker property for categories, and is picked for Category1 and Category2

    you can programatically have it appear at http://site.com/category1/product and http://site.com/category2/product - without having to do anything to the structure you have in your site.

    You then have things like breadcrumbs and the like still working because you have intercepted the URL within umbraco and told it what page / template to load.

    Equally the pages that list products in categories can be done a number of ways but you might choose to use the Examine Search Index to list out all products that are in a certain category.

    The Code bit:

    You can achive this by writing custom ContentFinder and URLProvider classes (See https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/ for a good introduction - and the documentation for more details : https://our.umbraco.org/documentation/Implementation/Custom-Routing/)

    This does require a bit more code, but its part of the flexibility that Umbraco offers that is allows you to do this type of thing without being to prescriptive about your site structure.

  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 09:52
    ssougnez
    0

    Hi and thanks for your answer.

    However (sorry for that), as stated in my previous post, as the page exists only once, there is only one breadcrumb and therefore, only one URL. So it does not matter whether you click on "P1" in "C1" or in "C2", at the end of the day, the URL will always be "http://site.com/c1/p1".

    Moreover, your solution induces that the relationship will have to be managed at product level in addition of the structure. Indeed, if I put myself in the shoes of a content manager, I would like just having create the page in the structure where I want it to appear and maybe make some reference to this page somewhere else in the structure. I wouldn't like having to edit product categories on the top of having to put it at the correct location in my structure.

    I know that I'm a bit difficult on this, but I know for sure that this solution wouldn't please our content managers.

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Apr 12, 2018 @ 10:03
    Kevin Jump
    1

    Hi

    again you know more about the customer and product stuff so this may still be way off, but i wouldn't put the products under any categories ?

    i would have

    • Home

      • Products
      • Categories

    And then the product urls will always be http://site.com/p1

    you then pick what products appear in what categories - you can do this either way

    a) put the category picker on a product page

    or

    b) put a product picker on a category page.

    then the 'trick' (which isn't anywhere near as complicated as my last suggestion) is to show the products on the category pages

    to do this you would either show all products with the category picked on them (option a) or list all the products from the category page (option b)

    To the editor option b is more like having cloned pages but they won't see them in the tree (just on the property of the page in the back office when the open it).

  • ssougnez 93 posts 319 karma points c-trib
    Apr 12, 2018 @ 10:17
    ssougnez
    0

    Hehe, thanks for your dedication in providing me an answer :-D

    One additional information about the project: the structure has not been decided by me unfortunately. The company I'm working in used an external company to analyze and propose a structure (which I don't like but it does not matter :p).

    In the proposed architecture, the URL must be in form of "http://site.com/category/product". So even though your proposal is good, I don't think they will accept that :-(

Please Sign in or register to post replies

Write your reply to:

Draft