Copied to clipboard

Flag this post as spam?

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


  • Karthik Vasan 8 posts 88 karma points
    Oct 30, 2018 @ 11:40
    Karthik Vasan
    0

    Shared content (with in the content) on all pages

    Hi,

    i'm new to umbraco CMS... trying to add some shared content within the content on all pages, for example using product price on all pages within the content. i want to keep product price in a common place (like global variable or whatever its called) and will add that anywhere within the content on any page. The product price needs to be automatically updated in all page when we change price in the common place. i have tried to use macro but its not doing well within RTE (inline issue and unable to edit) and even tried with dictionary but failed. i dont know whether there is any option/functionality in umbraco or not. please can anyone help me to sort out this..

    Thanks

    karthik

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 30, 2018 @ 12:16
    Michaël Vanbrabandt
    0

    Hi vasan,

    first of all Welcome to the Umbraco community!

    Can you give us some more details about your products structure in Umbraco? Normally you have a Product page which contains a price property.

    /Michaël

  • Karthik Vasan 8 posts 88 karma points
    Oct 30, 2018 @ 12:29
    Karthik Vasan
    0

    Hi Michael,

    Thanks for the welcome!

    enter image description here

    Please find the attached screenshot for sample content with product price (£17.50). This price value will be there on any page at any place within any content. But i need to keep this value in a variable/dictionary (or something else) and add that variable inside the content wherever need the price. so its easy to change the price in future in one place rather than changing this on every page/place... thanks

    karthik

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 30, 2018 @ 12:34
    Michaël Vanbrabandt
    0

    Hi vasan,

    normally you will have a Product document type with a property called Price. Then anywhere on any page you like you can insert products and access the price of each product.

    So in this case you have one place where you price is managed and will be equal on all places.

    For other prices like fees that are not linked to products you could make a new tab on your Home document type like FeePrice and then on any child page under your Home page you can access this property by using a resursive lookup like:

    .GetPropertyValue("feePriceAlias", true)
    

    The true indicates to traverse up the tree untill you find a property called feePriceAlias.

    Hope this helps!

    /Michaël

  • Karthik Vasan 8 posts 88 karma points
    Oct 30, 2018 @ 12:45
    Karthik Vasan
    0

    Hi Michael,

    thanks for the explanation.. i understand about the properties but the question is how can we add this inside the content via RTE... i know the GetPropertyValue method inside a view/macro partial to get the property value and i have already created macro to get the price value from the page properties but the issue is, a content writer going to add some content on a page and they want to include the product price inside their content and this is the place which i'm struggling... i used macro to solve this but macro not working well inside RTE (its not fitting inline and couldn't edit it)...

    thanks karthik

  • Karthik Vasan 8 posts 88 karma points
    Oct 30, 2018 @ 13:41
    Karthik Vasan
    0

    Hi Michael,

    thanks for the explanation.. i understand about the properties but the question is how can we add this inside the content in RTE... i know the GetPropertyValue method will be used inside a view/macro partial to get the property value and i have already created macro to get the price value from the page properties but the issue is, when a content writer going to add some content on a page and they want to include the product price inside their content and this is the place where i'm struggling... i tried with macro to solve this but macro not working well inside RTE (its not fitting inline and couldn't edit it)...

    enter image description here

    how can we make the price dynamic in RTE?

    Karthik

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 31, 2018 @ 14:27
    Michaël Vanbrabandt
    0

    Hi Vasan,

    the only way I can think of is creating a Macro where you catch the fee value by using the .GetPropertyValue("feeAlias", true) method which will search the tree recursively untill it finds the Fee price.

    Then in your RTE you can embed this Macro which will catch the price and display it inside the RTE content.

    https://our.umbraco.com/documentation/reference/templating/macros/

    Hope this helps!

    /Michaël

  • Karthik Vasan 8 posts 88 karma points
    Oct 31, 2018 @ 14:36
    Karthik Vasan
    0

    Hi Michael,

    yes i mentioned already in the question, tried with macro but its breaking the line as its not sitting inline also unable to edit (every time need to delete and re-add them)... the macro mechanism removing any paragraph tag and adding div wrapper on the macro... i have tried the inline macro one but still failed... it might be useful if possible to add the macro inline in RTE...

    Karthik

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Oct 31, 2018 @ 14:45
    Michaël Vanbrabandt
    0

    Vasan,

    ahhh I see must have missed that, that you already tried this.

    /Michaël

Please Sign in or register to post replies

Write your reply to:

Draft