Passing Data to Reusable Element From Page to Page

Hi, everyone:

I have a shopping cart button that is a reusable element that floats on every page except the Shopping Cart page. I have set up a custom state for the button. Every time the User adds a product to the cart, I have set up the add to cart workflow so that the custom state is set to the User’s data (I tried sending Current User, Result of…, Parent Group’s). That User’s data is then sent to the Go to Shopping Cart page…

Or at least that’s what I want to do.

Right now, when I click on the floating shopping cart button, the Shopping Cart page comes up blank. Is that because custom states get nulled out between pages even if the state is for a reusable element?

Any ideas on how to remedy this?

Thank you.

Use url parameters. Search forum and I have posts on sending lists as parameters.

Yes I believe what you are trying to do is not possible. You would also want to keep the User’s cart if they leave and come back to the website. States are only available until the page is reloaded.

What you should do instead is this:

  • Create a ‘Cart Item’ table in your database. This table should have a Product and Quantity fields at least.
  • Create a ‘Cart’ field in the User table. This should be a ‘List of Cart Items’.
  • When a user adds an item to their cart, you create a new Cart Item record, and add it to the User’s Cart.
  • On your shopping cart page I presume you have a repeating group to display the items, you just give that repeating group the User’s Cart.

Hmm… Let me give both of these a shot. Thanks.

This topic was automatically closed after 70 days. New replies are no longer allowed.