We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4155
    • 11 Posts
    Hi, I’m completely new to MODx but have been blown away so far! I’m trying to use TreasureChest to set up a cart on an existing site (which someone else has built). I’ve installed it and created the "basket" page, however when i follow the next step in the documentation:

    "In the MODx Manager, select the Modules tab, then click Treasure Chest."
    [ http://www.treasurechestcart.com/documentation.html ]

    I get a completely blank page.

    I tried reinstalling the module (which then led to having two Treasure Chest modules installed (whoops). I deleted them both as well as the "basket" page, reinstalled, but still.. no luck.

    How can I get this fixed?

    Many thanks

    Brett
      • 4155
      • 11 Posts
      I’ve looked in the System Events and every time I try to run the Treasure Chest module, there is an event with the message "Undefined index: treasure".

      I don’t know if it’s related, but the site I’m working on was originally built by someone else and they copied it to a development server which I’m now working on. For some strange reason, after they copied it, the `id` column of `modx_site_content` wasn’t set to "auto_increment" any more, which then caused "Couldn’t get last insert key!"/"An error occured while attempting to save the new document: Duplicate entry ’0’ for key 1" errors. (After I set it to auto increment that issue went away.)

      As well as this, phpMyAdmin tells me "PRIMARY and INDEX keys should not both be set for column `id`" also for the modx_site_content table.

      Because this error is talking about "index" not being defined, do you think these things are related?

      Any help is greatly appreciated. Beyond this, I don’t know where to begin looking.
        • 4155
        • 11 Posts
        At this point the issue is definitely related to the server which my colleague set up; I have successfully installed a fresh install of ModX and TreasureChest on my own dev server, as well as copying the existing installed version & the DB from the problematic server to my own server and TreasureChest installs on that fine. I have also installed a brand new copy of ModX in a seperate subdirectory on the same problematic server and it suffers from the same issue.

        I’ve been searching around and found that "Undefined index" is actually a PHP warning and it’s not related to DB stuff as I first thought. It occurs when something is accessed in an array which hasn’t been declared yet. With error reporting turned on: E_ALL, this:

        <?php
        echo $array[’not_existent’];
        ?>

        returns that error.

        So I tried to turn off *all* the error reporting on the problematic server (even though the error isn’t coming as an ugly White-screen-with-black-text type php error, rather an event in the System Events log), via the apache directive "php_value error_reporting off", but this didn’t work. To be doubly sure, I turned E_ALL on (it suppresses the Undefined index error by default), but by dev server still worked fine.

        Argh!

        Would love some help here guys. I know this is confusing to explain, please tell me if I haven’t explained something clearly enough etc.

        Thanks in advance
          • 4310
          • 2,310 Posts
          I’ve done some work on a site with TreasureChest and have also seen the "Undefined index: treasure" message.
          That didn’t stop it from working so it may well be a red herring.
            • 4155
            • 11 Posts
            Quote from: bunk58 at May 14, 2008, 08:25 AM

            I’ve done some work on a site with TreasureChest and have also seen the "Undefined index: treasure" message.
            That didn’t stop it from working so it may well be a red herring.

            That’s interesting, thanks for the tip.

            I’m still unable to get this to work. I’ve just uploaded Modx and TC to the production server and installed it in to a subdirectory to see if this machine didn’t have the same issue, thinking maybe I could develop it there, instead of the staging site.. however no luck, it has the same issue.

            Can anyone suggest a way to get to the bottom of this? I’m new to Modx and don’t know where to start digging. I really need to get this sorted.
              • 4155
              • 11 Posts
              Just to share; we solved this. Treasure chest wasn’t creating and writing the snippet folder and its contents.

              When they’re added the system works correctly.

              Hope that helps someone.
                • 13427
                • 6 Posts
                hi, all from italy, (sorry for my bad english) wink

                brpcs, i have the same problem with treasure chest. So my cart work good with no problems, but i see that when i enter to the module to add an item, the modx log give me the error Undefined index: treasure.

                Can anyone help me?

                Thanks to all
                  • 30552
                  • 75 Posts
                  To anyone who might still have this error - Undefined index: treasure

                  As noted before, it doesn’t seem to affect any functionality; it just throws the error every time you launch the TreasureChest module from within the modx manager.

                  I am not a PHP programmer, but I looked at the module code for anything named "treasure" that might be causing the error. Among the first few lines of code was this:
                  $action = $_REQUEST['treasure'];


                  I looked at all the cases, and thought that maybe when you first execute the module, no cases match, so treasure might be empty (not really empty so much as non-existent), and that’s what’s returning the Undefined index: treasure error.

                  I consulted my business partner, Brandon, for a quick fix (he is a PHP programmer), and he said to just replace the line
                  $action = $_REQUEST['treasure'];
                  with
                  $action = (isset($_REQUEST['treasure'])) ? $_REQUEST['treasure'] : '';
                  which will not affect the way the module works at all... it will just make it not access $_REQUEST[’treasure’] if there isn’t anything there. That keeps the error from happening, and keeps your modx system events log from filling up with this error.

                  Hope this eases peoples’ minds,

                  Kevin
                  TransEffect LLC