| Project: | Ubercart Contributions |
| Component: | Code |
| Category: | |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (needs review) |
Jump to:
Hook for pathauto that allows product SKU to be used in the URL.
It would be easy to add other fields (eg, weight, price), but I couldn't see the purpose.
--- uc_product.module.orig 2007-10-04 10:48:25.000000000 -0400
+++ uc_product.module 2007-10-21 20:24:54.000000000 -0400
@@ -2341,3 +2341,20 @@
return 'node/'. $data['nid'] .'/edit/features';
}
+/** Implementation of hook_pathauto_node()
+ */
+function uc_product_pathauto_node($op, $node = false) {
+ switch ($op) {
+ case 'placeholders':
+ $placeholders = array(
+ '[uc_model]' => t('Ubercart Product Model/SKU'),
+ );
+ return $placeholders;
+ case 'values':
+ $values = array();
+ if ($node) {
+ $values['[uc_model]'] = (isset($node->model) ? $node->model : '');
+ }
+ return $values;
+ }
+}

