"out of stock" заменить на flag

Главные вкладки

Аватар пользователя airfox airfox 13 июня 2015 в 0:50

Помогите заменить кнопку при отсутствии товара "out of stock" во views c настроенным на дисплей товара Flag-ом, то есть хочу при нулевом остатке товара на складе выводить флажок "на заказ" - "отмена" на странице созданной views, наткнулся на модуль commerce_stock_notifications там есть строки

<?php
function commerce_stock_notifications_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state$form_id) {
  
$product $form_state['default_product'];
  
$product_wrapper entity_metadata_wrapper('commerce_product'$product);

  

// We care about stock if the stock field exists, AND stock is not being
  // disabled by the override option.
  
$stock_managed = (commerce_ss_product_type_enabled($product->type) && commerce_ss_product_not_disabled_by_override($product));

  

// Adds the subscribing form under at the bottom of the cart form in order to
  // let the user register to be notified.
  
if ($stock_managed && $product_wrapper->commerce_stock->value() <= '0.00') {
    
$form['commerce_stock_notifications'] = commerce_stock_notifications_customer_form($form_state$form_state['line_item']->data['context']['display_path']);
    
$form['commerce_stock_notifications']['#weight'] = 100;
    
$form['#validate'] = array();
    
$form['#submit'] = array('commerce_stock_notifications_customer_form_submit');
  }
}
?>

попробовал все это связать, не выходит слишком мало опыта в php... дайте отцовского пинка в нужном направлении для решения проблемы, или подскажите как правильно сделать. Заранее спасибо.

Комментарии