We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    We have a collection of pages created via the ModX system, all of which use a snippet which links to another ModX created page which will act as a vanilla-type "product" page.

    What this means is that 1 page will act as a template for all our products.

    But, how do I change page info dynamically once the page has loaded? What API call do I need to use? is there a "modx->setPageInfo(’title’ = ’page title’)" style function?

    Currently, the page is titled as "untitled document".

    I hope you can help.

    Many thanks.
    • I don’t see the advantage to this. Why not a regular template for all your product pages, and use [*pagetitle*] for the template’s title?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32241
        • 1,495 Posts
        I don’t understand of what you’re trying to do. But your best bet will be to use @INHERIT binding. If you can explain it further, maybe we can help you out with best practices that you need to go for in using MODx.
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 32645
          • 377 Posts
          Well we are currently recoding parts of modx to do what we need it to do. In this case it’s e-commerce. We’ve added a products bit. The products are linked to the modx pages which use a custom template called "product-category-tpl". So you could have a page called "Living room furniture" and it will link to the relevant product category (ie: product category).

          We had to do it this way because of the way a client wanted it to work.

          So, as each page acts like a display showing products linked to that page, they all go off to the same generic product page, which has to be renamed from "untitled document" to whatever product you’re on.

          I figured out that you can use
          $modx->documentObject['pagetitle'] = "HELLO WORLD";
          


          in a snippet to change the page title, but this not affect breadcrumbs as they take their data from the database.

          Here, in a text diagram is what I’m trying to do;


          "modx created page" (links to ->) a product category (which is a parent of ->) products
          The user (not admin) goes to the modx created page, clicks to find out more info and is taken to a generic product page which has all the relevant info for that product and can be added to a cart.

          I hope this helps
            • 32241
            • 1,495 Posts
            If I was you, I’ll modify the breadcrumb snippet, and make the breadcrumb snippet to be able to identify whether it’s currently viewing the page or the item detailed view. Make the breadcrumb snipet work accordingly to what you want the breadcrumb to looks like.
              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media