File Upload Required addon [Support Thread]
Allows a file attribute (optionally) to be required, similar to text attributes.
Errors resulting from insufficiently large values of post_max_size and upload_max_filesize are handled and errors resulting from failed upload attempts now prevent products from being added to the basket.
Cautions and advice regarding the setting of post_max_size and upload_max_filesize in relation to Maximum File Upload Size in the Zen Cart admin are displayed at the top of the Zen Cart admin if the settings are detected to be inappropriate.
Under Admin->Catalog->Attributes Controller the option "Attribute Required for Text" is changed to "Attribute Required for File/Text".
Download Link: http://www.zen-cart.com/index.php?ma...oducts_id=1685
Please report any bugs/issues here
Thank you,
sj
Re: File Upload Required [Support Thread]
sj,
I just installed 1.3.9g fresh, then I carefully followed your installation instructions.
When I add go to the Attribute Controller, Add an Option then Insert (regardless of what is selected, addeded, etc). I'm getting a page with a single "f" displayed. Nothing in the Page Source, either.
Any ideas?
Re: File Upload Required [Support Thread]
I found the problem. The includes/languages/english/attributes_controller.php file had an 'f' as the first character of the file. Deleted it and we're good.
Re: File Upload Required [Support Thread]
Ok... The Admin side works. I can require the upload field.
Now when I test the cart (using the classic "out of the box") cart (No other modules installed), I'm getting another blank screen when I "add to cart" with or without an uploaded file. Page source is blank.
Re: File Upload Required [Support Thread]
Found the problem... I had made a minor modification to the upload.php file. By comparing the original with the new I was able to find my error. Sorry!
Re: File Upload Required [Support Thread]
Common bug:
The file upload is not required and a required text upload is also not required (check this if you are still not able to require the file upload). The item is simply added to the basket despite the text upload/file upload being required.
Possible Cause:
Missing database entries (not sure what causes this).
Solution:
-> Backup your database
-> Check that the following lines are missing from your database
-> Use "Admin->Tools->Install SQL Patches" to install the missing lines.
PHP Code:
INSERT INTO `configuration` VALUES ('', 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Upload prefix', 'UPLOAD_PREFIX', 'upload_', 'Prefix used to differentiate between upload options and other options', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Text prefix', 'TEXT_PREFIX', 'txt_', 'Prefix used to differentiate between text option values and other option values', 0, NULL, '2007-03-19 17:57:39', '2007-03-19 17:57:39', NULL, NULL);
INSERT INTO `configuration` VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(')
Thank you to grantc for this fix.
Original post:
http://www.zen-cart.com/forum/showpo...3&postcount=20
Re: File Upload Required [Support Thread]
Is this line supposed to be run if you don't use IH2?
PHP Code:
INSERT INTO `configuration` VALUES ('', 'Image Handler Version', 'IH_VERSION', '2.0', 'This is used by image handler to check if the database is up to date with uploaded image handler files.', 0, 100, NULL, '2007-06-06 16:47:03', NULL, 'zen_cfg_textarea_small(')
Re: File Upload Required [Support Thread]
Re: File Upload Required [Support Thread]
Having a bit of an issue: After installing, I am able to require the upload however, after creating new (non-file related) options am unable to set values for the new option. Recieve a duplicate entry error.
I created the Upload option first and it's ID is therefore '1'. it appears that any additional names are also given the ID of '1' when attempting to add option values and therefore a duplicate of the first named option (at least that's what it seems to be). Even though the option name is given a unique ID, in the option values it seems to always be '1'.
This is the error that appears:
1062 Duplicate entry '1-1' for key 1
in:
[insert into zen_products_options_values (products_options_values_id, language_id, products_options_values_name, products_options_values_sort_order) values ('1', '1', 'testing', '3')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Also, no matter what type of option I choose, they all show up as TEXT in the settings for the Attribute Controller.
Any ideas where the problem might lie (operator error or otherwise)?
Thanks
Re: File Upload Required [Support Thread]
Problem Solved... I thought above issue was a problem associated with the "File Upload Required," however it was a database issue where deleted options were not removed from the database...
Thanks to DrByte (and his input in the regular forum) I was able to cure the issue...
Run this from SQL Patches in the Tool menu:
delete from products_options_values where products_options_values_id > 0;
Re: File Upload Required [Support Thread]
Just want to say thanks for this mod!
I was able to get it to work on a v1.3.8a install without an issue.
Re: File Upload Required [Support Thread]
I guess I spoke too soon.... :blush:
I have that "f" in the top left when viewing Admin page and I also have that message below the "f" stating:
Quote:
php.ini setting post_max_size is less than double Maximum File Upload Size, file uploads will not function correctly.
So if I understand this correctly I might be able to update my .htaccess file
I guess the question is this... what line or modfication do I have to do to the .htaccess file to get this message to go away?
Thanks in advance!
Re: File Upload Required [Support Thread]
Fixed both issues:
1. Removed the "f" from attributes_controller.php from the mod.
2. Updated the Admin>Configuration>Maximum Values>Maximum File Upload Size to 4000000 and that change cleared the php.ini error message.
Re: File Upload Required [Support Thread]
Glad you were able to fix your problems jasmel and masantner.
Thank you jasmel for pointing out the typo "f" at the top of admin/includes/languages/english/attributes_controller.php.
I'm not quite sure how that slipped through all this time! You have a keen eye! :D I have resubmitted a version with this bug corrected and it should be available within the next week or so. :oops:
Regarding the setting of post_max_size and upload_max_filesize in general:
Problem:
You are given one or both of the following warning messages at the top of your Zen Cart Admin page.
-> "php.ini setting post_max_size is less than double Maximum File Upload Size, file uploads will not function correctly."
-> "php.ini setting upload_max_filesize is less than Maximum File Upload Size, file uploads will not function correctly."
Cause:
-> Values of upload_max_filesize and post_max_size in your php.ini size are not compatible with the value of Maximum File Upload Size in your Zen Cart admin.
Solution:
-> Note: Not all servers allow you to alter php.ini or use .htaccess to alter php settings. If the below solution does not work you should contact your server administrator.
-> Set Admin->Configuration->Maximum Values->Maximum File Upload Size to the maximum file size you want to allow users to upload. The value of Maximum File Upload size is in bytes (The default value of 2048000 bytes = 1.95 megabytes. Jasmel's setting of 4000000 bytes = 3.81 megabytes)
-> If you are still being given the warning messages you need to calculate the correct values of upload_max_filesize and post_max_size and alter them in either php.ini or .htaccess, follow the steps below.
-> upload_max_filesize should be a value bigger than Maximum File Upload size.
-> post_max_size should be at least double upload_max_filesize. If you are offering 2 file uploads on a single product then you should set post_max_size to 3 times the value of upload_max_filesize. If you are offering 3 file uploads on a single product set post_max_size to 4 times the value of Maximum File Upload size and so on.
-> To set these values do ONE of the following:
1) If you have access to your php.ini file, find the lines:
Code:
upload_max_filesize
post_max_size
Change the values to those you calculated above. You can set the size of upload_max_filesize and post_max_size by changing the lines in your php.ini, for example:
Code:
upload_max_filesize = 8M
post_max_size = 16M
Which means 8 megabytes and 16 megabytes respectively.
2) If you do not have access to your php.ini file find the .htaccess file in the root directory of your Zen Cart installation (or make one). Change the values to those you calculated above. You can set the size of upload_max_filesize and post_max_size by adding the following lines to your .htaccess file:
Code:
php_value upload_max_filesize 8M
php_value post_max_size 16M
Where 8M and 16M should be replaced by the values you calculated above.
-> There are also limits on the time an upload is allowed to take. These limits are also controlled by the php.ini file. You can read more about these settings and Maximum File Upload size in Zen Cart here: https://www.zen-cart.com/tutorials/i...hp?article=406
Thanks.
P.S... It's probably worth mentioning that all of these settings are in play even without this modification. They are built into the php language and Zen Cart. All I actually did was add the warning messages to give people some idea when their settings were so grossly wrong that the module was likely to fail.
Re: File Upload Required [Support Thread]
Sorry 3DPeruna.
I've just realised that the error you experienced with the stray "f" was likely the same as jasmel's and was thus my fault.
When I first read your posts I assumed you had accidentially altered a file, when in fact, I had accidentally altered the file!
Sorry again. As I said I have uploaded the module without this critical typo and it should be available within the next week or so. Who knows how many human hours the stray "f" has wasted? Oh dear.
Re: File Upload Required [Support Thread]
Quote:
Originally Posted by
1100101
setting of 4000000 bytes = 3.81 megabytes
I updated my file size notice to the customers with (3.8M) to more accurately reflect the true size limit. - This size is very suitable for a .jpg photo anyways.
Again... thanks for this mod! The "required" set on the file upload works wonderfully and I got my first order with an uploaded photo. (Dora Photo Personalized DVD)
:clap:
Re: File Upload Required [Support Thread]
Is this mod allowing customer to upload files(image and document) from the store site? Where the upload button located after installing?
I want it on customer check out so the uploaded file can be associated to this order. Any demo? Thanks.
Re: File Upload Required [Support Thread]
I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.
Re: File Upload Required [Support Thread]
Quote:
Originally Posted by
gjh42
I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.
I should tell more details of what I need. See if the mod can do.
For example, I'm selling plain white T-shirt. Accepting buyers to provide their own design logo by uploading image or file at the same time placing/checkout order. So the uploaded image/file will come with the order and use same order or invoice number. (It is better file management system). Then I can print the design logo on T-shirt and ship it next day.
Any suggestions would be appreciated.
Re: File Upload Required [Support Thread]
Quote:
Originally Posted by
gjh42
I believe it would affect the standard "file" type attribute in a product. It will not be available after checkout, but while the customer is selecting the product.
I got help from you posted below. Thank you!
http://www.zen-cart.com/forum/showpo...70&postcount=2
Re: File Upload Required addon [Support Thread]
Using this mod and it is working well. Thank you for making this available.:clap: I have a need for the uploaded file to show up in the cart where the product image would normally be.
Has anyone implemented this? Any thoughts on how I might move forward?
Re: File Upload Required addon [Support Thread]
This module fulfills the mandatory requirements- thanks. I did not FTP the files but instead backed up my originals and one-by-one uploaded and replaced each file. I use zen cart 1.3.9.
I have 1 question though: Is there not a consolidated attribute view for each order placed?
I have tested by uploading files with text responses to my custom attributes but I don't know where to find the responses. I have tried the admin interface but cannot see where they are found. I managed to find out where the images I am uploading are being stored but this is not a great deal of help.
I'm guessing the details are supposed to come through on the order confirmation emails to me, the supplier. However since I made the changes, I have not received any order confirmation emails. Also, my stock levels are not updating each time an order is placed. My guess is that I will have to roll back my changes and follow the instructions on post #9 here by manually adding the code to the appropriate files. If anyone has any other suggestions, I would be very grateful to hear from you.