Rank: Member
Groups: Member
Joined: 3/5/2004(UTC) Posts: 13
|
We would like to use the Load User Info Feature. But we want to use it on the fly. That is we want to click a button and have a popup form display that has the blank form fields for each field that my customer can fill in and the submit. Submitting it would fire the click event for the "Load My Info" button.
Any direction? Marty
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 8/19/2016(UTC) Posts: 33
Was thanked: 1 time(s) in 1 post(s)
|
Moegal, You can pass user data to the editor with loadUserInfo() method at runtime. Try the following: 1. Add some button that will create a popup form. 2. In the form call the loadUserInfo() method for Submit button when onclick event caused, e.g.: Code:
...
// load web-to-print editor
CustomersCanvas.IframeApi.loadEditor(iframe, product, configuration)
.then(function (e) {
// retrieve the loaded editor
editor = e;
$(#submitBtn).onclick = onUserInfoSubmit;
});
function onUserInfoSubmit() {
...
// populate a product with a user data
editor.loadUserInfo({ data: {"FirstName": "Jon", "LastName": "Snow", "Phone": "0123456789", "Email": "john.snow@mail.com"} })
...
};
Edited by user Wednesday, October 26, 2016 3:58:09 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/5/2004(UTC) Posts: 13
|
I will give it a try.
Seems easy enough.
Marty
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/5/2004(UTC) Posts: 13
|
Is there any way to read the fields on the psd design so I can create a form that matches the desired fields?
Marty
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 8/19/2016(UTC) Posts: 33
Was thanked: 1 time(s) in 1 post(s)
|
Yes, sure. Use in-string and image placeholders to implement it. Find more here: http://customerscanvas.c...user-data.htm#loadmyinfo (from sentense "The data to populate a product with should be loaded from your e-commerce system...") Let me know if you need help with it.
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/5/2004(UTC) Posts: 13
|
Julia,
Actually I want to know if i can get a list of the actual placeholder names as json(or other) at run-time. For example: lets say i have two separate designs. Design "A" has placeholders FirstName, LastName, and Email. Design "B" has placeholders FullName, and Address.
I would like to show a form that only contains FirstName, LastName, and Email for design "A" and only display FullName, and Address for design "B".
Marty
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 8/19/2016(UTC) Posts: 33
Was thanked: 1 time(s) in 1 post(s)
|
Moegal, We have prepared you a sample that shows how to get the product elements name. Find it attached. I hope this will help you. Julia product-items.zip (2kb) downloaded 16 time(s).
|
|
|
|
Rank: Member
Groups: Member
Joined: 3/5/2004(UTC) Posts: 13
|
I am getting an error when I try your code. UpdateUserInfo failed 400 (Parameter data cannot be null) and /canvas/Resources/Export/simplePolygraphyScripts?v=KAqZ7xnMCpkR3r0JRBYd58KAjV3tjzM3MRfzQz2EKKc1:1:41 Originally Posted by: Julia Khoptyan Moegal, You can pass user data to the editor with loadUserInfo() method at runtime. Try the following: 1. Add some button that will create a popup form. 2. In the form call the loadUserInfo() method for Submit button when onclick event caused, e.g.: Code:
...
// load web-to-print editor
CustomersCanvas.IframeApi.loadEditor(iframe, product, configuration)
.then(function (e) {
// retrieve the loaded editor
editor = e;
$(#submitBtn).onclick = onIserInfoSubmit;
});
function onUserInfoSubmit() {
...
// populate a product with a user data
editor.loadUserInfo({ data: {"FirstName": "Jon", "LastName": "Snow", "Phone": "0123456789", "Email": "john.snow@mail.com"} })
...
};
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 8/19/2016(UTC) Posts: 33
Was thanked: 1 time(s) in 1 post(s)
|
Moegal, Sorry for the delay. See the attached example. loadUserInfoExample.zip (3kb) downloaded 18 time(s).-Julia. Edited by user Thursday, October 27, 2016 1:58:54 AM(UTC)
| Reason: Not specified
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.