top of page

Forum Comments

Get paid plans of a user ID
In Coding with Velo
barb
Jul 21, 2020
So glad I found this thread. I'm trying to display all plans for a currently logged in user. The following code shows one plan (since I couldn't figure out how to list all plans, I listed the most recent one). I haven't tried putting a repeater or table on the page to show all. (I'd need help with that since you normally connect the data collection where the current member orders reside. CurrentMemberOrders is not listed as an available data collection to connect.) This is what I have in on Ready: wixUsers.currentUser.getPricingPlans()  //put offset in parenthesis; to go to 2nd plan, put 1.             .then((pricingPlans) => { let currentPlan = pricingPlans[pricingPlans.length - 1]; let planName = currentPlan.name; let qprice = currentPlan.price; //let benefits = currentPlan.benefits; //let sdate = currentPlan.startDate; let eDate = currentPlan.expiryDate;                 $w('#PlanName').value = currentPlan.name;                 $w('#Price').value = currentPlan.price;                 $w('#ExpirationDate').value = currentPlan.expiryDate.toDateString();             });         wixPaidPlans.getCurrentMemberOrders() ////put offset in parenthesis; to go to 2nd plan, put 1. //function getCurrentMemberOrders([offset: number], [limit: number]): Array             .then((pricingPlans) => { let currentPlan = pricingPlans[pricingPlans.length - 1];                 $w('#PlanStatus').value = currentPlan.status;             }) This is what is displayed for me (I'm a member and an Admin). If I can show all plans, I'm hoping I'll see the plan I paid for as a member. And this is our second year for plans so I want members to see both years. Below is what shows for a test user. I bought a $0 plan so I didn't have to actually pay for something in my test: If there is a paid plan, will the amount show up? Is there a way to display $0 plans? Thanks in advance for any guidance you can provide!
Content media
1
0
New Article: Previous & Next Buttons for Dynamic Item Pages
In Tips, Tutorials, Examples
barb
Apr 20, 2020
This works GREAT! Took only a few minutes. Now I'm trying to figure out how to filter the dataset based on the user's inputs BEFORE saving the URL's. I have 100 pages of galleries and the user can select by year or title keyword. It's this subset of items I want to capture before going to the category page. What could I change to capture URLs in the dataset based on what the user has selected only? Would I add code within my filter functions instead of on ready? This is my page code. Thanks in advance for any help here. (I was delighted to find the article!) import wixData from "wix-data"; import { local } from 'wix-storage'; const linkField = "link-photogalleries-title"; $w.onReady(function () {     $w("#dynamicDataset").onReady(() => { const numberOfItems = $w("#dynamicDataset").getTotalCount();         $w("#dynamicDataset").getItems(0, numberOfItems)             .then((result) => { const dynamicPageURLs = result.items.map(item => item[linkField]);                 local.setItem('dynamicPageURLs', dynamicPageURLs);             })             .catch((err) => {                 console.log(err.code, err.message);             });     }); }) //search by school year export function Year_change(event) { let searchyear = $w("#Year").value;     $w("#dynamicDataset").setFilter(wixData.filter()         .contains("schoolYear", searchyear));     wixData.query("PhotoGalleries")         .contains("year", $w('#Year').value)         .find().then((results) => {         }); } //search by title function title() { let searchtitle = $w("#titleSearch").value;     $w("#dynamicDataset").setFilter(wixData.filter()         .contains("title", searchtitle));     wixData.query("#dynamicDataset")         .contains("title", $w('#titleSearch').value)         .find() } export function titleSearch_change(event, $w) {     title(); } //clear search criteria export function clear_click(event) {     $w("#titleSearch").value = "";     $w("#Year").value = "";     $w("#dynamicDataset").setFilter(wixData.filter()); }
0
0
Date Picker (and now dropdown) intermittently showing blank values in repeater
In Coding with Velo
Example: Input Repeaters
In Tips, Tutorials, Examples
Example: Input Repeaters
In Tips, Tutorials, Examples
barb
Mar 19, 2020
@Yisrael (Wix) I added a box collapsed on load to allow room for the date picker calendar to pop up. When the user clicks the datePicker, the code expands the box and the calendar pops up. I have added a close button to close it but if the user doesn't notice it and clicks back on the date picker field, the space and the close button remain. I'd like it to collapse the box automatically whenever the calendar closes but I haven't been able to do this automatically. Go to this link for a little video of the behavior of the problem. (Probably too big to include in this post) https://www.youtube.com/watch?v=AqVwwlxJf0s code relevant to this video $w.onReady(function () { $w("#datasetTable").onReady(() => {}) //to expand box for calendar when user clicks on datePicker $w("#datePicker1").onClick((event) => { let $item = $w.at(event.context); $item('#box1').expand(); }); }); //Close button to collapse box for calendar export function Close_click(event) { let $item = $w.at(event.context); $item('#box1').collapse(); } // collapse box when user changes date export function datePicker1_change(event) { let $item = $w.at(event.context); $item('#box1').collapse(); } NEED HELP Is there a way to collapse the box whenever the calendar collapses without the user having to click the workaround "close" button? (watch the video if this doesn't make sense). Thanks in advance if anyone has a suggestion. By the way, Yisreal's example above seems to be working now. I used it to create the page I show in the video on this post. The page is his method to add new items, edit input fields, and delete fields. My only problem (which is being reviewed by support) is that sometimes, the datePicker field is empty when I click Show more entries. A real head scratcher! I know the dates are in the data collection because I can display a date in a text field even when the datePicker shows it is blank.
0
Example: Input Repeaters
In Tips, Tutorials, Examples
barb
Mar 13, 2020
@Yisrael (Wix) I was hopeful with your examples to use the date field to bind a text input field to it and code it so the date was valid. The examples were cumbersome for me (a newbie, non-programmer). So I went back to trying to fix the date picker problem (which is actually a bug to me because drop down boxes work in narrow repeaters, why not the date picker?) SOLUTION TO DATE PICKER NOT WORKING IN A REPEATER If you're trying to use a date picker in a narrow repeater, normally it won't fit in the row. After trial and error to collapse and expand a box within the repeater to hold the calendar, this is my working code: import wixData from "wix-data"; $w.onReady( function () { $w("#datePicker6").onClick( (event) => { let $item = $w.at(event.context); $item('#box1').expand(); } ); } ); export function input52_click(event) { let $item = $w.at(event.context); $item('#box1').collapse(); } Within the repeater container, I created a box large enough to display the calendar popup and set the box property to "collapsed on load". The on ready function above expands the box for the current item only when the user clicks the date picker. The click event for input 52 (the next field which is required) collapses the box so the repeater goes back to the original size. If only I can solve the problem with support where dates appear blank (sometimes) when I load more records even though there is a date in the data collection items. This happened before I implemented the collapse/expand for the calendar (and is still a problem).
Content media
2
Parsing Error: Unexpected Token {
In Coding with Velo
barb
Mar 01, 2020
Hello, I have a similar problem. Parsing error with onReady function - I think I'm close! SITUATION: I am trying to filter a data collection by the login user's email address. As Admin I have added the initial records to the collection and need the ability for my members to update their address information as needed. More than half of our members may not edit their information nor go online at all but I need everyone's info for our roster (which is displayed in a repeater on a page visible to Members). Many of our members are elderly and are not computer savvy. As admin, I add the initial record when I approve the member at registration Here is the code I am using to fill an input field with the logged in user's email address and then trying to use that to filter the data collection which is Read/Write so they can then edit it (on a Member page). I have a parsing error and can't figure out what token is missing to make the code work. I hope someone can take a quick look to help. import wixUsers from 'wix-users'; import wixData from "wix-data"; $w.onReady(function () { $w("#dataset5").onReady( () => { //DocentRoster data set let user = wixUsers.currentUser; let userId = user.id; let isLoggedIn = user.loggedIn; let userRole = user.role; user.getEmail() .then( (email) => { let userEmail = email;  $w('#input40').value = userEmail; $w("#dataset5").setFieldValue("loginEmail",$w('#input40').value); let filter = $w("#input40").value; $w("#dataset5").setFilter(wixData.filter().contains("docentEmail", filter)); wixData.query("DocentRoster") .contains("docentEmail",$w("#input40").value) .find() .then(res => { $w('#box35').expand(); } ); Box35 has the fields I want the user to be able to edit (address, phone, comments, preferences, etc.). All are from the DocentRoster set up as Read/Write with no filter. Thanks in advance if anyone can spot what's I've done wrong.
1
1
Sending email on form submission - issue with rich text fields not displaying in emails correctly
In Coding with Velo
barb
Oct 05, 2019
Any solutions here?
0
0

barb

More actions
bottom of page