I have a site that was originally built in Rapidweaver a few years ago that I would like to rebuild now in Blocs. It has a cart system through Fastspring that enables a pop up cart when the add to cart button is clicked.
In the page header it includes code like the following:
The point I am struggling with is how to apply that link to the cart button in Blocs, so the pop up appears in the same way as with Rapidweaver. I tried adding it as a custom attribute but something isn’t right.
This is pretty frustrating and it’s not even clear what kind interaction type should be chosen on the button. In RW I was simply able to apply that line of code as a custom class applied to the button, as shown in the attachment below and it worked.
In Blocs I have tried setting the interaction option for the button as url, submit and none. I’ve played with the code as a custom attribute with no luck.
It doesn’t want to know here and keeps rejecting it. When I open the custom attribute again it has reversed to the way it was before, as though it won’t accept the code.
So if I add the script, and click the button I get a spinning wheel briefly and then page errors from the FastSpring API, I am assuming that the correct result?
To actually work it needs to be hosted on the the whitelisted domain set at Fastspring, however you should at least see a spinning white progress ball for a couple seconds in preview using Blocs, while it attempts to make a connection.
I seem to have it working now on the website in a draft folder, though the interaction is set to none at present. No way to know for sure without creating a test purchase, but the pop up does appear there.
It does seem a bit convoluted doing this in Blocs and having to break it up like that into three parts. The documentation at Fastspring talks about just adding that single line of code when triggering the popup.
Its the way the CDA works, which makes handling long (lots of) data attributes actually very handy. The only thing I wish it did, was allow you to change the order.
Looks like RW just uses the custom class field to populate data-attributes.
lol… I have developed an infection in the edge of my nail on my right thumb and I can barely type… using the touch pad and especially right clicking its almost fail
And then add a code bric with this code? <a class="btn btn-outline-primary" href="#" role="button" data-fsc-action="Add,Checkout" data-fsc-item-path-value="product-one">Buy Now</a>
Yes, I most likely would have done it that way myself @Pealco depending on design. He got it working last night though. Good to learn new things I’m Blocs.
But as you said is only a different way of achieve that as @Flashman already found a solution… But it is more difficult if you have many articles… I think…
About design he can chose from this buttons, and from icons he can change from any icon in Fontawasome as we already speak earlier…
Oh its slang. Meaning that we both use the code bric a lot, but you use it a lot more than me, even if you were 1st place and I was 2nd the gap would be big.
Actually I have some weird problems and I think I need to contact Fastspring. Really strange is that if I click the Home page link from The About page up pops the store cart, but this only happens on the about page and that is part of the global menu. I shall try what @pealco suggested as well.