Subversion Repositories wpShopGermany4

Rev

Rev 6314 | Rev 7136 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed


        /**
         * Funktion für das Modul basketteaser
         * Fügt die Produkte im Warenkorb ein
         */
        function wpsg_mod_basketteaser_add(produkt_id)
        {
                
                var menge = jQuery('.wpsg_mod_basketteaser_row_' + produkt_id + ' input').val();
                
                if (menge <= 0) menge = 1;
                
                location.href = wpsg_ajax.ajaxurl + '?wpsg[menge]=' + menge + '&wpsg[produkt_id]=' + produkt_id + '&wpsg[submit]=1';
                
                return false;
                
        } // wpsg_mod_basketteaser_add(produkt_id)

        function wpsg_customerquestion(url_redirect)
        {
        
                jQuery('body,html').addClass('wpsg_noscroll');
                jQuery('body').append('<div id="wpsg_calc_layer"><div class="content"><img class="loading" src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div></div>');

                jQuery.ajax( {
                        url: wpsg_ajax.url_basket,
                        data: {
                                'wpsg[ajax]': 1,
                                'wpsg[action]': 'customerquestion',
                                'wpsg[url]': url_redirect
                        },
                        success: function(data) {
                                
                                jQuery('#wpsg_calc_layer .content').html(data);
                                
                        }
                } ); 
                
                return false;
        
        }

        /**
         * Sperrt die Funktionen im Produkttemplate, während einer Ajax Aktion
         * @param template_index
     */
        function wpsg_blockProductTemplate(template_index)
        {
                
                jQuery('#wpsg_produktform_' + template_index).append('<div class="wpsg_product_layer"><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
                
        } // function wpsg_blockProductTemplate(template_index)

        /**
         * Entsperrt die Funktionen im Produkttemplate nach einer Ajax Aktion
         * @param template_index
     */
        function wpsg_unblockProductTemplate(template_index)
        {
                
                jQuery('#wpsg_produktform_' + template_index + ' .wpsg_product_layer').remove();
                
        } // function wpsg_unblockProductTemplate(template_index)
        
        wpsg_numberformat = function (number, decimals, dec_point, thousands_sep) 
        {
    
                var n = !isFinite(+number) ? 0 : +number, 
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
        s = '',
        
        toFixedFix = function (n, prec) 
        {
                
                var k = Math.pow(10, prec);
                return '' + Math.round(n * k) / k;        
        };
        
        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
    
        if (s[0].length > 3) 
        {
                s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);    
        }
        if ((s[1] || '').length < prec) 
        {
                
                s[1] = s[1] || '';
                s[1] += new Array(prec - s[1].length + 1).join('0');
    
        }    
        
        return s.join(dec);
         
        };

        wpsg_tf = function(value)
        {
         
                if (value == null) return;
                if (typeof value == "number") return parseFloat(value);
                  
                if (value.lastIndexOf(".") == -1)
                {

                        // 1500,50                
                        return parseFloat(value.replace(/,/, "."));               
          
                }
                else
                {
                
                        if (value.lastIndexOf(",") == -1)
                        {       
                                 
                                // 1500.50
                                return parseFloat(value);
                  
                        }                 
                        else 
                        {
                        
                                if (value.lastIndexOf(",") > value.lastIndexOf("."))
                                {  
                                
                                        // 1.500,50                               
                                        return parseFloat(value.replace(/\./, "").replace(/,/, "."));
                          
                                }
                                else
                                {
                                        
                                        // 1,500.50
                                        return parseFloat(value.replace(/,/, ""));
                          
                                }
                  
                        }
                        
                }
          
        };