Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Displaying out of stock message

Go to End

2 Posts   774 Views


Community Member, 10 Posts

29 September 2011 at 9:36am

Hi there,

For out of stock items on my client's site, I would like to be able to show a friendly Out of Stock message along with a link to a 'request product/enquiry form' to capture customer's details so that the client can contact them when the products are back in stock.

The client is happy to maintain the stock levels by simply ticking/unticking the "Allow product to be purchased' checkbox.
So I need to incorporate logic that if this checkbox is unticked, display out of stock message with link to form.

Any ideas where/how I could do this?

Thanks for your help.


Community Member, 130 Posts

29 September 2011 at 1:17pm

Hi Mitz, when you're in a template in the context of a product you should be able to add some simple logic i.e.

<% control Products %>

	<p>Title: $Title</p>

	<p>Description: $Description</p>

	<p>Price: $Price</p>
	<% if AllowPurchase %>
		<p><a href="link-to-buy/$ID">Buy now</a></p>
	<% else %>
		<p>This item is currently out of stock. You can <a href="link-to-form/$ID">request to be notified when it is available again</a>.</p>
	<% end_if %>
<% end_control %>

Assuming AllowPurchase is the name of your checkbox field