I'm trying to understand Override Functions as described here - http://drupal.org/node/55126
so in my theme/template.php I copied function product_link() renamed it to burnt_product_link, change "add to cart" to "add to my cart", expecting to see the link change in my theme however nothing happened. any idea what I'm doing wrong?
here is the full function.
function burnt_product_link($type, $node = null, $teaser = false) { $links = array();
if ($type == 'node' && $node->ptype) { /* Determine whether or not the 'add to cart' link needs to be displayed. */ $item = module_invoke('cart', 'get_items'); if ($node->hide_cart_link == 0) {
/* Right here we need to check if a given product type is in stock */ if (in_array('in_stock', module_invoke($node->ptype, 'productapi', $node, 'attributes', 'in_stock')) !== false) { // Is it already in our cart? if ($item[$node->nid]->qty) { $links[] = t('This item is in <a href="%cart_view">your shopping cart</a>.', array('%cart_view' => url('cart/view'))); } else { $links[] = l(t('add to my cart'), "cart/add/$node->nid", array('class' => 'cart_link', 'title' => t('Add this item to your shopping cart.')), drupal_get_destination()); } } else { $links[] = t('sold out'); } } }
return $links; }
On Fri, 14 Jul 2006 08:53:42 -0700, Carl Parrish lists@pcl-consulting.com wrote:
so in my theme/template.php I copied function product_link() renamed it to burnt_product_link
product_link is an implementation of hook_link. It won't be themable unless inside product_link, it calls a theme('product_link') or something similar.
Also see the tip on Drupal Groups... http://groups.drupal.org/node/248#comment-559
-Rowan