Initial Commit of AgileBill Open Source
This commit is contained in:
612
modules/product_cat/product_cat.inc.php
Normal file
612
modules/product_cat/product_cat.inc.php
Normal file
@@ -0,0 +1,612 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AgileBill - Open Billing Software
|
||||
*
|
||||
* This body of work is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the Open AgileBill License
|
||||
* License as published at http://www.agileco.com/agilebill/license1-4.txt
|
||||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Agileco community forums at http://forum.agileco.com/
|
||||
*
|
||||
* @link http://www.agileco.com/
|
||||
* @copyright 2004-2008 Agileco, LLC.
|
||||
* @license http://www.agileco.com/agilebill/license1-4.txt
|
||||
* @author Tony Landis <tony@agileco.com>
|
||||
* @package AgileBill
|
||||
* @version 1.4.93
|
||||
*/
|
||||
|
||||
class product_cat
|
||||
{
|
||||
|
||||
# Open the constructor for this mod
|
||||
function product_cat()
|
||||
{
|
||||
# name of this module:
|
||||
$this->module = "product_cat";
|
||||
|
||||
# location of the construct XML file:
|
||||
$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
|
||||
|
||||
# open the construct file for parsing
|
||||
$C_xml = new CORE_xml;
|
||||
$construct = $C_xml->xml_to_array($this->xml_construct);
|
||||
|
||||
$this->method = $construct["construct"]["method"];
|
||||
$this->trigger = $construct["construct"]["trigger"];
|
||||
$this->field = $construct["construct"]["field"];
|
||||
$this->table = $construct["construct"]["table"];
|
||||
$this->module = $construct["construct"]["module"];
|
||||
$this->cache = $construct["construct"]["cache"];
|
||||
$this->order_by = $construct["construct"]["order_by"];
|
||||
$this->limit = $construct["construct"]["limit"];
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## USER CATEGORY ARR SMARTY ##
|
||||
##############################
|
||||
function user_menu($VAR)
|
||||
{
|
||||
global $smarty, $C_auth;
|
||||
$db = &DB();
|
||||
$dbc = new CORE_database;
|
||||
$sql = $dbc->sql_select( "product_cat", "*",
|
||||
"status = 1 AND (parent_id = 0 OR parent_id IS NULL OR parent_id = id)", "position", $db);
|
||||
$result = $db->Execute($sql);
|
||||
if($result->RecordCount() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
while(!$result->EOF) {
|
||||
# check for group settings:
|
||||
$groups = unserialize($result->fields['group_avail']);
|
||||
|
||||
$auth = false;
|
||||
for($ii=0; $ii<count($groups); $ii++) {
|
||||
if($C_auth->auth_group_by_id($groups[$ii])) $auth = true;
|
||||
}
|
||||
|
||||
if($auth) {
|
||||
# Create the array for smarty
|
||||
$smart[] = $result->fields;
|
||||
$i++;
|
||||
}
|
||||
$result->MoveNext();
|
||||
}
|
||||
$smarty->assign('product_cat', $smart);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## USER VIEW A CATEGORY ##
|
||||
##############################
|
||||
function user_view($VAR)
|
||||
{
|
||||
global $smarty, $C_auth;
|
||||
$db = &DB();
|
||||
|
||||
### Get the category information:
|
||||
$sql = sqlSelect($db, "product_cat", "id,position,template,name,thumbnail,group_avail,parent_id,max", "status = 1 AND id = ::{$VAR['id']}::");
|
||||
$result = $db->Execute($sql);
|
||||
|
||||
if(!$result || $result->RecordCount() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
# check for group settings:
|
||||
$groups = unserialize($result->fields['group_avail']);
|
||||
|
||||
# max results per page:
|
||||
$max = $result->fields['max'];
|
||||
if(empty($max)) $max = 25;
|
||||
$count = 0;
|
||||
if(empty($VAR['page']) || !is_numeric($VAR['page']) || $VAR['page'] <= 1 ) {
|
||||
$page = 1;
|
||||
$start = 0;
|
||||
} else {
|
||||
$page = $VAR['page'];
|
||||
$start = ($page-1)*$max;
|
||||
}
|
||||
|
||||
$auth = false;
|
||||
for($ii=0; $ii<count($groups); $ii++) {
|
||||
if($C_auth->auth_group_by_id($groups[$ii])) $auth = true;
|
||||
}
|
||||
|
||||
if($auth) {
|
||||
$smart[] = $result->fields;
|
||||
$smarty->assign('product_cat_arr', $smart);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parent_id = $result->fields['parent_id'];
|
||||
if(!$parent_id) $parent_id = '0';
|
||||
}
|
||||
|
||||
### Get the items in this category:
|
||||
$sql = sqlSelect($db, "product", "id,sku,thumbnail,avail_category_id,price_base,price_setup,group_avail", "active = 1", "position,sku");
|
||||
$result = $db->Execute($sql);
|
||||
if(!$result || $result->RecordCount() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
while(!$result->EOF) {
|
||||
# check that this item can be displayed in the current category:
|
||||
$cat = false;
|
||||
$cats = unserialize($result->fields['avail_category_id']);
|
||||
for($i=0; $i<count($cats); $i++) {
|
||||
if($cats[$i] == $VAR['id']) {
|
||||
$cat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($cat) {
|
||||
# check for group settings:
|
||||
$groups = unserialize($result->fields['group_avail']);
|
||||
|
||||
$auth = false;
|
||||
for($ii=0; $ii<count($groups); $ii++) {
|
||||
if($C_auth->auth_group_by_id($groups[$ii])) {
|
||||
$auth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
### Paging
|
||||
if($auth) {
|
||||
if($count >= $start && $count < $max*$page)
|
||||
$smart_prod[] = $result->fields;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
$results = $count;
|
||||
$pages = intval($results / $max);
|
||||
if ($results % $max) $pages++;
|
||||
|
||||
for($i=1;$i<=$pages;$i++) $pagearr[$i] = $i;
|
||||
|
||||
$smarty->assign('product_arr', $smart_prod);
|
||||
$smarty->assign('page_page', $page);
|
||||
$smarty->assign('page_results', $results);
|
||||
$smarty->assign('page_pages', $pages);
|
||||
$smarty->assign('page_arr', $pagearr);
|
||||
}
|
||||
|
||||
### Get any sub-categories:
|
||||
$sql = sqlSelect($db, "product_cat", "*", "status = 1 AND parent_id = ::{$VAR['id']}::","position,name");
|
||||
$result = $db->Execute($sql);
|
||||
if($result && $result->RecordCount()) {
|
||||
while(!$result->EOF) {
|
||||
$smart_sub_cat[] = $result->fields;
|
||||
$result->MoveNext();
|
||||
}
|
||||
$smarty->assign('product_sub_cat', $smart_sub_cat);
|
||||
}
|
||||
|
||||
### Get any parent categores:
|
||||
$p = AGILE_DB_PREFIX;
|
||||
$d = DEFAULT_SITE;
|
||||
$smart_parent_cat = Array();
|
||||
for($i=0; $i<=5; $i++)
|
||||
{
|
||||
if($parent_id > 0 )
|
||||
{
|
||||
# Get parent id & add to array
|
||||
$sql = "SELECT
|
||||
{$p}product_cat.id,
|
||||
{$p}product_cat.parent_id,
|
||||
{$p}product_cat.template,
|
||||
{$p}product_cat_translate.name
|
||||
FROM
|
||||
{$p}product_cat,{$p}product_cat_translate
|
||||
WHERE
|
||||
{$p}product_cat.site_id = {$d}
|
||||
AND
|
||||
{$p}product_cat_translate.site_id = {$d}
|
||||
AND
|
||||
{$p}product_cat.id = $parent_id
|
||||
AND
|
||||
{$p}product_cat_translate.product_cat_id = $parent_id
|
||||
AND
|
||||
{$p}product_cat_translate.language_id = '".SESS_LANGUAGE."'";
|
||||
$result = $db->Execute($sql);
|
||||
if($result && $result->RecordCount())
|
||||
{
|
||||
$parent_id = $result->fields['parent_id'];
|
||||
$smart_parent_cat[] = $result->fields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smart_parent_cat = array_reverse($smart_parent_cat);
|
||||
|
||||
## Get the current category:
|
||||
$sql = "SELECT
|
||||
{$p}product_cat.id,
|
||||
{$p}product_cat.parent_id,
|
||||
{$p}product_cat.template,
|
||||
{$p}product_cat_translate.name
|
||||
FROM
|
||||
{$p}product_cat,{$p}product_cat_translate
|
||||
WHERE
|
||||
{$p}product_cat.site_id = {$d}
|
||||
AND
|
||||
{$p}product_cat_translate.site_id = {$d}
|
||||
AND
|
||||
{$p}product_cat.id = ".$db->qstr($VAR['id'])."
|
||||
AND
|
||||
{$p}product_cat_translate.product_cat_id = ".$db->qstr($VAR['id'])."
|
||||
AND
|
||||
{$p}product_cat_translate.language_id = '".SESS_LANGUAGE."'";
|
||||
$result = $db->Execute($sql);
|
||||
if($result && $result->RecordCount())
|
||||
$smart_parent_cat[] = $result->fields;
|
||||
|
||||
$smarty->assign('parent_cat', $smart_parent_cat);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
###############################
|
||||
## ADMIN SINGLE SELECT MENU ##
|
||||
###############################
|
||||
function admin_menu_parent($VAR)
|
||||
{
|
||||
global $smarty, $C_auth;
|
||||
$db = &DB();
|
||||
$dbc = new CORE_database;
|
||||
$sql = $dbc->sql_select( "product_cat", "*", "", "parent_id,position,name", $db);
|
||||
$result = $db->Execute($sql);
|
||||
|
||||
# Get current id
|
||||
if(!empty($VAR['id'])) {
|
||||
$cid = ereg_replace(",","", $VAR['id']);
|
||||
} else {
|
||||
$current = '';
|
||||
}
|
||||
|
||||
# Loop and put in array
|
||||
while(!$result->EOF) {
|
||||
if($result->fields['parent_id'] == "" || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) {
|
||||
$arr[0][] = $result->fields;
|
||||
} else {
|
||||
$arr["{$result->fields['parent_id']}"][] = $result->fields;
|
||||
}
|
||||
|
||||
# get current parent_id
|
||||
if($cid > 0 && $result->fields['id'] == $cid)
|
||||
$current = $result->fields['parent_id'];
|
||||
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
# Create menu
|
||||
$option = '';
|
||||
|
||||
for($i=0; $i<count($arr[0]); $i++)
|
||||
{
|
||||
$id = $arr[0][$i]["id"];
|
||||
|
||||
if($id == $current)
|
||||
$sel = 'selected';
|
||||
else
|
||||
$sel = '';
|
||||
|
||||
$option .= '<option value="'.$id.'" '.$sel.'>'.$arr[0][$i]["name"].'</option>';
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 2)
|
||||
if(isset($arr[$id]))
|
||||
{
|
||||
for($ii=0; $ii<count($arr[$id]); $ii++)
|
||||
{
|
||||
$idx = $arr[$id][$ii]["id"];
|
||||
if($idx == $current) $sel = 'selected'; else $sel = '';
|
||||
$option .= '<option value="'.$idx.'" '.$sel.'>- '.$arr[$id][$ii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 3)
|
||||
if(isset($arr[$idx]))
|
||||
{
|
||||
for($iii=0; $iii<count($arr[$idx]); $iii++)
|
||||
{
|
||||
$idx2 = $arr[$idx][$iii]["id"];
|
||||
if($idx2 == $current) $sel = 'selected'; else $sel = '';
|
||||
$option .= '<option value="'.$idx2.'" '.$sel.'> - '.$arr[$idx][$iii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 4)
|
||||
if(isset($arr[$idx2]))
|
||||
{
|
||||
for($iiii=0; $iiii<count($arr[$idx2]); $iiii++)
|
||||
{
|
||||
$idx3 = $arr[$idx2][$iiii]["id"];
|
||||
if($idx3 == $current) $sel = 'selected'; else $sel = '';
|
||||
$option .= '<option value="'.$idx3.'" '.$sel.'> - '.$arr[$idx2][$iiii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 5)
|
||||
if(isset($arr[$idx3]))
|
||||
{
|
||||
for($iiiii=0; $iiiii<count($arr[$idx3]); $iiiii++)
|
||||
{
|
||||
$idx4 = $arr[$idx3][$iiiii]["id"];
|
||||
if($idx4 == $current) $sel = 'selected'; else $sel = '';
|
||||
$option .= '<option value="'.$idx4.'" '.$sel.'> - '.$arr[$idx3][$iiiii]["name"].'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<select name="product_cat_parent_id" onChange="submit()">';
|
||||
echo '<option value="0"></option>';
|
||||
echo $option;
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
## ADMIN MULTI SELECT MENU ##
|
||||
##############################
|
||||
function admin_menu_product($VAR)
|
||||
{
|
||||
global $smarty, $C_auth;
|
||||
$db = &DB();
|
||||
$dbc = new CORE_database;
|
||||
|
||||
# Get current category id
|
||||
if(!empty($VAR['id'])) {
|
||||
$product_id = ereg_replace(",","", $VAR['id']);
|
||||
$sql = $dbc->sql_select("product", "avail_category_id", "id = $product_id","", $db);
|
||||
$product = $db->Execute($sql);
|
||||
$current = unserialize($product->fields['avail_category_id']);
|
||||
} else {
|
||||
$current = '';
|
||||
}
|
||||
|
||||
# Loop and put in array
|
||||
$sql = $dbc->sql_select( "product_cat", "*", "", "parent_id,position,name", $db);
|
||||
$result = $db->Execute($sql);
|
||||
while(!$result->EOF)
|
||||
{
|
||||
# determine if selected
|
||||
$select = false;
|
||||
for($ix=0; $ix<count($current); $ix++) {
|
||||
if($current[$ix] == $result->fields['id']) {
|
||||
$result->fields['sel'] = 'selected';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
# set array
|
||||
if($result->fields['parent_id'] == "" || $result->fields['parent_id'] == 0 || $result->fields['parent_id'] == $result->fields['id']) {
|
||||
$arr[0][] = $result->fields;
|
||||
} else {
|
||||
$arr["{$result->fields['parent_id']}"][] = $result->fields;
|
||||
}
|
||||
|
||||
$result->MoveNext();
|
||||
}
|
||||
|
||||
# Create menu
|
||||
$option = '';
|
||||
|
||||
for($i=0; $i<count($arr[0]); $i++)
|
||||
{
|
||||
$id = $arr[0][$i]["id"];
|
||||
|
||||
$option .= '<option value="'.$id.'" '.@$arr[0][$i]["sel"].'>'.$arr[0][$i]["name"].'</option>';
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 2)
|
||||
if(isset($arr[$id]))
|
||||
{
|
||||
for($ii=0; $ii<count($arr[$id]); $ii++)
|
||||
{
|
||||
$idx = $arr[$id][$ii]["id"];
|
||||
$option .= '<option value="'.$idx.'" '.@$arr[$id][$ii]["sel"].'>- '.$arr[$id][$ii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 3)
|
||||
if(isset($arr[$idx]))
|
||||
{
|
||||
for($iii=0; $iii<count($arr[$idx]); $iii++)
|
||||
{
|
||||
$idx2 = $arr[$idx][$iii]["id"];
|
||||
$option .= '<option value="'.$idx2.'" '.@$arr[$idx][$iii]["sel"].'> - '.$arr[$idx][$iii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 4)
|
||||
if(isset($arr[$idx2]))
|
||||
{
|
||||
for($iiii=0; $iiii<count($arr[$idx2]); $iiii++)
|
||||
{
|
||||
$idx3 = $arr[$idx2][$iiii]["id"];
|
||||
$option .= '<option value="'.$idx3.'" '.@$arr[$idx2][$iiii]["sel"].'> - '.$arr[$idx2][$iiii]["name"].'</option>';
|
||||
}
|
||||
|
||||
##########################
|
||||
# get the sub-categories # (LEVEL 5)
|
||||
if(isset($arr[$idx3]))
|
||||
{
|
||||
for($iiiii=0; $iiiii<count($arr[$idx3]); $iiiii++)
|
||||
{
|
||||
$idx4 = $arr[$idx3][$iiiii]["id"];
|
||||
$option .= '<option value="'.$idx4.'" '.@$arr[$idx3][$iiiii]["sel"].'> - '.$arr[$idx3][$iiiii]["name"].'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<select name="product_avail_category_id[]" size="5" multiple >';
|
||||
echo $option;
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
## ADD ##
|
||||
##############################
|
||||
function add($VAR)
|
||||
{
|
||||
global $_FILES;
|
||||
|
||||
####################################################################
|
||||
### Validate the thumbnail upoad:
|
||||
if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0)
|
||||
{
|
||||
$VAR['product_cat_thumbnail'] = "cat_thmb_".$_FILES['upload_file1']['name'];
|
||||
}
|
||||
|
||||
### Validate the image upoad:
|
||||
if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0)
|
||||
{
|
||||
$VAR['product_cat_image'] = "cat_img_".$_FILES['upload_file2']['name'];
|
||||
}
|
||||
|
||||
|
||||
####################################################################
|
||||
## Attempt to add the record:
|
||||
|
||||
$type = "add";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$result = $db->add($VAR, $this, $type);
|
||||
|
||||
|
||||
####################################################################
|
||||
### Copy the image(s)
|
||||
if($result)
|
||||
{
|
||||
### Copy 1ST file upoad:
|
||||
if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0)
|
||||
copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']);
|
||||
|
||||
### Copy the 2ND file upoad:
|
||||
if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0)
|
||||
copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
## VIEW ##
|
||||
##############################
|
||||
function view($VAR)
|
||||
{
|
||||
$type = "view";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->view($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## UPDATE ##
|
||||
##############################
|
||||
function update($VAR)
|
||||
{
|
||||
global $_FILES;
|
||||
|
||||
####################################################################
|
||||
### Validate the thumbnail upoad:
|
||||
if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0)
|
||||
{
|
||||
$VAR['product_cat_thumbnail'] = "cat_thmb_".$_FILES['upload_file1']['name'];
|
||||
} elseif ( $VAR['delthumb'] == 1 ) {
|
||||
$VAR['product_cat_thumbnail'] = "";
|
||||
}
|
||||
|
||||
### Validate the image upoad:
|
||||
if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0)
|
||||
{
|
||||
$VAR['product_cat_image'] = "cat_img_".$_FILES['upload_file2']['name'];
|
||||
} elseif ( $VAR['delimg'] == 1 ) {
|
||||
$VAR['product_cat_image'] = "";
|
||||
}
|
||||
|
||||
$type = "update";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$result = $db->update($VAR, $this, $type);
|
||||
|
||||
####################################################################
|
||||
### Copy the image(s)
|
||||
if($result)
|
||||
{
|
||||
### Copy 1ST file upoad:
|
||||
if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0)
|
||||
copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']);
|
||||
|
||||
### Copy the 2ND file upoad:
|
||||
if(isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0)
|
||||
copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']);
|
||||
}
|
||||
}
|
||||
|
||||
##############################
|
||||
## DELETE ##
|
||||
##############################
|
||||
function delete($VAR)
|
||||
{
|
||||
$this->associated_DELETE =
|
||||
Array ( Array ( 'table' => 'product_cat_translate', 'field' => 'product_cat_id') );
|
||||
|
||||
$db = new CORE_database;
|
||||
$db->mass_delete($VAR, $this, "");
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH FORM ##
|
||||
##############################
|
||||
function search_form($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_form($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH ##
|
||||
##############################
|
||||
function search($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH SHOW ##
|
||||
##############################
|
||||
|
||||
function search_show($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_show($VAR, $this, $type);
|
||||
}
|
||||
}
|
||||
?>
|
77
modules/product_cat/product_cat_construct.xml
Normal file
77
modules/product_cat/product_cat_construct.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<construct>
|
||||
<!-- define the module name -->
|
||||
<module>product_cat</module>
|
||||
<!-- define the module table name -->
|
||||
<table>product_cat</table>
|
||||
<!-- define the module dependancy(s) -->
|
||||
<dependancy>product</dependancy>
|
||||
<!-- define the DB cache in seconds -->
|
||||
<cache>0</cache>
|
||||
<!-- define the default order_by field for SQL queries -->
|
||||
<order_by>position</order_by>
|
||||
<!-- define the methods -->
|
||||
<limit>25</limit>
|
||||
<!-- define database indexes -->
|
||||
<index>
|
||||
<status>status</status>
|
||||
<position>position</position>
|
||||
<name>name</name>
|
||||
</index>
|
||||
<!-- define the fields -->
|
||||
<field>
|
||||
<id>
|
||||
<type>I4</type>
|
||||
<unique>1</unique>
|
||||
</id>
|
||||
<site_id>
|
||||
<type>I4</type>
|
||||
</site_id>
|
||||
<parent_id>
|
||||
<type>I4</type>
|
||||
</parent_id>
|
||||
<group_avail>
|
||||
<type>X2</type>
|
||||
<convert>array</convert>
|
||||
<validate>any</validate>
|
||||
</group_avail>
|
||||
<name>
|
||||
<type>C(32)</type>
|
||||
<min_len>2</min_len>
|
||||
<max_len>32</max_len>
|
||||
<validate>any</validate>
|
||||
</name>
|
||||
<notes>
|
||||
<type>C(255)</type>
|
||||
</notes>
|
||||
<status>
|
||||
<type>L</type>
|
||||
</status>
|
||||
<template>
|
||||
<type>C(128)</type>
|
||||
</template>
|
||||
<thumbnail>
|
||||
<type>C(128)</type>
|
||||
</thumbnail>
|
||||
<image>
|
||||
<type>C(128)</type>
|
||||
</image>
|
||||
<position>
|
||||
<type>I4</type>
|
||||
</position>
|
||||
<max>
|
||||
<type>I4</type>
|
||||
<validate>numeric</validate>
|
||||
</max>
|
||||
</field>
|
||||
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
|
||||
<method>
|
||||
<add>id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id</add>
|
||||
<update>id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id</update>
|
||||
<delete>id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id</delete>
|
||||
<view>id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id</view>
|
||||
<search>id,site_id,name,notes,status,template,thumbnail,image,position,max,group_avail,parent_id</search>
|
||||
</method>
|
||||
<!-- define the method triggers -->
|
||||
<trigger>0</trigger>
|
||||
</construct>
|
40
modules/product_cat/product_cat_install.xml
Normal file
40
modules/product_cat/product_cat_install.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<install>
|
||||
<module_properties>
|
||||
<name>product_cat</name>
|
||||
<parent>product</parent>
|
||||
<notes><![CDATA[This module controls the product categories]]></notes>
|
||||
<menu_display>1</menu_display>
|
||||
<dependancy>product</dependancy>
|
||||
</module_properties>
|
||||
<sql_inserts>
|
||||
<module_method>
|
||||
<add>
|
||||
<name>add</name>
|
||||
<page><![CDATA[%%:add]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</add>
|
||||
<search_form>
|
||||
<name>search_form</name>
|
||||
<notes><![CDATA[Allow users to view the search form]]></notes>
|
||||
</search_form>
|
||||
<search>
|
||||
<name>search</name>
|
||||
</search>
|
||||
<view>
|
||||
<name>view</name>
|
||||
<page><![CDATA[core:search&module=%%&_escape=1&_next_page_one=view]]></page>
|
||||
<menu_display>1</menu_display>
|
||||
</view>
|
||||
<delete>
|
||||
<name>delete</name>
|
||||
</delete>
|
||||
<update>
|
||||
<name>update</name>
|
||||
</update>
|
||||
<search_show>
|
||||
<name>search_show</name>
|
||||
<notes><![CDATA[Allow users to view the search results]]></notes>
|
||||
</search_show>
|
||||
</module_method>
|
||||
</sql_inserts>
|
||||
</install>
|
18
modules/product_cat/product_cat_install_data.xml
Normal file
18
modules/product_cat/product_cat_install_data.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<install>
|
||||
<product_cat>
|
||||
<id>1</id>
|
||||
<site_id>1</site_id>
|
||||
<parent_id>0</parent_id>
|
||||
<group_avail><![CDATA[a:1:{i:0;s:1:"0";}]]></group_avail>
|
||||
<name>Sample Directory</name>
|
||||
<notes>You can edit this category as needed</notes>
|
||||
<status>1</status>
|
||||
<template>Paged Listing</template>
|
||||
<position>1</position>
|
||||
<max>10</max>
|
||||
</product_cat>
|
||||
<product_cat_id>
|
||||
<id>8</id>
|
||||
</product_cat_id>
|
||||
</install>
|
Reference in New Issue
Block a user