Assigning Uploads to Multiple Records so links to downloads appear on record.
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 25, 2010 (RSS)
By Mikey - November 24, 2010 - edited: November 24, 2010
I've got to build a site for a business that has multiple franchises. The business needs to supply the franchisees instructional PDF documents ranging from A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y & Z. Some franchisees get instructional documents A & B, other franchisees may get documents A,C, D S, T, U, V, while other franchisees may get instructional documents B, C, D, L, M, N, O and so on.
Uploading each franchisees' instructional PDF files to their own Multi record is not an option, because of the quantity of Instructional PDF files and the total number of franchisees, would mean hours of time spent uploading new documents repeatedly to each franchisee.
Where as if I can create a relationship between the PDF downloadable files category and the Franchise, then if and when the client needs to update an instructional PDF file, they would only need to upload the new PDF file once to effect all franchisees.
I need to create a method where I can upload a single instance of each instructional PDF document and assign the upload to the franchise that is allowed to see the instructional PDF files they should see on their franchise site page.
I've created a menu type Category in the section editors called "Instructional Documents" where I have uploaded each PDF files as a single record. Now I need to create a Multi section where I'll create records for each franchise, and use some kind of field (pulldown - multi value) to assign the instruction PDF files the franchise has access to.
The end result is I need each franchise page, to show a list of the Instructional PDF files as links to download the Instructional PDF files that are assigned to the franchise and no other PDF files that are not assigned to the franchise.
Anyone have suggestions on how to achieve this?
Uploading each franchisees' instructional PDF files to their own Multi record is not an option, because of the quantity of Instructional PDF files and the total number of franchisees, would mean hours of time spent uploading new documents repeatedly to each franchisee.
Where as if I can create a relationship between the PDF downloadable files category and the Franchise, then if and when the client needs to update an instructional PDF file, they would only need to upload the new PDF file once to effect all franchisees.
I need to create a method where I can upload a single instance of each instructional PDF document and assign the upload to the franchise that is allowed to see the instructional PDF files they should see on their franchise site page.
I've created a menu type Category in the section editors called "Instructional Documents" where I have uploaded each PDF files as a single record. Now I need to create a Multi section where I'll create records for each franchise, and use some kind of field (pulldown - multi value) to assign the instruction PDF files the franchise has access to.
The end result is I need each franchise page, to show a list of the Instructional PDF files as links to download the Instructional PDF files that are assigned to the franchise and no other PDF files that are not assigned to the franchise.
Anyone have suggestions on how to achieve this?
Re: [zick] Assigning Uploads to Multiple Records so links to downloads appear on record.
By Jason - November 25, 2010
Hi Zick,
It sounds like you pretty much have this worked out. You should set your Instructional Documents section as a multi-record section rather than a category section.
Have a multi-select drop down list in your franchise section that pulls data in from your Instructional Documents section. You can use whichever value you want for the label, but you should use the num field for the value.
On your franchise page, you just need to select all the Instructional Documents records where that record has been selected for that franchise.
CMS Builder stored multi-select values as a string separated by tab characters (\t).
You can use something like this:
In this example, $franchise is the record from the franchise record your displaying and the multi-value drop down field in that section is called "instructional_documents". At the end of this code, $documentRecords is all the record from the Instructional Documents section that were selected in the franchise section.
Give this a try and let me know if you run into any problems.
It sounds like you pretty much have this worked out. You should set your Instructional Documents section as a multi-record section rather than a category section.
Have a multi-select drop down list in your franchise section that pulls data in from your Instructional Documents section. You can use whichever value you want for the label, but you should use the num field for the value.
On your franchise page, you just need to select all the Instructional Documents records where that record has been selected for that franchise.
CMS Builder stored multi-select values as a string separated by tab characters (\t).
You can use something like this:
$documentNums = str_replace("\t",",",trim($franchise['instructional_documents'],"\t"));
if(!$documentNums){$documentNums = 0;}
list($documentRecords,$documentMetaData)=getRecords(array(
'tableName' => 'instructional_documents',
'allowSearch' => false,
'where' => "num IN (".mysql_escape($documentNums).")",
));
In this example, $franchise is the record from the franchise record your displaying and the multi-value drop down field in that section is called "instructional_documents". At the end of this code, $documentRecords is all the record from the Instructional Documents section that were selected in the franchise section.
Give this a try and let me know if you run into any problems.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/