We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24197
    • 21 Posts
    By chance has anyone experience using images in place of the ’empty’ & ’view cart’ text for the treasurechest script?

    I attempted inserting image code directly into the text space, however, irrelevant pieces of code were displayed along with the button images.

    If you can help, I’d appreciate it.
      • 24531
      • 213 Posts
      here’s unpacked js for TC. Feel free to modify

      function emptyCart(){$.post(cart_doc,{action:’count’},function(a){cart_count=eval("("+a+")");if(!cart_count.length){tb_remove();$(cart_el).animate({opacity:’1.0’},’slow’,function(){$(cart_el).html(’’)});return false}else{if(confirm(cart_warn)){$.post(cart_doc,{action:’empty’});$(cart_el).animate({opacity:’1.0’},’slow’,function(){$(cart_el).html(’’)})}}});return false}function checkout(a){TB_remove();jQuery(’#treasureChestCheckout’).remove();jQuery(’<div id="treasureChestCheckout">’+a+’</div>’).appendTo(’body’).hide();document.paypal.submit()}function cartCount(){$.post(cart_doc,{action:’count’},function(a){cart_count=eval("("+a+")");if(cart_count.length){cart_string=’<a class="thickbox tc_view" title="’+cart_view+’" href="#" onclick="return false;">’+’<span class="tc_cart_view_text">’+cart_view+’</span><span class="tc_cart_count" class="tc_count">’+cart_count.length+’</span></a>’+’<a class="tc_cart_empty ’+class_empty+’" href="#" title="’+cart_empty+’">’+cart_empty+’</a>’;$(cart_el).show().html(cart_string);$(’.tc_view’).click(function(){if(!cart_count.length){emptyCart()}TB_show(cart_name,cart_doc+’&TB_iframe=true&height=350&width=500&action=view’,false);return false})}else{$(cart_el).hide();return false}$(’a.’+class_empty).click(emptyCart);
      return true})}
      function addToCart(a,b,c){$.post(cart_doc,{action:’add’,selector:b,item:c},cartCount);$(cart_el).animate({opacity:’0.9’},’fast’).animate({opacity:’1.0’},’normal’);$(a).animate({opacity:’1.0’},’fast’).animate({opacity:’1.0’},’normal’);return false}function tcConfig(a){config=eval("("+a+")");cart_name=config[’business_name’];cart_view=config[’cart_view’];cart_empty=config[’cart_empty’];cart_warn=config[’cart_warn’];cart_el=config[’cart_el’];class_add=config[’class_add’];class_empty=config[’class_empty’];$(’.’+class_add).click(function(){addToCart(this,this.rel,this.name);return false});cartCount()}function paypalForm(a){$.post(cart_doc,{action:’item_opts’,name:a.name,value:a.value});op_field=a.name;$(’.’+op_field).val(a.value)}emptyCartFunction=emptyCart;checkoutFunction=checkout;cartCountFunction=cartCount;addToCartFunction=addToCart;checkoutFunction=checkout;prepPaypal=paypalForm;$(document).ready(function(){$.post(cart_doc,{action:’config’},tcConfig);$(’.hover-info’).Tooltip({track:true,delay:0,showURL:false,fixPNG:true,showBody:’ - ’,extraClass:’hover’,top:-15,left:5});$(’<span style="display:none;" id="treasureChestCopyright">Powered By &copy;Treasure Chest 1.0 by Scotty Delicious</span>’).appendTo(’body’).hide()});$(document).keypress(function(e){if(e.which==27){tb_remove();cartCount()}});
        • 24531
        • 213 Posts
        oops it was a bit messy. let’s try again

        function emptyCart() {
            $.post(cart_doc, {
                action: 'count'
            },
            function(a) {
                cart_count = eval("(" + a + ")");
                if (!cart_count.length) {
                    tb_remove();
                    $(cart_el).animate({
                        opacity: '1.0'
                    },
                    'slow',
                    function() {
                        $(cart_el).html('')
                    });
                    return false
                } else {
                    if (confirm(cart_warn)) {
                        $.post(cart_doc, {
                            action: 'empty'
                        });
                        $(cart_el).animate({
                            opacity: '1.0'
                        },
                        'slow',
                        function() {
                            $(cart_el).html('')
                        })
                    }
                }
            });
            return false
        }
        function checkout(a) {
            TB_remove();
            jQuery('#treasureChestCheckout').remove();
            jQuery('<div id="treasureChestCheckout">' + a + '</div>').appendTo('body').hide();
            document.paypal.submit()
        }
        function cartCount() {
            $.post(cart_doc, {
                action: 'count'
            },
            function(a) {
                cart_count = eval("(" + a + ")");
                if (cart_count.length) {
                    cart_string = '<a class="thickbox tc_view" title="' + cart_view + '" href="#" onclick="return false;">' + '<span class="tc_cart_view_text">' + cart_view + '</span><span class="tc_cart_count" class="tc_count">' + cart_count.length + '</span></a>' + '<a class="tc_cart_empty ' + class_empty + '" href="#" title="' + cart_empty + '">' + cart_empty + '</a>';
                    $(cart_el).show().html(cart_string);
                    $('.tc_view').click(function() {
                        if (!cart_count.length) {
                            emptyCart()
                        }
                        TB_show(cart_name, cart_doc + '&TB_iframe=true&height=350&width=500&action=view', false);
                        return false
                    })
                } else {
                    $(cart_el).hide();
                    return false
                }
                $('a.' + class_empty).click(emptyCart);
                return true
            })
        }
        function addToCart(a, b, c) {
            $.post(cart_doc, {
                action: 'add',
                selector: b,
                item: c
            },
            cartCount);
            $(cart_el).animate({
                opacity: '0.9'
            },
            'fast').animate({
                opacity: '1.0'
            },
            'normal');
            $(a).animate({
                opacity: '1.0'
            },
            'fast').animate({
                opacity: '1.0'
            },
            'normal');
            return false
        }
        function tcConfig(a) {
            config = eval("(" + a + ")");
            cart_name = config['business_name'];
            cart_view = config['cart_view'];
            cart_empty = config['cart_empty'];
            cart_warn = config['cart_warn'];
            cart_el = config['cart_el'];
            class_add = config['class_add'];
            class_empty = config['class_empty'];
            $('.' + class_add).click(function() {
                addToCart(this, this.rel, this.name);
                return false
            });
            cartCount()
        }
        function paypalForm(a) {
            $.post(cart_doc, {
                action: 'item_opts',
                name: a.name,
                value: a.value
            });
            op_field = a.name;
            $('.' + op_field).val(a.value)
        }
        emptyCartFunction = emptyCart;
        checkoutFunction = checkout;
        cartCountFunction = cartCount;
        addToCartFunction = addToCart;
        checkoutFunction = checkout;
        prepPaypal = paypalForm;
        $(document).ready(function() {
            $.post(cart_doc, {
                action: 'config'
            },
            tcConfig);
            $('.hover-info').Tooltip({
                track: true,
                delay: 0,
                showURL: false,
                fixPNG: true,
                showBody: ' - ',
                extraClass: 'hover',
                top: -15,
                left: 5
            });
            $('<span style="display:none;" id="treasureChestCopyright">Powered By ©Treasure Chest 1.0 by Scotty Delicious</span>').appendTo('body').hide()
        });
        $(document).keypress(function(e) {
            if (e.which == 27) {
                tb_remove();
                cartCount()
            }
        });
        
          • 15001
          • 697 Posts
          For those interested, the procedure for unpacking treasurechest.js is described here:
          http://modxcms.com/forums/index.php/topic,44823.0.html

          However I was unable to make a functional version mixing packed and unpacked code.
          Can someone try?