There may not be an answer.....................

AeroClassics
New Community Member

Being a bit new to .NET and the ecommerce world I may have boxed myself into a corner that there is no way out of. I wish to use the Add To Cart button for my products. I realize that under the covers this nothing more than a HTML form with hidden fields and the data in these fields is sent to PayPal when the button is clicked.

 

I have set up my pages, because there could be dozens of items in a classification, using an ASP Repeater control tied to a PagedDataSource object to allow paging through the items. All of this is driven from a XML file that is my Product "database", if you will. And frankly this technique works very well. That is until you want to add a PayPal button.

 

Because of the nature of a Repeater Control and its associated ItemTemplate, there is no way that I can  think of that I can guarantee that a Add To Cart button will always be tied to the same product item!

 

I have been racking my brain trying to come up with a way to generate the button on the fly every time the page is rendered. But that seems to necessitate being able to build the form on the fly with information from each record in the DB.

 

I do not even know if generating a form on the fly is even possible  or not much less filling the form with hidden fields with instance specific data.

 

If anyone has any thoughts on how I can pull this off I would be ever so grateful.

 

Thanks,

Doug

Login to Me Too
1 REPLY 1

irish_green
Contributor
Contributor

Hello. Yes, generating dynamic form values on the fly is very possible. Though you are correct in your thought that each record will need to have any specific PayPal identifiers. My company has a custom built cart so I have not used their Add to Cart or Buy Now functionalities yet. But other third party integrations like product reviews and FaceBook buttons have required dynamic forms specific to each product page. If you are able to 'tell' PayPal what the product ID is you can simply use the sku. Otherwise you will need to find out what thier code for the product is and probably store that within your data records.

 

Hope that helps.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.