błąd w najnowszej wersji quick cart 3.6

euphoria-art

Avatar: euphoria-art

2010-07-08 15:42

Hej czy ktos też tak ma w najnowszej wersji 3.6 że po dodaniu produktu i zdjęć do niego, następnie po usunięciu tego produktu wraz z plikami wywala w adminie błędy:

Warning: Invalid argument supplied for foreach() in /home/euphoria/domains/xxxl/public_html/test/core/files-admin.php on line 209

Warning: Cannot modify header information - headers already sent by (output started at /home/euphoria/domains/xxxl/public_html/test/core/files-admin.php:209) in /home/euphoria/domains/xxxl/public_html/test/actions_admin/products.php on line 72
Produkty bez zdjęć są normalnie usuwane, nie wyświetlają się żadne błędy
W wersji 3.5 nie mam tego problemu

» Quick.Cart v3.x

Makaron

Avatar: Makaron

2010-07-08 16:28

Teraz sprawdziłem i nie ma takiego błędu.

www.mak-web.pl - modyfikacje QC i QCMS

euphoria-art

Avatar: euphoria-art

2010-07-08 17:12

to ja nie wiem, może błąd jest u mnie z powodu providera

http://www.obrazygaleria.pl

Makaron

Avatar: Makaron

2010-08-18 09:16

Zwracam honor. Błąd taki faktycznie pokazywać się będzie, jeśli do żadnej podstrony nie będzie dodane zdjęcie. Trzeba dodać kod:

if( isset( $this->aFilesImages[$iDbLinkType] ) ){


miedzy foreachami w funkcji deleteFilesFromDirs czyli całość będzie
wyglądać tak:

function deleteFilesFromDirs$sFileName$iImage$iLinkType$iFile ){
   
$aFiles $this->throwDbNames( );
   
$sKey = ( $iLinkType == ) ? 'iPage' 'iProduct';
   
$iLink $this->aFilesImages[$iLinkType][$iFile][$sKey];
   foreach( 
$aFiles as $iDbLinkType => $sDbName ){
     if( isset( 
$this->aFilesImages[$iDbLinkType] ) ){
       foreach( 
$this->aFilesImages[$iDbLinkType] as $aFile ){
         
$bDelete true;

Mak-Web.pl - Modyfikacje skryptów Q.Cart i Q.Cms

euphoria-art

Avatar: euphoria-art

2010-08-19 15:16

hej, tylko w jakim pliku to zmienić, pozdro

Makaron

Avatar: Makaron

2010-08-19 16:06

Plik core/files-admin.php.

Mak-Web.pl - Modyfikacje skryptów Q.Cart i Q.Cms

euphoria-art

Avatar: euphoria-art

2010-08-19 20:28

Niestety u mnie nie zadziałało, po zmianie w 204 linijce posypały się inne błedy, nie działa wcale panel admina
sprawdzałem kilka krotnie zmian dokonałem według instrukcji

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/euphoria/domains/obrazygaleria.pl/public_html/test/core/files-admin.php on line 562

euphoria-art

Avatar: euphoria-art

2010-08-19 21:06

wziąłem plik core/files-admin.php. z wersji 3.5, po podmianie działa lux w wersji 3.6 bez żadnych błędów, tylko nie wiem czy to najlepsze rozwiązanie.

Cinek.ck

Avatar: Cinek.ck

2010-08-20 01:47

Chyba jeszcze trzeba dodać " } " po $bDelete = true;. Wtedy chyba błędu nie będzie.

lordofhares.com

beholder

Avatar: beholder

2010-08-20 13:52

Makaron, can you please add some sense to this in English? is this some bug in 3.6 we should know about?

Makaron

Avatar: Makaron

2010-08-20 15:46

@beholder: We have noticed that on some servers one bug appears in Quick.Cart 3.6. When You haven't add any picture to one of pages and You try to delete product with pictures there is error which is mentioned in first post:
Warning: Invalid argument supplied for foreach() in .../files-admin.php on line 209
So we have small solution for that. You should edit file core/files-admin.php and add one if statement in deleteFilesFromDirs() function so whole function should look like this:

  /**
  * Delete files from directories
  * @return void
  * @param string $sFileName
  * @param int    $iImage
  * @param int    $iLinkType
  * @param int    $iFile
  */
  
function deleteFilesFromDirs$sFileName$iImage$iLinkType$iFile ){
    
$aFiles $this->throwDbNames( );
    
$sKey = ( $iLinkType == ) ? 'iPage' 'iProduct';
    
$iLink $this->aFilesImages[$iLinkType][$iFile][$sKey];
    foreach( 
$aFiles as $iDbLinkType => $sDbName ){
         if( isset( 
$this->aFilesImages[$iDbLinkType] ) ){
      foreach( 
$this->aFilesImages[$iDbLinkType] as $aFile ){
        
$bDelete true;

        if( 
$aFile['sFileName'] == $sFileName && ( $iDbLinkType != $iLinkType || $aFile['iFile'] != $iFile ) ){
          if( 
$aFile[$sKey] == $iLink && $iDbLinkType == $iLinkType ){
            
$bDelete true;
          }
          else{
            
$bDelete null;
            break;
          }
        }
      } 
// end foreach
         
}
    } 
// end foreach
    
if( !isset( $bDelete ) ) 
      return 
null;

    if( 
$iImage == && isset( $this->aDirs ) ){
      foreach( 
$this->aDirs as $mDir => $bValue ){
        if( 
is_fileDIR_FILES.$mDir.'/'.$sFileName ) )
          
unlink DIR_FILES.$mDir.'/'.$sFileName );
      }
    }
    if( 
is_fileDIR_FILES.$sFileName ) )
      
unlink DIR_FILES.$sFileName );
  } 
// end function deleteFilesFromDirs



But like i said this bug appears only on some servers I have never face with it on servers which I use.

Mak-Web.pl - Modyfikacje skryptów Q.Cart i Q.Cms

beholder

Avatar: beholder

2010-08-20 17:04

Thanks, interesting.

irekplaza

Avatar: irekplaza

2010-10-05 23:58

Well, it seams to me that the key here is, that (at least in mine file) line about 220 is missing. Preciselly I mean:

} // end foreach
}
} // end foreach

and the line with only "}" was missing.

In explanation of Makaron you can see it, but at least in mine file it was not existing at all. After adding it - no bugs and everything works well.

www.belean.pl

Do góry
o nas | kontakt