We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26435
    • 1,193 Posts
    TreasureChest (TC) is now GPL.
    This has been quite an experience. I know now that I am a terrible businessman smiley
    I really wish I had more time to dedicate to supporting and developing this software.
    I trust that this recently GPL’d code will be in better hands with the MODx community than it was with me.
    The TC Site will stay up as a demo and for support, but if you want to download TC, get it here:
    http://modxcms.com/TreasureChest-1745.html

    later

    -sD-
    Dr. Scotty Delicious, DFPA.
      Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
      All of the above... in no specific order.


      I send pointless little messages
      • 7291
      • 129 Posts
      Wow... Thank you very much for making this accessible to all!

      What a great community... think I’ll try out Treasure Chest today
        [center]-- smiley --[/center]
        [center]New View Media - Custom Website Design[/center]
        [center]Custom Website Design & Marketing = Strategic Business![/center]
        • 473
        • 70 Posts
        Wow thank you Scotty, it great contribution
          • 16610
          • 634 Posts
          What a generous contribution to the whole community smiley Thank you!
            Mikko Lammi, Owner at Maagit
            • 36582
            • 463 Posts
            That’s fantastic Scotty - you’ve done an outstanding job with this and I’m sure it will go on to be the most used solution for this kind of e-commerce site. Well done and thanks.
              Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
              • 27330
              • 884 Posts
              did anyone figured how to make a page ’private’ until client receive it from paypal PDT?

              I’m trying to setup a registration page with webloginPE but want that page accessible only when Paypal directs there after successful payment.

              is this doable or I’m asking too much?
                • 26435
                • 1,193 Posts
                Quote from: sinbad at May 18, 2008, 11:20 PM

                did anyone figured how to make a page ’private’ until client receive it from paypal PDT?

                I’m trying to setup a registration page with webloginPE but want that page accessible only when Paypal directs there after successful payment.

                is this doable or I’m asking too much?
                I had written a plugin that fired "OnPDTSuccess". It created a username and randomly generated password. It used the transaction id as the username.

                F*** it, I’ll post it here. This checks to see if "Treasure Chest License" was in the "item_name" string. This prevents the plugin for generating a username and password with access to the download page for *ANY* purchase, only for Treasure Chest License purchases.

                Modify this as you see fit.
                //<?php
                $e = &$modx->Event;
                switch ($e->name)
                {
                case "OnPDTSuccess":

                function GeneratePassword($length = 10)
                {
                $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
                $ps_len = strlen($allowable_characters);
                mt_srand((double)microtime()*1000000);
                $pass = "";
                for($i = 0; $i < $length; $i++) {
                $pass .= $allowable_characters[mt_rand(0,$ps_len-1)];
                }
                return $pass;
                }

                $newPW = GeneratePassword(10);
                $params = &$e->params;

                $isTC = false;
                foreach ($params as $key => $value)
                {
                $check = strpos($key, ’item_name’);
                if ($check === false)
                {
                // Skip it.
                }
                else
                {
                if (strcmp ($value, "Treasure Chest License") == 0)
                {
                $isTC = true;
                }
                }
                }

                if (!$isTC) return;

                $txn_id = $params[’txn_id’];
                $web_users = $modx->getFullTableName(’web_users’);
                $web_user_attributes = $modx->getFullTableName(’web_user_attributes’);
                $web_groups = $modx->getFullTableName(’web_groups’);

                $checkUID = $modx->db->query("SELECT * FROM ".$web_users." WHERE `username` = ’".$txn_id."’");
                $count = $modx->db->getRecordCount($checkUID);

                if ($count == 0)
                {
                $new_user = $modx->db->query("INSERT INTO ".$web_users." (`username`, `password`, `cachepwd`) VALUES (’".$txn_id."’,’".md5($newPW)."’,’".$newPW."’)");

                $checkUID = $modx->db->query("SELECT * FROM ".$web_users." WHERE `username` = ’".$txn_id."’");
                $user = $modx->db->getRow($checkUID);
                $id = $user[’id’];

                $attributes = $modx->db->query("INSERT INTO ".$web_user_attributes." (`internalKey`,`fullname`,`email`) VALUES (’".$id."’,’".time()."’,’".$params[’payer_email’]."’)");
                $cachepwd = $modx->db->query("UPDATE ".$web_users." SET `cachepwd`=’".$newPW."’ WHERE `username`=’".$txn_id."’");
                $webgroup = $modx->db->query("REPLACE INTO ".$web_groups." (`webgroup`, `webuser`) VALUES (’1’, ’".$id."’)");

                $email_message = ’<h3>Thank you for your purchase</h3>
                <p>Your license is active for the URL ’.$params[’option_selection1_1’].’</p>
                <p>To download TreasureChest, log into the <a href="http://treasurechest.scottydelicious.com/download.html">download page</a> with the User ID "<strong>’.$txn_id.’</strong>" and the Password "<strong>’.$newPW.’</strong>"</p>
                <p>This User ID and Password will be deleted in 72 hours. Please download TreasureChest before then.</p>


                <p>Thanks,</p><p>-sD-
                Dr. Scotty Delicious, DFPA.</p> <p><a href="mailto:[email protected]">[email protected]</a> </p>’;

                $headers = ’From: [email protected]’ . "\r\n" .
                ’Reply-To: [email protected]’ . "\r\n" .
                ’Content-type: text/html’ . "\r\n" .
                ’X-Mailer: PHP/’ . phpversion();

                mail($params[’payer_email’],’Thank you for purchasing a license for TreasureChest’,$email_message,$headers);

                }
                else
                {
                $user = $modx->db->getRow($checkUID);
                $newPW = $user[’cachepwd’];
                }

                $msg = ’<p class="user-info">Your User ID is: <span>’.$txn_id.’</span></p><p class="user-info">Your Password is: <span>’.$newPW.’</span></p><p>Please use these credentials when you <a href="[~15~]" onclick="document.tclogin.submit();return false;">Login</a> <span class="tips">(Your User ID and Password will be entered automatically)</span> to Download TreasureChest.</p><p>Your account will be active for the next 72 hours. Be sure to login and download within that time frame.</p><p>If you used a PayPal account to purchase, this information has also been sent to your PayPal email address.</p><form name="tclogin" action="[~15~]" method="post"><input type="hidden" name="username" value="’.$txn_id.’" /><input type="hidden" name="password" value="’.$newPW.’" /></form>’;

                $modx->setPlaceholder(’treasure.login’, $msg);

                break;

                default :
                return; // stop here - this is very important.
                break;
                }
                //?>

                -sD-
                Dr. Scotty Delicious, DFPA.
                  Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                  All of the above... in no specific order.


                  I send pointless little messages
                  • 27330
                  • 884 Posts
                  Scotty you are the man!
                  will cook it later for my liking and will post the results.

                  muchos gracias!
                    • 16532
                    • 38 Posts
                    Hello Sir.

                    I’m a new MODx and TreasureChest user.
                    I really want to use TreasureChest-TC for my MODx website.
                    I try to install and config TC to my MODx.
                    I have a trouble with TC, my product page is empty.
                    I read Tc’s document but my product page is still empty.
                    Could you tell me detail about how to install and config TC?

                    Thank you
                      • 26435
                      • 1,193 Posts
                      Quote from: k_insuwai at May 21, 2008, 05:45 AM


                      Could you tell me detail about how to install and config TC?

                      Thank you

                      Try to put this on the product page:


                      [[treasureChest? &item=`1` &thumb_w=`120`]]
                      <div class="product-wrap">

                      <div class="product-image">
                      [+treasure.image.thumb.thickbox+]
                      </div>

                      <div class="product-info">
                      <h3 class="product-name">[+treasure.item_name+]</h3>
                      <h4 class="product-about">Description</h4>
                      <p class="product-about">[+description+]</p>
                      <h4 class="product-ingredients">Information</h4>
                      [+introtext+]
                      <h4 class="product-price">Price</h4>
                      <p class="product-price">$ [+treasure.amount+]</p>
                      <h4 class="product-inventory">Inventory</h4>
                      <p class="product-inventory">[+treasure.inventory+] units available</p>

                      </br/>
                      <p class="product-add">[+treasure.add+]</p>
                      </div>

                      <br class="clear" />
                      </div>


                      You can see there are many "treasure" placeholders you can use to customize the layout. Here is a complete list:
                      http://www.treasurechestcart.com/documentation/placeholders.html

                      -sD-
                      Dr. Scotty Delicious, DFPA.
                        Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                        All of the above... in no specific order.


                        I send pointless little messages