Jump to content
Sign in to follow this  
Iniquityclothing

Easy Populate 2.76f-MS2 r1

Recommended Posts

Hi folks, I have posted this question in the "Easy Populate 2.76f-MS2 r1" topic about two mnths ago but to no avail.

For some reason Easy Populate 2.76f-MS2 r1 will not import the attributes from the .txt file that I specified when I edited it in MS Excel. Everything else imports fine, 'Name', 'Price', 'date' etc but not the attributes.

Any ideas. I have searched high and low for a solution. I have re-installed Easy Populate 2.76f-MS2 r1 to see if a latter amendment to the .php files may have changed something but I still cannot make it work.

 

Thanks for reading hope someone can help,

Best Regards, phil


View recent 'helpfull' threads:

 

403 Error problems | Ultimate SEO (contribution support)

Share this post


Link to post
Share on other sites

Try posting the first 5 lines of your file.


Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Share this post


Link to post
Share on other sites

Hi hope this gives a clue,

//*******************************

//*******************************

// UPLOAD AND INSERT FILE

//*******************************

//*******************************

if (!empty($_POST['localfile']) or (isset($_FILES['usrfl']) && isset($_GET['split']) && $_GET['split']==0)) {

 

if (isset($_FILES['usrfl'])){

// move the file to where we can work with it

$file = tep_get_uploaded_file('usrfl');

if (is_uploaded_file($file['tmp_name'])) {

tep_copy_uploaded_file($file, EP_TEMP_DIRECTORY);

}

 

echo "<p class=smallText>";

echo "File uploaded. <br>";

echo "Temporary filename: " . $file['tmp_name'] . "<br>";

echo "User filename: " . $file['name'] . "<br>";

echo "Size: " . $file['size'] . "<br>";

 

// get the entire file into an array

$readed = file(EP_TEMP_DIRECTORY . $file['name']);

}

if (!empty($_POST['localfile'])){

// move the file to where we can work with it

//$file = tep_get_uploaded_file('usrfl');

 

//$attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id";

//$attribute_options_values = tep_db_query($attribute_options_query);

//$attribute_options_count = 1;

//while ($attribute_options = tep_db_fetch_array($attribute_options_values)){

 

//if (is_uploaded_file($file['tmp_name'])) {

// tep_copy_uploaded_file($file, EP_TEMP_DIRECTORY);

//}

 

echo "<p class=smallText>";

echo "Filename: " . $_POST['localfile'] . "<br>";

 

// get the entire file into an array

$readed = file(EP_TEMP_DIRECTORY . $_POST['localfile']);

}

 

if (EP_EXCEL_SAFE_OUTPUT == true) {

// do excel safe input

unset($readed); // kill array setup with above code

$readed = array(); // start a new one for excel_safe_output

$fp = fopen(EP_TEMP_DIRECTORY . (isset($_FILES['usrfl'])?$file['name']:$_POST['localfile']),'r') or die('##Can not open file for reading. Script will terminate.<br />'); // open file

$header_line = fgets($fp);

if (strpos($header_line,',') !== false) { $ep_separator = ','; }

if (strpos($header_line,';') !== false) { $ep_separator = ';'; }

if (strpos($header_line,"\t") !== false) { $ep_separator = "\t"; }

if (strpos($header_line,'~') !== false) { $ep_separator = '~'; }

if (strpos($header_line,'-') !== false) { $ep_separator = '-'; }

if (strpos($header_line,'*') !== false) { $ep_separator = '*'; }

rewind($fp);

while($line = fgetcsv($fp,32768,$ep_separator)) // read new line (max 32K bytes)

{

unset($line[(sizeof($line)-1)]); // remove EOREOR at the end of the array

$readed[] = $line; // add to array we will process later

}

$theheaders_array = $readed[0]; // pull out header line

fclose($fp); // close file

} else {

// do normal EP input

// now we string the entire thing together in case there were carriage returns in the data

$newreaded = "";

foreach ($readed as $read){

$newreaded .= $read;

}

 

// now newreaded has the entire file together without the carriage returns.

// if for some reason excel put qoutes around our EOREOR, remove them then split into rows

$newreaded = str_replace('"EOREOR"', 'EOREOR', $newreaded);

$readed = explode( $ep_separator . 'EOREOR',$newreaded);

 

// Now we'll populate the filelayout based on the header row.

$theheaders_array = explode( $ep_separator, $readed[0] ); // explode the first row, it will be our filelayout

}

 

$lll = 0;

$filelayout = array();

foreach( $theheaders_array as $header ){

$cleanheader = str_replace( '"', '', $header);

// echo "Fileheader was $header<br><br><br>";

$filelayout[ $cleanheader ] = $lll++; //

}

unset($readed[0]); // we don't want to process the headers with the data

 

// now we've got the array broken into parts by the expicit end-of-row marker.

foreach ($readed as $tkey => $readed_row) {

process_row($readed_row, $filelayout, $filelayout_count, $default_these, $ep_separator, $languages);

}

// isn't working in PHP 5

// array_walk($readed, $filelayout, $filelayout_count, $default_these, 'process_row');

 

This is a portion of the Easypopulate.php Which (i think) defines whatis inserted into the DB. Thanks


View recent 'helpfull' threads:

 

403 Error problems | Ultimate SEO (contribution support)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×