Last updated March 6, 2006. Created by nedjo on March 6, 2006.
Log in to edit this page.

If you want your product type to be shippable you could just repeat some of the code that's in function tangible_productapi(), but then you'd be stuck updating your module every time tangible.module changes.

Handy shortcut to save you that work: instead of repeating the code from tangible.module, invoke it. See apparel.module for an example. apparel_productapi() reads in part:

<?php
   
case 'fields':
    case
'validate':
    case
'in_stock':
    case
'is_shippable':
    case
'on payment completion':
    case
'form':
    case
'load':
    case
'insert':
    case
'update':
    case
'delete':
    default:
      return
module_invoke('tangible', 'productapi', $node, $op, $a3, $a4);
?>

In other words, use tangible's methods here. (Of course, tangible.module has to be enabled for this to work.)

You could leave out all those case statements and just put default. The point of keeping them is just to remind us of what we're using tangible for. Note: if you have your own use of any of these op values in your module, you'll need to first do your stuff and then invoke tangible.module. E.g.:

<?php
   
case 'fields':
      return
array_merge(array('myfield'), module_invoke('tangible', 'productapi', $node, $op, $a3, $a4));
?>

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.