Adding MARC shelfmarks to the bibliographic display

Our main Library Management System is down at the moment. It meant our main Aquabrowser based catalogue worked, but was unable to show item holdings/availability/shelfmarks. For users, this made it pretty useless, knowing we have a book is a little useless if they don’t know where it is. The fact that our classification system is modified from the standard Library of Congress classification meant we can’t just refer users to similar University catalogue’s for a shelfmark.

So as a work around I added the Shelfmarks held within the MARC record on to the standard vufind (sabre) display.

Basic item information is held in the MARC record, you can see an example below in the 852 field. This example has five copies.


Steps to add this:

First I edited web/RecordDrivers/MarcRecord.php. 

* Get item information from MARC 852 - useful if lms system is down for classmark
protected function getItemHoldings()
return $this->getFieldArray('852', array('h','c','b'));

This calls another function in this file which does the heavy work of getting all the fields and sub-fields out of the record. You can see I’m using subfields h, c and b.

Next, I edited IndexRecord.php. Adding the following to the function ‘getCoreMetadata()’ 

$interface->assign('coreHoldings', $this->getItemHoldings());

If you’re following along at home you will find the top of the function has a number of similar lines and I just added it straight after these.

Finally I edited web/interface/themes/default/RecordDrivers/Index/core.tpl

I added this near the end:

<!– CJK show holdings info –>
{if !empty($coreHoldings)}
<tr valign=”top”>
<th>Shelfmark: </th>
{foreach from=$coreHoldings item=text1 key=text2 name=loopholdings}
{if $text1 neq $prevholding}
<strong>{$text1|escape}</strong> <br />
{assign var=’prevholding’ value=$text1}

This will display the shelfmark if we have one (or more) shelfmark, and only show each unique classmark once, i.e. if there are several items with the same shelfmark/collection/library then only one shelfmark is displayed.

If I was doing this properly the ‘Shelfmark: ‘ would be in the language file and not hard coded in.

End result:


Link to the record:

(note at the time of writing this is a temporary measure and will probably be removed once the issue is resolved)



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s