We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    Hi everyone,

    Some of you probably know the nice TreasureChest module for ecommerce.
    Unfortunately, its code is quasi not commented and this prevents many of us to add new functionnalities to TreasureChest.

    I added much comments to treasurechest.class.php, which is the main file.
    This brings some light on how TreasureChest works.

    You can download the commented code from here:
    www.altipoint.ch/modx_ressources/treasure_chest/treasurechest.class.php.zip

    You can also find the expanded content of the two javascript files that we find in the script subfolder :
    http://www.altipoint.ch/modx_ressources/treasure_chest/treasurechest_expanded.js
    http://www.altipoint.ch/modx_ressources/treasure_chest/module_expanded.js

    Are there other developpers here around interested in enhancing TreasureChest?

    I hope that we can give to TreasureChest a second youth.

    Regards,

    Julien
      • 28289
      • 4 Posts
      Thanks a lot Julien. I’m sure this will be useful to make up for the painful lack of documentation on what is potentially an excellent module. Unfortunately, the only sections you haven’t commented are the bits relating to product options, which is the last piece of the puzzle for me!

      The only guidance I’ve had towards the correct syntax for product options is buried in these forums somewhere. It goes something like:
      <select class="os0_1" onchange="prepPaypal(this)" name="os0_1">
            <option value="without message">No message inside</option>
            <option value="with message">With printed message inside</option>
      </select>


      This does actually work, i.e. it carries across to Paypal, but only if it’s the 1st item in your cart. The final number in "os0_1" refers to the order in the cart, so it obviously shouldn’t be hardcoded in the product manager. I can’t for the life of me figure out what the correct syntax is meant to be and I know there are a lot of frustrated posters out there who have given up on product options. I’ve also seen a few live Treasure Chest-based sites where the product options are in place but don’t work!

      What use is a 99% functional snippet/module/plugin to any of us?

      Surely somebody can crack this?




        • 15001
        • 697 Posts
        @srp:

        Hi, glad you appreciate the comments.

        What PayPal Payments Standard Integration Guide tells about options is not obvious and surely needs some testing. I’m going to print pages 365 to 370 so that I can read them more carefully. I think that understanding these pages is essential for going forward.

        You should look especially at pages 368 to 370 of the guide.
        There is some optional hidden field, option_selected0 or option_selected1, telling which item in the corresponding option drop list is selected.
        There are also optional hidden fields option_amount0 and option_amount1 used to store the selected amount option in the case of priced options.

        One must use "option_item" to tell which option list is used for priced options if not the first one. (I’m not sure yet why are two option_amounts and option_selected and only one option_index.)

        To go forward, and understand the basic mechanism, I would also look at what the onchange="prepPaypal(this)" JavaScript function does.

        I’m sorry that I currently cannot find time enough to explore that.

        Maybe, starting by implementing discounts would be easier.

        Bye.

        Julien