Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 8292 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have just added a shopping cart button from PayPal to my FMP website. My problem is, that I dont know the proper syntax for sending a variable or token over to the description of the item that goes into the shopping cart.

The name of the description of the item in my database is called "asset code". I attempted to place [FMP-Field:+Asset+code] directly into the link but it does not show in Paypals cart. In fact, the only thing that seems to show is if you hard code a description.

PayPal's shopping cart button looks like this:

<a href="#" onClick="window.open('https://www.paypal.com/cart/add=1&[email protected]&item_name=[FMP-Field:+Asset+code]&item_number=[FMP-Field:+Asset+code]&amount=23&undefined_quantity=0&no_shipping=0&no_note=0','cartwin','width=600,height=400,scrollbars,location,resizable,status');"><img src="" border="0"></a>

Posted

Garry,

First let me say that I really appreciate your help.

I changed the syntax as per your instructions but it still appears blank in paypals description. I have pasted the code below. Keep in mind that the paypal shopping cart button directs you to their server and takes the information that you send it and displays it on their own webpage. Is it possible that their server does not recognize the fmp variables? Or should it make no difference since the value of the variable becomes a constant before its passed? Anyway, here is the code:

<p><a href="#" onClick="window.open('https://www.paypal.com/cart/add=1&[email protected]&item_name=[FMP-Field:asset code]&item_number=[FMP-Field:asset code]&amount=23&undefined_quantity=0&no_shipping=0&no_note=0','cartwin','width=600,height=400,scrollbars,location,resizable,status');"><img src="" border="0"></a></p>

Posted

Have look at this anchor in the source code, after it has been returned to your browser after a post action, by using view source.

Have the replacement tags ( ie [FMP-Field:asset code]) been successfully replaced with the values from your database record? or are they blank (eg ...... item_number=&amount......).

This might give you a better idea where the problem is coming from ...

you are correct in assuming that the FMP tags will have no effect on the paypal server as these are an instruction to FMPro to insert values from the record that has been either added, found or edited in your database and the data is inserted before the page is returned to you ... if everything is working correctly that is smile.gif

Posted

Ok, I did that (good idea!). It seems that the info that I pass to paypal ends up in a javascript array. The FMP variables appear blank in the array. The fields that I hardcoded did appear in the array. So I guess I need to look at some Java code that will store the [FMP-Field:asset code] into a variable that I can pass into paypal's shopping cart button.

Does anyone know how to do this?

Posted

You can assign FM data to Javascript variables like this:

var assetcode = "[FMP-Field: asset code]" ;

The following is, in fact, Javascript:

onClick="window.open('https://www.paypal.com/cart/add=1&[email protected]&item_name=[FMP-Field:asset code]&item_number=[FMP-Field:asset code]&amount=23&undefined_quantity=0&no_shipping=0&no_note=0','cartwin','width=600,height=400,scrollbars,location,resizable,status');"><img
So you can convert it to:
onClick="window.open('https://www.paypal.com/cart/add=1&[email protected]&item_name=' + assetcode + '&item_number=' + assetcode + '&amount=23&undefined_quantity=0&no_shipping=0&no_note=0','cartwin','width=600,height=400,scrollbars,location,resizable,status');"><img

This topic is 8292 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.