简体   繁体   中英

Ubercart and Drupal 7 - hook_add_to_cart

http://www.ubercart.org/docs/api/hook_add_to_cart

I am trying to hook into the add cart functionality of ubercart. I have created stock_control.module and stock_control.info files and enabled the module. In my .module file I have

The first is output but the 2nd is not.

<?php
   dsm('hello1');
     function stock_control_add_to_cart($nid, $qty, $data) {
    dsm('hello2');
     if ($qty > 1) {
    $result[] = array(
  '        success' => FALSE,
  'message' => t('Sorry, you can only add one of those at a time.'),
);
  }
  return $result;
 } 

我相信版本7中的钩子是hook_uc_add_to_cart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM