From 2a0ea930de9d59e29bf4ddeb1585e61061109d7d Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Wed, 10 Jun 2026 09:28:51 +0100 Subject: stock: add list_kitlocker.php — combined assembly/component kitlocker list with stgrp filter; gallery links to list_kitlocker; breadcrumb back link in header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- list_kitlocker.php | 55 ++++++++++++++++++++++++++++++++++++++ templates/list_kitlocker.tpl | 43 +++++++++++++++++++++++++++++ templates/stock_fixed_grid_inc.tpl | 2 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 list_kitlocker.php create mode 100644 templates/list_kitlocker.tpl diff --git a/list_kitlocker.php b/list_kitlocker.php new file mode 100644 index 0000000..7598c53 --- /dev/null +++ b/list_kitlocker.php @@ -0,0 +1,55 @@ +verifyPackage( 'stock' ); + +global $gBitSystem, $gBitSmarty, $gBitDb; + +$stgrp = !empty( $_REQUEST['stgrp'] ) ? trim( $_REQUEST['stgrp'] ) : null; + +$X = BIT_DB_PREFIX; +$bindVars = []; +$whereSql = "AND lc.`content_type_guid` IN ('stockassembly','stockcomponent')"; + +if( $stgrp ) { + $whereSql .= " AND EXISTS (SELECT 1 FROM `{$X}liberty_xref` sx WHERE sx.`content_id` = lc.`content_id` AND sx.`item` = ?)"; + $bindVars[] = $stgrp; + $groupTitle = $gBitDb->getOne( + "SELECT `cross_ref_title` FROM `{$X}liberty_xref_item` WHERE `item` = ? AND `x_group` = 'stgrp'", + [ $stgrp ] + ); +} else { + $whereSql .= " AND EXISTS (SELECT 1 FROM `{$X}liberty_xref` sx + INNER JOIN `{$X}liberty_xref_item` xi ON xi.`item` = sx.`item` AND xi.`x_group` = 'stgrp' + WHERE sx.`content_id` = lc.`content_id`)"; + $groupTitle = null; +} + +$items = $gBitDb->getAll( + "SELECT lc.`content_id`, lc.`title`, lc.`data`, lc.`content_type_guid`, + (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x + WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLID') AS klid, + (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x + WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLPR') AS klpr + FROM `{$X}liberty_content` lc + WHERE 1=1 $whereSql + ORDER BY lc.`title`", + $bindVars +); + +$gBitSmarty->assign( 'kitlockerItems', $items ); +$gBitSmarty->assign( 'stgrp', $stgrp ); +$gBitSmarty->assign( 'groupTitle', $groupTitle ); + +$pageTitle = $groupTitle ?: KernelTools::tra( 'Kitlocker' ); +$gBitSystem->setBrowserTitle( $pageTitle ); +$gBitSystem->display( 'bitpackage:stock/list_kitlocker.tpl', null, [ 'display_mode' => 'list' ] ); diff --git a/templates/list_kitlocker.tpl b/templates/list_kitlocker.tpl new file mode 100644 index 0000000..c7e1c44 --- /dev/null +++ b/templates/list_kitlocker.tpl @@ -0,0 +1,43 @@ +{strip} +
+
+
+
+

{if $groupTitle}{$groupTitle|escape}{else}{tr}Kitlocker{/tr}{/if}

+ {if $stgrp}‹ {tr}Kitlocker{/tr}{/if} +
+ +
+ + + + + + + + + + + + {foreach $kitlockerItems as $item} + + + + + + + {foreachelse} + + {/foreach} + +
{tr}Name{/tr}{tr}Type{/tr}{tr}KLID{/tr}{tr}Price{/tr}
+ {if $item.content_type_guid eq 'stockassembly'} + {$item.title|escape} + {else} + {$item.title|escape} + {/if} + {if $item.data}
{$item.data|truncate:120|escape}{/if} +
{if $item.content_type_guid eq 'stockassembly'}{tr}Assembly{/tr}{else}{tr}Component{/tr}{/if}{$item.klid|escape}{$item.klpr|escape}
{tr}No kitlocker items found.{/tr}
+
+
+{/strip} diff --git a/templates/stock_fixed_grid_inc.tpl b/templates/stock_fixed_grid_inc.tpl index af84ab8..f4c3aae 100755 --- a/templates/stock_fixed_grid_inc.tpl +++ b/templates/stock_fixed_grid_inc.tpl @@ -12,7 +12,7 @@