Closed (won't fix)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Feb 2013 at 12:52 UTC
Updated:
26 Feb 2013 at 22:55 UTC
Hi, right now I have the status: active and disable. When the status of a product is disable the "add to cart" button is disabled and a text not available is showing.
I would very much like to add a 3d status: information. With the possibility to add a link to the "add to cart" button to an information page.
Something like It is not in stock now, but if you email us we can have it for you in a week or so...
Is this possible please?
Adding a new status between active and disable with the possibility to add a link to the button to a webpage? Is there a module for this, or a lookalike may be?
Thanks a lot in advance for considering this!
Greetings, Martijn
Comments
Comment #1
summit commentedHi,
I saw this post: http://www.drupalcommerce.org/discussions/1027/changing-products-status but no code to move from..
Greetings, Martijn
Comment #2
rszrama commentedIt's not really possible, because while you could use additional non-0 values of the status to represent other types of "active" products, there's only one 0 value to use to represent types of "disabled" products. In your case, I'd just alter the form.
Comment #3
summit commentedHi, How can I alter the form such as that the product is disabled, but the button is linkable with one website link for all disabled products?
Greetings, Martijn
Comment #4
summit commentedHi,
I found this post usefull http://www.drupalcommerce.org/discussions/613/how-change-add-cart-button...
function MYMODULE_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {
if($form['submit']['#disabled'] == true) {
$form['submit']['#type']='image_button';
$form['submit']['#src']='sites/default/files/images/out-of-stock.png';
} else {
$form['submit']['#type']='image_button';
$form['submit']['#src']='sites/default/files/images/add2cart.png';
}
}
How to change the link in the button to within the disabled form['submit'] to a webpage in my site?
I see here a redirect: http://api.drupalize.me/api/drupal/function/commerce_cart_add_to_cart_form_submit/7
But how to get this in this form_alter. Thanks for your help!
Greetings, Martijn