Project:
UbercartCategory:
feature requestVersion:
Ubercart 1.0 RCPriority:
normalAssigned:
UnassignedStatus:
patch (needs review)The attached patch (for RC5) introduces a hook for uc_catalog.module that enables other modules to define new catalog rendering functions (to render the products in between the sub-terms and pager of a catalog page).
The hook, hook_catalog_display, is similar to hook_menu, and is implemented in the patched version of uc_catalog:
/**
* Implementation of hook_catalog_display
*
* @return
* An array specifying catalog display types
*/
function uc_catalog_catalog_display($op) {
switch ($op) {
case 'types':
$return = array();
$return['default_table'] = array(
'name' => 'Default list table',
'callback' => 'theme',
'callback arguments' => 'uc_catalog_products_table'
);
$return['grid'] = array(
'name' => 'Grid',
'callback' => 'theme',
'callback arguments' => 'uc_catalog_product_grid'
);
break;
}
return $return;
}The only op defined at the moment is 'types'.
The callback function is passed the callback arguments and an array of product nodes and should return the HTML of the catalog page.
The patch modifies the main catalog admin form to add a drop down box with all the defined catalog display types. The selected display type is then used to render catalog pages.
This patch was made to support the uc_multibuy module in order to reduce the amount of code duplication required to render alternative catalog displays. See this module for an additional example of usage of the new hook.
| Attachment | Size |
|---|---|
| uc_catalog.module.displaytypes.diff | 5.45 KB |

