Rapidcart Pro: Make the no stock "Enquire for availability" button a clickable link?

Tagging @rob on this and putting it here in case anyone else can help…

Inside RCP, if you set an item to “not available” by unticking the Available option in settings a nice red button appears in the listing with the default text Enquire for availability. Although it’s a button and has a hover mouse it doesn’t link to anything.

I’m wondering if this can be changed, so it can link to perhaps the contact page? I’ve read over the manual and could see no mention of such an option, so I’m wondering if this facility is built-in, or if it can be applied by hack of some sort?

the button looks like this…

and uses the class uk-button-danger

Thanks.

1 Like

Copy the following code

<script>
$(function () {
	
	var enquireButtonText = 'Enquire for availability';
	var enquireButtonIcon = 'uk-icon-envelope-o';
	var enquireButtonLink = 'https://www.google.com'; // change the link to your enquiry page

	$('.uk-button-danger:contains(' + enquireButtonText + ')').html('<i class="' + enquireButtonIcon + '"></i> ' + enquireButtonText);
	$('.uk-button-danger:contains(' + enquireButtonText + ')').click(function () { window.location = enquireButtonLink; });
	
});
</script>

and paste it into Customization > Header & Footer > Footer (HTML) field.

It will convert the ban icon into an envelope and the button will open Google website.

2 Likes

You absolute star. Thanks so much @rob.

Is it Ok if I add that to the Template Repo knowledge base: https://www.templaterepo.com/knowledgebase/

Yes, it’s ok.

Sorry @rob but I can’t get that to work…

https://www.newleccycles.com/NEW/store/?catalog/all/-/price/1

I’ve checked over all the usual things, but can’t see anything amiss. Any ideas?

Header & Footer fields are for RapidCart Pro page only.
If you use RapidCart Pro Store stacks inside a Stacks page you need to put that code into proper field in the Stacks page.

1 Like

Thanks @rob. I did try that, I put it in the Javascript section, but didn’t work. Since tried it in the body section and it’s working a treat.

Again, thanks for your help, I will add it to the knowledge base asap.

2 Likes

Yes, it depends on where JS field is loaded.
It must be loaded after the content to let the script find the button.

If putting it in the body setting didn’t work, my next port of call was to put it in an HTML stack and drop that below the RCP cart stack.

Worth mentioning for anyone else finding this and wanting to do the same…

The button text in the code Rob put above needs to match that which you apply to the button in RCP Customisation Localisation settings, exactly. Upper and lower case. This tripped me up for a moment too!

Overall though, a brilliant little hack Rob, thanks again.

For the record: This was needed for a client who wanted to list all products available to sell, but differentiate between those held in-store (foe which he could take an online order) and those available from the supplier (for which he wanted to process the order manually). This little hack made that possible.

2 Likes