Noob question: how do you collect informations from multiple pages in one session without make a user login to the site?
Something javascript does or can php do it? It’s for populating a checkout order.
I might use Shopkit for that if the site I’m working on handles the whole payment process, but it’s still not clear so I thought I’d try to keep it basic for now…
(a forum search did not bring up anything relevant, and it might be because of my terminology probably)
You can send the page information in a data attribute you read via JS, without saving in the session, but if you want to store multiple items in a cart, that doesn’t make sense.
I only need a very simple example for now, simply click on a product page and place the order based on the informations fetched from that page. Later on I’d need to store multiple items though.
I think I’ll peek at how shopkit does that for now. I thought it was only a plugin, but realised it’s a full on website, which is not what I need.
Thanks for this, it looks more fitting for what I need to do. I’ll go through it and will report back.
In the example all the products are in one page, in my case each product has its own page, and a user is expected to visit a specific page to add a product to the list.
Does the session function works across pages? It should right? From what I understand the session function keeps working until you press the checkout button.
By comparing cartkit with the plugin code from 2013 you shared, the main difference I saw is that in cartkit at every new function $cart = s::get('cart', array()); is called.
Which makes me think it’s because in case you open a new product page and want to keep up to date with the session’s data?
yes, but if you look closely, it’s all the same, the old version of cart_logic() expects an argument and gets the session data passed via this argument.
@afincato Just to throw something out there incase you hit a wall trying to make this work, I have had great success with Snipcart, which can very easily be added to a Kirby site. It adds a shopping cart that can be customised easily via your own CSS. It’s javascript based and product information is fed to it via simple data attributes on buttons, and works well with a number of popular payment gateways (not totally sure GingerPayments is one of them). They even put together a getting started guide on adding it to Kirby.