This project is read-only.

NB_Store allows clients to upload files linked to orders. This can be setup by editing the templates to allow the file upload.

Steps to setup in the default templates.

In "Back Office>Utilities>Settings" set the "fileupload.flag" to on. In the default templates a test is made which then displays the file upload control (See below)

<!-- Begin File Upload -->
                        [TAG:TEST:<prop TestType="setting" TestName="disablecart.flag" TestValue="1" Action="Hide" />]
                        [TAG:TEST:<prop TestType="setting" TestName="fileupload.flag" TestValue="0" Action="Hide" />]                
                        [TAG:TEST:<prop TestType="valueof" TestName="FromPrice" TestValue="0.00" Action="Hide" />]<!-- If price is zero then hide -->
                                                <div class="FileUpload Row">
                                                                        <div class="Label">Upload</div>
                                                                        <div class="Value">[TAG:UPLOAD:<prop CssClass="NormalTextBox" />]
                                                                        [TAG:OPTIONVALREGX:<prop ErrorMessage="File must be a pdf,doc or txt." Text="*" ControlToValidate="fuupload" ValidationExpression="^.+\.(doc|txt|pdf|Doc|Txt|Pdf|DOC|TXT|PDF|)$" />]
<!-- End File Upload -->

If you’re not using the default templates then you'll need to simply add the TAG:UPLOAD and TAG:OPTIONVALREGX tokens to your template.

The default template (productdetail.template) only allows PDF,TXT and DOC type files to be uploaded, if you need images files you can alter the validation TAG to something like this:-

[TAG:OPTIONVALREGX:<prop ErrorMessage="File must be a pdf,doc or txt." Text="*" ControlToValidate="fuupload" ValidationExpression="^.+\.(doc|txt|pdf|jpg|png|Doc|Txt|Pdf|Jpg|Png|DOC|TXT|PDF|JPG|PNG)$" />]

Or alternatively simply remove the validation TAG to allow All types of file to be uploaded. NOTE: this is not recommended as exe, bat and js files can then be uploaded which may potentially contain malicious code.


When the client selects a file in the product details and then clicks the buy button the file is uploaded into the portal “orderupload” folder and also the file is renamed to a new GUID name. This is to apply a small amount of security and also to ensure we have a valid filename for the system.

The file which has been uploaded with then be available to the manager of the store by editing the order in the back office, a download link will appear after the description of the products in the product list of the order. If this link does not download the file when clicked a error may have happened during the upload phase.

The file download link can be found in the “detailrows.template” template. The token for the download is “[Detail:FileLink]”. This template is used in a number of different displays, if you want to limit access to the manager of the store only then you’ll need to change the relivant templates to remove this token. The normal practice would be to create a copy of the “detailrows.template” template which does not include the “[Detail:FileLink]” token and then use this new template as the called template in the parent templates that display it.


Because files are attached to a single line in the order, only 1 file upload is allowed per line (product/model) in the order detail table. This also means that if someone added the same product multiple times to the cart and then uploads a files for each one, only the first file attached to the product will be seen by the manager using the download file link. Therefore it is wise to enable a qty limited allowed to be added to the basket for such products. This can be done by editing the model of the product to have a “Allow” value of 1 and set to the “allowcartmodellimit.flag” setting to ON.




Last edited Oct 11, 2013 at 5:16 PM by leedavi, version 2


No comments yet.