IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#24947 - 06/23/08 10:12 AM Printing user info in variable documents
P. Brittle Offline
Member

Registered: 04/02/04
Posts: 37
We produce forms for individual groups within departments. Each group has it's own ID number. The forms are the same for all groups within the department but need to have the group's ID number printed on it.

Also, the user for that group is the contact for its group members.

How can we use any or all of the user's information from PSW to print on their forms when they are placing an order?
_________________________
P. Brittle

Top
#24948 - 06/23/08 11:52 AM Re: Printing user info in variable documents
cosimo Offline
OL Expert

Registered: 10/31/01
Posts: 1286
Loc: montreal
Hi,

PrintShop Web does not have a build in feature to achieve this. There is
a way to overcome this using the skinning engine providing an even
greater flexibility.

The steps below describe how the 'Person Code' of a user account can be
used to populate a user input field. One could misuse this field to
store the groupid code.

Preparing your PrintShop Mail document
1) Open a PrintShop Mail document and create a datafield called 'groupid'
2) Publish the document to PrintShop Web.

Preparing your web site skin
1) Locate the template.php of your PSW web site skin (e.g. C:\Program
Files\PrintShop Web\Website\templates\default).
2) Add the following code snippet to the end of this file and store the
changes
Code:
<? if($_SESSION[nav][cPageID] == "preview_userinput"){ ?>
    <script language="JavaScript1.2">
        var inputField = $("span:contains('Groupid:') ~ input")
        inputField.attr('value','<? echo $_SESSION[User][fcPersonCode]; 
?>').attr('readonly','readonly');
    </script>
<? } ?>
  
3) Launch your browser and log on to PSW
4) Create a new document based on the uploaded template. The input field
of the GroupID variable is automatically populated and its appearance is
set to read only.

The code snippet combines PHP and JavaScript (jQuery). It locates the
input field of the 'groupid' field and populates this with the Person
Code of the logged in user. In addition the field is set to 'read only'
preventing the user to override the data. This is just an example which
can be expanded and altered to match your workflow (an example would be
adding an ajax request to call a PHP file that retrieves ids from a
database or data file using the users information).

Thanks
Cosimo

Top
#24949 - 09/26/08 09:14 AM Re: Printing user info in variable documents
P. Brittle Offline
Member

Registered: 04/02/04
Posts: 37
Thanks Cosimo! That is an excellent solution!!
_________________________
P. Brittle

Top
#24950 - 09/26/08 10:21 AM Re: Printing user info in variable documents
P. Brittle Offline
Member

Registered: 04/02/04
Posts: 37
Is there a way I can get a list of session variables that exist for each page page?
_________________________
P. Brittle

Top
#24951 - 09/26/08 10:37 AM Re: Printing user info in variable documents
cosimo Offline
OL Expert

Registered: 10/31/01
Posts: 1286
Loc: montreal
Hi,

The code below will do the trick, it shows all variables of the current user session:

Code:
 <pre><?php print_r($_SESSION[User]); ?></pre> 
Add this line to the template.php file and refresh your browser window.

Thanks
Cosimo

Top