Ergebnis 1 bis 2 von 2

Thema: Auslesen von Array Object

  1. #1
    Benutzer
    Registriert seit
    31.10.2012
    Beiträge
    61

    Auslesen von Array Object

    Hallo,
    ich habe hier ein Array

    priceConfig : [ 'm:2','a:1.72','a:1.72' ]


    das ich mit

    this_.settings.product_config.priceConfig[k]; // bei k = 0 ist alles ok k=1 ist undefined

    auslesen möchte

    Kann mir jemand einen Tipp geben, was hier schief läuft?

    Hier das die Funktion des Scripts:

    PHP-Code:
    defaultEqPrices: function(thatglobalkey) {
                


     var 
    this_ that
     
          var 
    basePrice this_.settings.product_config.total_price;
          
          var 
    newbasePrice this_.settings.product_config.total_price;
          
          var 
    multiplicaton_of_price 0;
          
          var 
    newPriceTemp 0;
          
          var 
    newPrice 0;
          
          var 
    beforecolorUpgrade 0;
                 
          var 
    searchkey this_.settings.product_config.productkeys;
          
          var 
    collect searchkey[0];
          
          var 
    = -1;  
           
          var 
    selectedIndex_ = -1;
          
           
                  
          $.
    each(searchkey, function( korders ) { 
                               
           var 
    0;              
                    
          $.
    each(orders, function( ikey ) { 
           
                                        
                                                        
           if(
    this_.settings.product_config.selected[l] != undefined && this_.settings.product_config.selected[l] == key) { 
                                                             
           var 
    priceConfig this_.settings.product_config.priceConfig[k]; 
           
                          if(
    newbasePrice == "10.85") {  
                             if(
    key== "/oxidrot")
                             
    alert('*' key '#' priceConfig '###' i)         
                             else if(
    key == "/2000")
                             
    alert('*' key '#' priceConfig '###' i)                          
                          }
                          
                          var 
    witchPrice priceConfig.split(':');
                               
                         
           
                          if(
    witchPrice[0] == "a") {
                          
                          
    multiplicaton_of_price = (((parseFloat(witchPrice[1]) * 100) / basePrice) / 100) + 1;
                                 
                          } else {                    
                           
                          
    multiplicaton_of_price parseFloat(witchPrice[1]);
                                                                                                                                           
                          }
                          
                                     
                                                                       
                          
    newbasePrice *= multiplicaton_of_price;
                          
                                
                          
                                            
                            
                                
           } 
             
              
    m++;      
            
           
                  
           });  
           
             
    newPrice newbasePrice;
           
             
    newbasePrice this_.settings.product_config.total_price;            
           
           
    l++; 
           
           });  
           
           
           
            
           
                       
           var 
    totalSum parseFloat(newPrice).toFixed(2);
                        
           var 
    sumTohidden =  parseFloat(newPrice).toFixed(2);
                                   
           $(
    '.product_' this_.settings.product_config.product_id '  .zubehoer-preis span').html(totalSum);
                       
           $(
    '.product_' this_.settings.product_config.product_id '  .total').val(sumTohidden); 
                         
           $(
    '.product_' this_.settings.product_config.product_id ' td div div button').attr('item-price'sumTohidden); 

         

           return 
    sumTohidden;


    Hier das Plugin mit den Werten:

    PHP-Code:

     properties 
    = []; 
             
             
    selected = [];                    
                                                                                                                                                                                                                                                  
             
    productConfig = $('.product_42161').productConfig({
             
            
             
    product_config: {

                      
                      
             
    priceConfig : [ 'm:2','a:1.72','a:1.72' ], 
                                 
             
    properties : [ 'laenge','1','farbe','2','2' ],
             
             
             
             
            
             
    levelWithProductIDS : [2],
             
             
    ist_farbe : [2],
             
             
    affects_globals : [0],
             
       
             
             
    all_article_ids : { article_ids: ['14617','14600'], constricted: {_1: [], _2: []} },
             
                      
             
    selected : [ '/2000','/oxidrot' ],
                          
              
    to_insert_key_for_free_length1,                  
                                                                                                                                                                    
              
    productkeys : { '0' : ['AKW/312'] ,  '1': ['/2000'  ], '2': ['/oxidrot' '/anthrazit'  ]  },
              
              
    cut'',
             
    freelength'',
             
             
    product_id42161,
             
    total_price'10.85',
             
                               
    width312
                      
             
    rabattKeys: {         },
                      
                      
    isReg
             
                       
             
    }
             
            
             });
             
             }); 

  2. #2
    Benutzer
    Registriert seit
    31.10.2012
    Beiträge
    61
    Hab es gelöst. Ich hatte übersehen, dass einige Settings nur einen Array - Wert hat

    So geht es:

    PHP-Code:

    defaultEqPrices
    : function(thatglobalkey) {
                


     var 
    this_ that
     
          var 
    basePrice this_.settings.product_config.total_price;
          
          var 
    newbasePrice this_.settings.product_config.total_price;
          
          var 
    multiplicaton_of_price 0;
          
          var 
    newPriceTemp 0;
          
          var 
    newPrice 0;
          
          var 
    beforecolorUpgrade 0;
                 
          var 
    searchkey this_.settings.product_config.productkeys;
          
          var 
    collect searchkey[0];
          
          var 
    = -1;  
           
          var 
    selectedIndex_ = -1;
          
           
                  
          $.
    each(searchkey, function( korders ) { 
                              
           
           var 
    priceIndex 1;              
                    
         
           
                                        
                                                        
           if(
    this_.settings.product_config.priceConfig[priceIndex] != undefined) { 
                                                             
           var 
    priceConfig this_.settings.product_config.priceConfig[priceIndex]; 
                                             
                          var 
    witchPrice priceConfig.split(':');
                               
                                       
           
                          if(
    witchPrice[0] == "a") {
                          
                          
    multiplicaton_of_price = (((parseFloat(witchPrice[1]) * 100) / basePrice) / 100) + 1;
                                 
                          } else {                    
                           
                          
    multiplicaton_of_price parseFloat(witchPrice[1]);
                                                                                                                                           
                          }
                          
                                     
                                                                       
                          
    newbasePrice *= multiplicaton_of_price;
                          
                                
                          
                                            
                            
                                
           } 
             
      
           
                       
           
           
    l++;  
           
           });  
           
           
           
           
    newPrice newbasePrice;   
           
                       
           var 
    totalSum parseFloat(newPrice).toFixed(2);
                        
           var 
    sumTohidden =  parseFloat(newPrice).toFixed(2);
                                   
           $(
    '.product_' this_.settings.product_config.product_id '  .zubehoer-preis span').html(totalSum);
                       
           $(
    '.product_' this_.settings.product_config.product_id '  .total').val(sumTohidden); 
                         
           $(
    '.product_' this_.settings.product_config.product_id ' td div div button').attr('item-price'sumTohidden); 

         

           return 
    sumTohidden;

    }, 

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •