Re: My Sql


Walter Lee Davis
 

On Jun 9, 2020, at 11:37 AM, order@depth.net.au wrote:

Ah, thanks for the clear reply.

I have another question. Selling a product. Buyers arrive at the sales page. Paypal doesnt allow you to use coupons...is it possible to have some kind of field in Xway where people enter a coupon code, and then according to the code, it takes them to a different page on my site? Or does that require more of the not-to-be actions?
It's not so much not-to-be, but more like not-yet.

You could do this in a very low-tech manner, by creating a page named exactly for your coupon code (say, XTRA-DISCOUNT.html) and then using a little JavaScript to link to that when someone adds a coupon code. You'd need to set up a different PayPal button on that page, one that already took the coupon code into effect, and that would get you what you want, albeit with a lot of extra hand-work and duplicate pages. There would be absolutely nothing keeping anyone (or bot) from discovering that page, except for the cryptic URL, so there's always a chance that your codes would find a wider distribution than you intended... Of course that's always true, and coupon codes are one of the most-pirated things I know of, right after Photoshop.

So to make this work, you would create a form with one text field and a submit button labeled "Check Code" or something like that. Make sure the form has an Action set to '#', and a Method of GET. Xway doesn't support creating forms yet, so this is either theoretical, or something for you to implement in a Markup Item, depending on your level of devotion to the craft.

On the button, you would add an onclick attribute, which will "hijack" that button click and cause the form to redirect. This technique is similar to the ancient "Password Protected Page" Action of Freeway of Yore.

```html
<form action="#" method="get">
<label for="code">Coupon Code</label>
<input id="code">
<input type="submit" value="Check Code" onclick="return check_code(this)">
</form>
```

```js
<script>
function check_code(button){
var code = button.form.getElementById('code').value;
if(!!code){
button.form.action = code + '.html';
return true;
}else{
alert('Please enter a coupon code');
return false;
}
}
</script>
```

Untested, but should probably work.

Please let me know if this makes any sense at all.

Walter

Join xway-talk@softpress.groups.io to automatically receive all group messages.