Wouldn't make more sense to have the "Out of stock" message as a formatted text rather than a disabled form button?

What's the rationale behind that?


rfay’s picture

Thanks for taking a look :-)

It's just the way it was when I got it. Never changed it. I don't really have a commitment to it. Patches are welcome.

BenK’s picture

One aspect of the current implementation is that if the user hovers over the disabled button, the mouse cursor turns into a pointer as if it is a clickable link. That's a bit confusion because if you try to click it, nothing happens. Any way to make the disabled button not appear clickable?


BenK’s picture

One more thing: Another issue with the current disabled button implementation occurs if you override the string for either the "Add to cart" text or the "Out of stock" text. If those two text string have substantially different numbers of characters (and you've used a lot of CSS to make the button prominent), then it's possible that the button gets pushed into adjacent layout items. (This happened to me.)


vasike’s picture

subscribe. more flexibility needed for the stock value, some settings, more options.
maybe the stock settings/options should be within every product type definition/page/form.

guy_schneerson’s picture

Category:task» feature

version 2 lets you control the text but its still using the disabled button.

Summit’s picture

Hi, I would love to be able to link the disabled button to a helppage. Something like More info why the product is not in stock, and that someone can order it by email if necessary!
So it would be great if the disabled button was enabled and has link-possibility next to having text!

Thanks a lot in advance for considering this!
Greetings, Martijn

guy_schneerson’s picture

Status:Active» Fixed

@Summit and anyone following this thread.
Missed this one out, it should have been closed a long time a go as this is now supported in 2.

What you need to do is:

  1. Edit the rule or work on a copy of "Stock: disable add to cart"
  2. Replace the action "Set the state of the add to cart form" with "Advanced configuration of the add to cart form"
  3. Set the "stock action" field to "Custom HTML" and the "Custom HTML" field to something like Out of stock (can be any valid HTML)

Optionally set the "stock action" field to "URL Action" and the "Custom URL" field to a valid url.
You can also set the "stock action" field "Custom submit" to trigger a custom submit (will need coding for you submit handler)

guy_schneerson’s picture

Title:Text instead of a disabled button?» Out of stock Text or Link instead of a disabled button

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Cheviot’s picture

Issue summary:View changes

Hi, thi was the trick I was looking for. When a product is out of stock then the 'add to cart' should change to redirect buyers to the shop keeper to aks it something can me made on order. I my case something exists as a product or has to be made on order (the "out of stock" phrase is never used).

It should be possible to create a rule to add the product SKU in the email header, any idea how this can be done? I see no field in "Advanced configuration of the add to cart form" for this so I assume some variable is needed and another rule step.

Cheviot’s picture

Solved this via some experimenting. This relates to the "Stock: disable add to cart " rule.
A sample is sometimes the best way to understand how it works. The data of the current page (a node from 'product list' or 'full content') is parsed to the webform using the rule of guy_schneerson. This mean you need to have to right syntax in the custom URL field and then the right syntax in the webform to be able to get the data parsed via the url into the subject field.

In Rules -> "Stock: disable add to cart " -> "Advanced configuration of the add to cart form" (the part made by guy_schneerson, an action):

Custom URL

This will parse the SKU via the subject info inside the url and looks like this https://[your-server]/webform/product-queries?subject=ABCD12345 but the subject field of the email webform is still empty. You need to 'grap' the subject info out of the url and place it in the subject box. Since I only need one bit of info I parsed this in the subject box by amending the webform subject field to:

Default Value

And voila, it appears. Though there are many samples on the web, it seems a bit unclear to many what the right steps are. The focus is too much on the token in the email webform. But they can never work, the moment an email webform is opened the original data of the page you came from is lost. So, using a token for current page only give the url of the email webform itself baffling many. Others use the bespoke query like [current-page:query:subject] but are stuck when nothing appears.

Hope this gives some help to other struggling to figure out what the right order and syntax is.