[themes] Override Functions Help
Carl Parrish
lists at pcl-consulting.com
Fri Jul 14 15:53:42 UTC 2006
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;
}
More information about the themes
mailing list