top of page

Forum Posts

base742
Feb 09, 2022
In Coding with Velo
I have a testimonials page on our site that displays information about our client's testimony in a repeater connected to a dataset. I would like to add a button (Show Our Reply) that shows up on the specific repeater item based on that items data in the "reply" field in the dataset. Then once that button is clicked, to show that items respective reply. I would also like to hide the button from other items that do not have anything in the "reply" field in the dataset. I have the below code but each item still shows the button even when that specific items "reply" field is empty. In the future, I also want to add a way to filter the testimonies based on Rating, and display a number of total ratings with an average star rating. #container2 = Testimony Repeater #item205 = "Show Our Reply" Button #item206 = "Reply Data" import wixData from 'wix-data'; var myDATABASE = "GenericTestimonials" //--> your collection-name here.. var searchFIELD = "Rating" //--> Search-Field-ID here.. $w.onReady(function () { $w("#container2").onViewportEnter((event) => { // get repeated item scope const $item = $w.at(event.context); // get the ID of the repeated item which fired an event const itemId = event.context.itemId; // get all repeater's data, it's stored as an array of objects const data = $w("#repeater1").data; // use the array methods to find the current itemData and index const itemData = data.find((item) => item._id === itemId); const index = data.findIndex((item) => item._id === itemId); wixData.query(myDATABASE) .isNotEmpty("reply") .find() .then( (results) => { if(results.items.length > 0) { console.log("Items-found") $item("#text205").show(); $item("#text205").onClick((event) => { $item("#text206").show(); }); } else { $item("#text205").hide(); // handle case where no matching items found } }); }); });
1
1
223
base742
Feb 10, 2020
In Coding with Velo
I want to create a "serialized" coupon when someone purchases one of my paid plans. I also want the coupon to be specific to a paid plan. For example, if the client purchases a gold plan he gets the 20% off coupon and not the 10% off one. The below is what I have but can't figure out to recall what plan the user just purchased and if it is gold or silver or bronze. I have a test plan that is free that I am using sort of as a sandbox. import wixData from 'wix-data'; import wixMarketing from 'wix-marketing-backend'; import wixUsers from 'wix-users-backend'; export function createCoupon() { wixData.query("Members/PrivateMembersData") .eq("_id", wixUsers.currentUser.id) .find() .then((results) => { let slug = results.items[0].slug; let lastname = results.items[0].lastName; let firstname = results.items[0].firstName let email = results.items[0].loginEmail let couponDataBronze= { //Bronze Discount "name": firstname + " " + lastname + " " + "(Bronze)", "code": email, "startTime": new Date(), "limitedToOneItem": true, "active": true, "scope": { "namespace": "bookings" }, "percentOffRate": 10, }; let couponDataSilver= { //Silver Discount "name": firstname + " " + lastname + " " + "(Silver)", "code": email, "startTime": new Date(), "limitedToOneItem": true, "active": true, "scope": { "namespace": "bookings" }, "percentOffRate": 15, }; let couponDataGold= { //Gold Discount "name": firstname + " " + lastname + " " + "(Gold)", "code": email, "startTime": new Date(), "limitedToOneItem": true, "active": true, "scope": { "namespace": "bookings" }, "percentOffRate": 20, }; return wixMarketing.coupons.createCoupon(couponDataBronze); }) } export function wixPaidPlans_onPlanPurchased(event) { if (event.order.price.amount === 0) { createCoupon(); } else {} }
0
0
72
base742
Dec 29, 2019
In Coding with Velo
I am trying to create a booking experience that leads my clients to a document (terms) to esign before allowed to book a service. Now it doesn't matter when they get redirected to the terms document to esign but as long as it requires them to sign it before being allowed to book any service. I am trying to use corvid but am having difficult finding out how to do this.
0
1
19

base742

More actions
bottom of page