Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
jasontomczak, are there any myDebug*.log files in your store's /logs directory?
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Quote:
Originally Posted by
lat9
jasontomczak, are there any myDebug*.log files in your store's /logs directory?
Yes. Here it is, with my server path obscured:
[16-Feb-2013 14:32:47] PHP Warning: Invalid argument supplied for foreach() in /store/oooooo/add_customers.php on line 129
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Would you send me either the full or a partial CSV file via PM so that I can "play" with it and see what's going on?
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
I downloaded your file and can verify that I receive the same behavior (screen just refreshes), but I don't get any log files (I'm running PHP 5.3.8). What version of PHP are you running?
I most likely won't be able to get more into this until tomorrow ...
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Quote:
Originally Posted by
lat9
I downloaded your file and can verify that I receive the same behavior (screen just refreshes), but I don't get any log files (I'm running PHP 5.3.8). What version of PHP are you running? I most likely won't be able to get more into this until tomorrow ...
Looks like PHP 5.2.x. Not sure which subversion, but 5.2-something. Tomorrow is fine. Thanks! :D
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
What OS are you running and what program are you using to create the CSV file? The file you sent me has only <CR>, not <CR><LF> at the end of each line.
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Gotta love www.php.net! I'll get an update together within the next couple of days. In the interim, you'll need to edit /YOUR_ADMIN/add_customers_backend.php, adding one line and changing another around line 40:
Code:
...
function check_file_upload() {
global $db, $row_positions, $post, $acfa_lines;
$files = $_FILES['bulk_upload'];
$errors = array();
$to_insert = array();
if (!zen_not_null($files['name'])) {
$errors[] = ERROR_NO_UPLOAD_FILE;
} else {
if ($files['error'] != 0) {
$errors[] = sprintf (ERROR_FILE_UPLOAD, $files['error']);
} else {
$pos = strrpos($files['name'],'.')+1;
$allowed_extensions = array ( 'TXT', 'CSV' );
$extension = substr ($files['name'], $pos);
if ( (strlen ($extension) < 1 ) || !in_array(strtoupper($extension), $allowed_extensions) ) {
$errors[] = sprintf (ERROR_BAD_FILE_EXTENSION, $extension) . implode(', ', $allowed_extensions);
} else {
$path = DIR_FS_UPLOADS . $files['name'];
if (!move_uploaded_file($files['tmp_name'], $path)) {
$errors[] = ERROR_CANT_MOVE_FILE;
} else {
chmod($path, 0775);
ini_set("auto_detect_line_endings", true); /*v2.0.3a*/
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); /*v2.0.3c*/
...
I'll also beef up some of the error-detection that's present in the files ...
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Quote:
Originally Posted by
lat9
What OS are you running and what program are you using to create the CSV file? The file you sent me has only <CR>, not <CR><LF> at the end of each line.
Using OS X Mountain Lion and Excel for the CSV. I saved it in Windows Comma Separated format.
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
Quote:
Originally Posted by
lat9
Gotta love
www.php.net! I'll get an update together within the next couple of days. In the interim, you'll need to edit /YOUR_ADMIN/add_customers_backend.php, adding one line and changing another around line 40:
Code:
...
function check_file_upload() {
global $db, $row_positions, $post, $acfa_lines;
$files = $_FILES['bulk_upload'];
$errors = array();
$to_insert = array();
if (!zen_not_null($files['name'])) {
$errors[] = ERROR_NO_UPLOAD_FILE;
} else {
if ($files['error'] != 0) {
$errors[] = sprintf (ERROR_FILE_UPLOAD, $files['error']);
} else {
$pos = strrpos($files['name'],'.')+1;
$allowed_extensions = array ( 'TXT', 'CSV' );
$extension = substr ($files['name'], $pos);
if ( (strlen ($extension) < 1 ) || !in_array(strtoupper($extension), $allowed_extensions) ) {
$errors[] = sprintf (ERROR_BAD_FILE_EXTENSION, $extension) . implode(', ', $allowed_extensions);
} else {
$path = DIR_FS_UPLOADS . $files['name'];
if (!move_uploaded_file($files['tmp_name'], $path)) {
$errors[] = ERROR_CANT_MOVE_FILE;
} else {
chmod($path, 0775);
ini_set("auto_detect_line_endings", true); /*v2.0.3a*/
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); /*v2.0.3c*/
...
I'll also beef up some of the error-detection that's present in the files ...
SUCCESS!! It worked that time! Thank you thank you!
Re: Customizing the Add Customers form to include Wholesale/Retail pricing option
I've submitted v2.0.3 to the Plugins area; that version includes the change identified above and some additional error-checking on the imported CSV file.