Project:
UbercartCategory:
feature requestPriority:
normalStatus:
patch (needs review)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;
+ }
+}


Re: pathauto hook for uc_product
What version of pathauto are you using? I got the latest version, and this doesn't work. I looked into it, and I can't find any place where this hook is being called. Of course, Pathauto 2.0 is still in beta, so I don't know how much people want to use it.
I think if you want to support the newest pathauto, you need to implement hook_token_list and hook_token_values.
I have pathauto 5.x-1.2 I
I have pathauto 5.x-1.2
I didn't realize that 2.0 was different.. if they've actually changed the hook name it is probably trivial to support both (eg, just add hook_token_* in addition to hook_pathauto_node)