Wert aus einem array in ein array schreiben

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • #16
    Hallo,

    ich habe nun noch einmal was anderes versucht, was eigentlich auch funktionieren sollte. *SOLLTE*

    PHP-Code:
                  $productss_query tep_db_query("select 
    p.price_group, ph.photo_size, ph.quantity, ph.photo_id, ph.photo_id, 
    ph.photo_price, ph.tax_class_id from " 
    TABLE_PHOTO_INFO " ph, " 
    TABLE_PRODUCTS " p where p.products_id = '" . (int)$products_id "' 
    and  ph.price_group = p.price_group and ph.language_id  = '" 
    . (int)
    $languages_id "'");

            while(
    $productss tep_db_fetch_array($productss_query)) {

     if( ( 
    $cart_quantity_photo[(int)$products_id.$productss['photo_id']] == ''
    || 
    $cart_quantity_photo[(int)$products_id.$productss['photo_id']] == $productss['quantity']) {
     
    $menge $productss['quantity'];
     } else {
     
    $menge $cart_quantity_photo[(int)$products_id.$productss['photo_id']];
    }
                       
    $size[] = array('photo_size' => $productss['photo_size'],
                                     
    'photo_price' => $productss['photo_price'],
                                     
    'photo_tax' => $productss['tax_class_id'],
                                     
    'id_photo' => $prid,
                                     
    'photo_id' => $productss['photo_id'],
                                     (int)
    $products_id $productss['photo_id'] => $menge);


    nicht einmal das klappt...

    ich setze hier:
    PHP-Code:
    $menge $productss['quantity']; 
    und
    PHP-Code:
    $menge $cart_quantity_photo[(int)$products_id.$productss['photo_id']]; 
    ein echo davor und alles wir richtig angezeigt. Nur nicht hier:
    PHP-Code:

    $size
    [] = array('photo_size' => $productss['photo_size'],
                                     
    'photo_price' => $productss['photo_price'],
                                     
    'photo_tax' => $productss['tax_class_id'],
                                     
    'id_photo' => $prid,
                                     
    'photo_id' => $productss['photo_id'],
                                     (int)
    $products_id $productss['photo_id'] => $menge); 
    an dieser Stelle, wird auch wieder das $menge = $productss['quantity'] benutzt.
    Zuletzt geändert von SLSB02; 17.03.2006, 08:46.

    Kommentar


    • #17
      Halo,

      kann mir denn niemand helfen ?

      mfg
      Zuletzt geändert von SLSB02; 17.03.2006, 12:58.

      Kommentar


      • #18
        was soll die ungeduld?

        das problem liegt anscheinend in der bedingung der if-abfrage bzw. in deiner art mit den arrays umzugehen. ich finde diesen code sehr unübersichtlich und ohne einfache testausgabe sehr schwierig auf entfernung zu debuggen, deswegen überlasse ich es dir.

        Kommentar


        • #19
          Hallo,

          sorry für meine Ungeduld, wird nicht wieder vorkommen.

          Wie soll ich diesen Code denn Übersichtlicher gestalten?

          Folgende Frage, habe ich noch, wenn ich in dieser besagten if Abfrage vor beide variablen ein echo setze, gibt er mir bei der aktualisierung des korbes die richtigen werte aus. Warum noch eins, schreibt er das nicht in das darunter stehen array? Das ist eigentlich das Problem...

          Gruß aus Berlin

          Kommentar


          • #20
            Hallo,

            noch einmal nach vorne schieb...

            Ich habe noch ein wenig Probiert und mir ist folgendes aufgefallen...

            Es wird ein array $products_array erstellt, wenn ein Artikel in den Warenkorb gelegt wird. In diesem ist auch das array $size enthalten.
            Wenn nun der Warenkorb aktualisiert wird, wird das array $products_array neu erstellt. Nur wird das "neue" array $size nicht übernommen...
            Soweit, bin ich nun schon.

            PHP-Code:
                             $size[] = array('photo_size' => $productss['photo_size'],
                                             
            'photo_price' => $productss['photo_price'],
                                             
            'photo_tax' => $productss['tax_class_id'],
                                             
            'id_photo' => $prid,
                                             
            'photo_id' => $productss['photo_id'],
                                             (int)
            $products_id $productss['photo_id'] => $menge);

                      
            $products_array[] = array('id' => $products_id,
                                                
            'name' => $products['products_name'],
                                                
            'model' => $products['products_model'],
                                                
            'image' => $products['products_image'],
                                                
            'price' => $products_price,
                                                
            'photo' => $size,
                                                
            'price_group' => $products['price_group'],
                                                
            'quantity' => $this->contents[$products_id]['qty'],
                                                
            'weight' => $products['products_weight'],
                                                
            'tax_class_id' => $products['products_tax_class_id'],
                                                
            'attributes' => (isset($this->contents[$products_id]
            [
            'attributes']) ? $this->contents[$products_id]['attributes'] : '')); 
            also es soll heißen, das der richtige Wert an $size übergeben wird nur eben nicht an $products_array...

            wenn ich aber im dem array $size etwas per Editor ändere, den Warenkorb aktualisiere, ist der neue / geänderte Wert in dem array $products_array.
            Warum geht das nicht mit $size wo wie ich es haben will?

            Ich hoffe, das wir eine Lösung finden...
            Zuletzt geändert von SLSB02; 17.03.2006, 20:13.

            Kommentar


            • #21
              Hallo,

              ich hänge leider immernoch an dieser abfrage ! Hat jemand eine lösung für dieses phänomen ?

              mfg

              Kommentar

              Lädt...
              X