Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    6
    Plugin Contributions
    0

    Default Does Easy Populate 1-2-5-5-csv require PHP5?

    Hi,

    The dowload page for Easy Populate v1-2-5-5-csv-2 says that "It now works on PHP4. (before it was just php5)".

    Is this correct? I've just found a problem running EP on PHP4 that went away when I upgraded to PHP5.

    I installed EP v1-2-5-5-csv-2 with Zen Cart 1.3.8a, on a fresh install with the demo database, on a Mac OS-X 10.4, PHP4, Apache 1.3.41

    I downloaded the Complete CSV, made a small change to the first product description and uploaded the file.

    The process ran silently - it gave no errors nor result info (i.e. a summary of the records that were uploaded) on the screen, and the change was not uploaded. Also, there were no errors in the admin/errorlogphp file.

    I upgraded to PHP 5.2, and the upload now runs fine!

    Has anyone else noticed similar behaviour?

    Thanks

    Damian H.

  2. #2
    Join Date
    Dec 2005
    Posts
    460
    Plugin Contributions
    0

    Default Re: Does Easy Populate 1-2-5-5-csv require PHP5?

    This may help you?

    Quote Originally Posted by phazei View Post
    Unfortunately, I do have some ideas, but nothing that will help. Something I should have stated in my first post to this thread. I mentioned it in the other forum...

    1.2.5.5.CSV will ONLY work with PHP > v5.1

    fgetcsv existed in PHPv4, but fputcsv was only added in v5.1

    There are custom fputcsv functions that could be put at the begining of the file that would make it work with PHP4.

    I just did a quick google search and found this:

    PHP Code:
    if (!function_exists('fputcsv')) {
        function 
    fputcsv(&$handle$fields = array(), $delimiter ','$enclosure '"') {
            
    $str '';
            
    $escape_char '\\';
            foreach (
    $fields as $value) {
                
    settype($value'string');
                if (
    strpos($value$delimiter) !== false ||
                    
    strpos($value$enclosure) !== false ||
                    
    strpos($value"\n") !== false ||
                    
    strpos($value"\r") !== false ||
                    
    strpos($value"  ") !== false ||
                    
    strpos($value' ') !== false) {
                    
                    
    $str2 $enclosure;
                    
    $escaped 0;
                    
    $len strlen($value);
                    for (
    $i=0;$i<$len;$i++) {
                        if (
    $value[$i] == $escape_char) {
                            
    $escaped 1;
                        } else if (!
    $escaped && $value[$i] == $enclosure) {
                            
    $str2 .= $enclosure;
                        } else {
                            
    $escaped 0;
                        }
                        
    $str2 .= $value[$i];
                    }
                    
    $str2 .= $enclosure;
                    
    $str .= $str2.$delimiter;
                } else {
                    
    $str .= $value.$delimiter;
                }
            }
            
    $str substr($str,0,-1);
            
    $str .= "\n";
            return 
    fwrite($handle$str);
        }

    I don't know if it works, but I hope it does



    Since most of the code for the attributes options is there it probably wouldn't be that hard to make it work.

    I thought there was a column added to the db to get quantity discounts to work in that other version. I didn't want to add anything that would require someone to have to modify the db in any way. I wanted it to be as plug and play as possible.

 

 

Similar Threads

  1. v150 Easy Populate 4 vs. Easy Populate CSV - What's going on with so many Easy Populates?
    By oleancomputers in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 20 Jun 2013, 05:58 PM
  2. Replies: 1
    Last Post: 3 Mar 2011, 07:34 AM
  3. Easy Populate CSV cannot upload csv files
    By alimtlai in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 29 Sep 2009, 02:22 PM
  4. easy populate 1.2.5.5.csv - fetch_array error on .csv generation
    By emmtqg in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 4 Sep 2009, 07:10 PM
  5. Replies: 0
    Last Post: 2 Sep 2009, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg