I have the same problem. Fatal error: Call to undefined function: jjg_db_getattributesetid() in /home/richmpt/public_html/cart/admin/categories.php on line 574
Here is the code that I have near and around line 574 of my categories.php file, from lines 555 to 622. I also double checked to make sure that the jjg_db_getattributesetid() is mixed case as it should be.
<!-- //JJG building list of Attribute Sets Used - Begin -->
<?php
if( empty($pInfo->products_id) ){
$iteration = 0;
}else{
$getOptionsCount_query = tep_db_query('SELECT count(
DISTINCT products_attributes_sets_id ) as count
FROM '. TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .'
WHERE `products_id` ='.$pInfo->products_id);
$arr_getOptionsCount = tep_db_fetch_array($getOptionsCount_query);
$arr_pas_id = jjg_db_getAttributeSetId($pInfo->products_id);
if( !empty($arr_pas_id) ){
$iteration = $arr_getOptionsCount['count'];
}
}
for($i=0; $i <= $iteration; $i++){
?>
<tr>
<td class="main">
<?php
if( isset($pID) ){
if( $i == $iteration ){
echo "Add An " . TEXT_PRODUCTS_ATTRIBUTES_SET;
}else{
echo "Using " . TEXT_PRODUCTS_ATTRIBUTES_SET;
}
}
?>
</td>
<td class="main">
<?php
if( isset($pID) ){
if( $i == $iteration ){
echo tep_draw_separator('pixel_trans.gif', '30', '1').
'<a href="' . tep_href_link(
FILENAME_PRODUCTS_ATTRIBUTES_SETS_EDIT, 'pID='.$_GET['pID'].'&cPath='.$_GET['cPath']) .
'" >'. tep_image_button('button_add_as.gif',
'[Click To Add An A.S.]' ) .'</a>';
}else{
echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ';
echo $attribute_sets_names_array[$arr_pas_id[$i]];
echo tep_draw_separator('pixel_trans.gif', '24', '15');
echo tep_draw_checkbox_field('remove_products_attributes_sets_id_'.$i);
echo "<font size=-3>(Remove Set)</font>";
echo tep_draw_hidden_field('products_attributes_sets_id_'.$i,
$arr_pas_id[$i]);
}
}
?>
</td>
</tr>
<?php
}
?>
Here is the code that I have added to my database.php file
function jjg_db_attributeSets($arr_attributeSetID, $productID, $action, $arr_remove_sets = array(), $link = 'db_link'){
//remove all references to this product_id in these tables, and reinsert new ones
if( $action == 'update_product' || 'delete_product_confirm' ){
$delete_query = "delete from products_attributes_sets_to_products where products_id=".$productID;
tep_db_query($delete_query, $link);
}
//if you remove the product, then our work is done
if( $action == 'delete_product_confirm' ){
return;
}
for($j=0; $j<count($arr_attributeSetID); $j++){
if( empty($arr_attributeSetID[$j]) ){
continue;
}
if( in_array($arr_attributeSetID[$j], $arr_remove_sets) ){
continue;
}
$select_query = "select products_attributes_sets_value
FROM ". TABLE_PRODUCTS_ATTRIBUTES_SETS .
" WHERE products_attributes_sets_id=".$arr_attributeSetID[$j];
$products_attributes_sets_query = tep_db_query($select_query, $link);
$products_attributes_sets_resultset = tep_db_fetch_array($products_attributes_sets_query);
$products_attributes_sets_value = $products_attributes_sets_resultset['products_attributes_sets_value'];
$arrPASV = split("_",$products_attributes_sets_value);
for($i=0; $i<count($arrPASV); $i++){
$attribSet = $arrPASV[$i];
$arrAtom = split("/",$attribSet);
$valOptions_id = $arrAtom[0];
$valOptions_values_id = $arrAtom[1];
$valOptions_values_price = $arrAtom[3];
$valPrice_prefix = $arrAtom[2];
if( count($arrAtom) == 5 ){
$valSort_Order = $arrAtom[4];
}else{
$valSort_Order = "1";
}
//$valPrice_prefix = $action;
// remove references to this option_id for the product_id
if( $action == 'update_product' && $i == 0) {
$delete_query = "delete from products_attributes where products_id=".$productID. " and options_id=".$valOptions_id;
tep_db_query($delete_query, $link);
}
$insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES .
" (products_id, options_id, options_values_id, options_values_price, price_prefix, sort_order) values ".
" (".$productID.",".$valOptions_id.",".$valOptions_values_id.",".$valOptions_values_price.",'".$valPrice_prefix."',".$valSort_Order.")";
tep_db_query($insert_query, $link);
}
$insert_query = "insert into ".TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS .
" (products_attributes_sets_id, products_id) values (".$arr_attributeSetID[$j].",".$productID.")";
tep_db_query($insert_query, $link);
}
}
Any help is much appreciated. :sweating: