function onMassactionTableActionsLoad(&$table,&$actions,&$actions_html,&$loadedData){
$db = JFactory::getDBO();
$dispTables = array();
$updTables = array();
$customCheckboxes = '';
$database = JFactory::getDBO();
$type = 'action';
if(empty($loadedData->massaction_filters)){
$loadedData->massaction_filters = array();
}
$massactionClass = hikashop_get('class.massaction');
$actions['displayResults']=JText::_('DISPLAY_RESULTS');
$actions['exportCsv']=JText::_('EXPORT_CSV');
$actions['updateValues']=JText::_('UPDATE_VALUES');
$actions['deleteElements']=JText::_('DELETE_ELEMENTS');
switch($table->table){
case 'product':
$dispTables = array('product','price','category');
$updTables = array('product','price');
/*
$actions['updateCategories']=JText::_('UPDATE_CATEGORIES');
$actions['updateRelateds']=JText::_('UPDATE_RELATEDS');
$actions['updateOptions']=JText::_('UPDATE_OPTIONS');
$actions['updateCharacteristics']=JText::_('UPDATE_CHARACTERISTICS');
*/
$productType = hikashop_get('type.productdisplay');
break;
case 'category':
$dispTables = array('category');
$updTables = array('category');
break;
case 'order':
$dispTables = array('order','order_product','address','user','joomla_users');
$updTables = array('order','order_product');
$actions['changeStatus']=JText::_('CHANGE_STATUS');
$actions['addProduct']=JText::_('ADD_EXISTING_PRODUCT');
$actions['changeGroup']=JText::_('CHANGE_USER_GROUP');
break;
case 'user':
$dispTables = array('user','joomla_users','address');
$updTables = array('user','joomla_users');
$actions['changeGroup']=JText::_('CHANGE_USER_GROUP');
break;
case 'address':
$dispTables = array('address','user','joomla_users');
$updTables = array('address');
break;
case 'user':
$dispTables = array('user','joomla_users','address');
$updTables = array('user','joomla_users');
default:
return false;
break;
}
if(is_array($dispTables)){
/**************************************************
DIPLAY RESULT
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->data = array();
$loadedData->massaction_actions['__num__']->name = 'displayResults';
$loadedData->massaction_actions['__num__']->html = '';
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'displayResults' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$value->type = $dispTables[0];
$margin = '';
$output = '';
$customCheckboxes='';
foreach($dispTables as $relatedTable){
if(version_compare(JVERSION,'3.0','<')){
if(preg_match('/joomla_/',$relatedTable)) $fieldsTable = $db->getTableFields('#__'.str_replace('joomla_','',$relatedTable));
else $fieldsTable = $db->getTableFields('#__hikashop_'.$relatedTable);
$fields = reset($fieldsTable);
} else {
if(preg_match('/joomla_/',$relatedTable)) $fields = $db->getTableColumns('#__'.str_replace('joomla_','',$relatedTable));
else $fields = $db->getTableColumns('#__hikashop_'.$relatedTable);
}
if(!empty($fields)) {
$output .= '<div id="action_'.$table->table.'_'.$key.'_displayResults_'.$relatedTable.'Column_div" class="hika_massaction_checkbox"> <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_'.$relatedTable.'Column_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_'.$relatedTable.'Column_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a> <br/>';
foreach($fields as $key2 => $field){
$checked='';
if(isset($value->data[$relatedTable]) && isset($value->data[$relatedTable][$key2])){
$checked='checked="checked"';
}
$output .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_displayResults_'.$relatedTable.'Column_'.$key2.'" name="action['.$table->table.']['.$key.'][displayResults]['.$relatedTable.']['.$key2.']" value="'.$key2.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_displayResults_'.$relatedTable.'Column_'.$key2.'">'.$key2.'</label><br/>';
}
$output .= '</div>';
$margin = 'margin-left: 20px;';
}
}
switch($table->table){
case 'product':
// Characteristic
$db->setQuery('SELECT * FROM '.hikashop_table('characteristic').' WHERE characteristic_parent_id = 0');
$characteristics = $db->loadObjectList();
if(is_array($characteristics)){
$customCheckboxes .= '<div id="action_'.$table->table.'_'.$key.'_displayResults_characteristicColumn_div" class="hika_massaction_checkbox"><a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_characteristicColumn_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_characteristicColumn_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a><br/>';
foreach($characteristics as $characteristic){
$checked='';
if(isset($value->data['characteristic'][$characteristic->characteristic_value])){
$checked='checked="checked"';
}
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_displayResults_characteristicColumn_'.$characteristic->characteristic_value.'" name="action['.$table->table.']['.$key.'][displayResults][characteristic]['.$characteristic->characteristic_value.']" value="'.$characteristic->characteristic_value.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_displayResults_characteristicColumn_'.$characteristic->characteristic_value.'">'.$characteristic->characteristic_value.'</label><br/>';
}
$customCheckboxes .= '</div>';
}
// Product related
$db->setQuery('SELECT * FROM '.hikashop_table('product_related'));
$relateds = $db->loadObjectList();
if(is_array($relateds)){
$customCheckboxes .= '<div id="action_'.$table->table.'_'.$key.'_displayResults_relatedColumn_div" class="hika_massaction_checkbox"><a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_relatedColumn_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_displayResults_relatedColumn_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a><br/>';
$displayed = array();
foreach($relateds as $related){
$checked='';
if(isset($value->data['related'][$related->product_related_type])){
$checked='checked="checked"';
}
if(!in_array($related->product_related_type, $displayed))
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_displayResults_relatedColumn_'.$related->product_related_type.'" name="action['.$table->table.']['.$key.'][displayResults][related]['.$related->product_related_type.']" value="'.$related->product_related_type.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_displayResults_relatedColumn_'.$related->product_related_type.'">'.$related->product_related_type.'</label><br/>';
$displayed[] = $related->product_related_type;
}
$customCheckboxes .= '</div>';
}
break;
case 'user':
$checked='';
if(isset($value->data['usergroups'])){
$checked='checked="checked"';
}
$customCheckboxes .= '<div class="hika_massaction_checkbox">';
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_displayResults_usergroupsColumn_title" name="action['.$table->table.']['.$key.'][displayResults][usergroups][title]" value="usergroups" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_displayResults_usergroupsColumn_title">'.JText::_('GROUP_NAME').'</label><br/>';
$customCheckboxes .= '</div>';
break;
}
$output .= $customCheckboxes;
$output .= '<div style="clear:both;"></div>';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
EXPORT
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->data = array('path'=>'');
$loadedData->massaction_actions['__num__']->name = 'exportCsv';
$loadedData->massaction_actions['__num__']->html = '';
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'exportCsv' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
if(!isset($value->data['formatExport']['path'])) $value->data['formatExport']['path'] = '';
$output='';
$margin = '';
$customCheckboxes='';
foreach($dispTables as $relatedTable){
if(version_compare(JVERSION,'3.0','<')){
if(preg_match('/joomla_/',$relatedTable)) $fieldsTable = $db->getTableFields('#__'.str_replace('joomla_','',$relatedTable));
else $fieldsTable = $db->getTableFields('#__hikashop_'.$relatedTable);
$fields = reset($fieldsTable);
} else {
if(preg_match('/joomla_/',$relatedTable)) $fields = $db->getTableColumns('#__'.str_replace('joomla_','',$relatedTable));
else $fields = $db->getTableColumns('#__hikashop_'.$relatedTable);
}
if(!empty($fields)) {
$output .= '<div id="action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_div" class="hika_massaction_checkbox"> <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a> <br/>';
foreach($fields as $key2 => $field){
$checked='';
if(isset($value->data[$relatedTable]) && isset($value->data[$relatedTable][$key2])){
$checked='checked="checked"';
}
$output .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_'.$key2.'" name="action['.$table->table.']['.$key.'][exportCsv]['.$relatedTable.']['.$key2.']" value="'.$key2.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_'.$key2.'">'.$key2.'</label><br/>';
}
if($relatedTable == 'price'){
if(isset($value->data[$relatedTable]) && isset($value->data[$relatedTable]['price_value_with_tax'])){
$checked='checked="checked"';
}
$output .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_price_value_with_tax" name="action['.$table->table.']['.$key.'][exportCsv]['.$relatedTable.'][price_value_with_tax]" value="price_value_with_tax" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_exportCsv_'.$relatedTable.'Column_price_value_with_tax">price_value_with_tax</label><br/>';
}
$output .= '</div>';
$margin = 'margin-left: 20px;';
}
}
switch($table->table){
case 'product':
// Characteristic
$db->setQuery('SELECT * FROM '.hikashop_table('characteristic').' WHERE characteristic_parent_id = 0');
$characteristics = $db->loadObjectList();
if(is_array($characteristics)){
$customCheckboxes .= '<div id="action_'.$table->table.'_'.$key.'_exportCsv_characteristicColumn_div" class="hika_massaction_checkbox"><a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_characteristicColumn_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_characteristicColumn_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a><br/>';
foreach($characteristics as $characteristic){
$checked='';
if(isset($value->data['characteristic'][$characteristic->characteristic_value])){
$checked='checked="checked"';
}
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_exportCsv_characteristicColumn_'.$characteristic->characteristic_value.'" name="action['.$table->table.']['.$key.'][exportCsv][characteristic]['.$characteristic->characteristic_value.']" value="'.$characteristic->characteristic_value.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_exportCsv_characteristicColumn_'.$characteristic->characteristic_value.'">'.$characteristic->characteristic_value.'</label><br/>';
}
$customCheckboxes .= '</div>';
}
// Product related
$db->setQuery('SELECT * FROM '.hikashop_table('product_related'));
$relateds = $db->loadObjectList();
if(is_array($relateds)){
$customCheckboxes .= '<div id="action_'.$table->table.'_'.$key.'_exportCsv_relatedColumn_div" class="hika_massaction_checkbox"><a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_relatedColumn_div\',\'check\');">'.JText::_('SELECT_ALL').'</a> / <a style="cursor: pointer;" onclick="checkAll(\'action_'.$table->table.'_'.$key.'_exportCsv_relatedColumn_div\',\'uncheck\');">'.JText::_('UNSELECT_ALL').'</a><br/>';
$displayed = array();
foreach($relateds as $related){
$checked='';
if(isset($value->data['related'][$related->product_related_type])){
$checked='checked="checked"';
}
if(!in_array($related->product_related_type, $displayed))
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_exportCsv_relatedColumn_'.$related->product_related_type.'" name="action['.$table->table.']['.$key.'][exportCsv][related]['.$related->product_related_type.']" value="'.$related->product_related_type.'" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_exportCsv_relatedColumn_'.$related->product_related_type.'">'.$related->product_related_type.'</label><br/>';
$displayed[] = $related->product_related_type;
}
$customCheckboxes .= '</div>';
}
break;
case 'user':
$checked='';
if(isset($value->data['usergroups'])){
$checked='checked="checked"';
}
$customCheckboxes .= '<div class="hika_massaction_checkbox">';
$customCheckboxes .= '<input type="checkbox" '.$checked.' id="action_'.$table->table.'_'.$key.'_exportCsv_usergroupsColumn_title" name="action['.$table->table.']['.$key.'][exportCsv][usergroups][title]" value="usergroups" /><label style="width: 100%;" for="action_'.$table->table.'_'.$key.'_exportCsv_usergroupsColumn_title">'.JText::_('GROUP_NAME').'</label><br/>';
$customCheckboxes .= '</div>';
break;
}
$output .= $customCheckboxes;
$output .= '<div style="clear:both;"></div>';
$checked='';
if(isset($value->data['formatExport']['format']) && $value->data['formatExport']['format']=='xls')
$checked='checked="checked"';
$output .='<input type="radio" id="action'.$table->table.''.$key.'exportCsvformatExportformatcsv" name="action['.$table->table.']['.$key.'][exportCsv][formatExport][format]" checked value="csv"> <label for="action'.$table->table.''.$key.'exportCsvformatExportformatcsv">'.JText::_('CSV').'</label> <input type="radio" id="action'.$table->table.''.$key.'exportCsvformatExportformatxls" name="action['.$table->table.']['.$key.'][exportCsv][formatExport][format]" '.$checked.' value="xls"> <label for="action'.$table->table.''.$key.'exportCsvformatExportformatxls">'.JText::_('XLS').'</label>';
$output .= '<br/>'.JText::_('EXPORT_PATH').': <input type="text" name="action['.$table->table.']['.$key.'][exportCsv][formatExport][path]" value="'.$value->data['formatExport']['path'].'" />';
$output .= '<div style="clear:both;"></div>';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
UPDATE VALUES
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->data = array('type' => '','value' => '','operation' => '');
$loadedData->massaction_actions['__num__']->name = 'updateValues';
$loadedData->massaction_actions['__num__']->html = '';
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'updateValues' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$output='';
$typeField = array();
foreach($updTables as $relatedTable){
if(version_compare(JVERSION,'3.0','<')){
if(preg_match('/joomla_/',$relatedTable)){
$fieldsTable = $db->getTableFields('#__'.str_replace('joomla_','',$relatedTable));
$fields = reset($fieldsTable);
foreach($fields as $key2 => $field){
$fields[$relatedTable.'_'.$key2] = $fields[$key2];
unset($fields[$key2]);
}
$fieldsTable = $fields;
}
else{
$fieldsTable = $db->getTableFields('#__hikashop_'.$relatedTable);
$fields = reset($fieldsTable);
}
} else {
if(preg_match('/joomla_/',$relatedTable)){
$fields = $db->getTableColumns('#__'.str_replace('joomla_','',$relatedTable));
foreach($fields as $key2 => $field){
$fields[$relatedTable.'_'.$key2] = $fields[$key2];
unset($fields[$key2]);
}
}
else $fields = $db->getTableColumns('#__hikashop_'.$relatedTable);
}
$typeField[] = JHTML::_('select.option', '<OPTGROUP>',JText::_(strtoupper($relatedTable)));
if(!empty($fields)) {
foreach($fields as $key2 => $field){
$typeField[] = JHTML::_('select.option',$key2,$key2);
}
}
$typeField[] = JHTML::_('select.option', '</OPTGROUP>');
}
$selected1='';$selected2='';$selected3='';$selected4='';
//$value->data['operation']
$operations=array('int', 'float', 'string', 'operation');
$options='';
foreach($operations as $op){
$selected='';
if($op==$value->data['operation'])
$selected='selected="selected"';
$options .='<option '.$selected.' value="'.$op.'">'.JText::_(strtoupper($op)).'</option>';
}
$output .= JHTML::_('select.genericlist', $typeField, "action[".$table->table."][".$key."][updateValues][type]", 'class="inputbox chzn-done not-processed" size="1"', 'value', 'text', $value->data['type']);
$output .= ' = <select class=" chzn-done not-processed" onchange="if(this.value == \'operation\'){document.getElementById(\'updateValues_message\').style.display = \'inline\';}" name="action['.$table->table.']['.$key.'][updateValues][operation]">
'.$options.'
</select>';
$output .= ' <input class="inputbox" type="text" name="action['.$table->table.']['.$key.'][updateValues][value]" size="50" value="'. htmlspecialchars($value->data['value'], ENT_COMPAT, 'UTF-8').'" />';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
DELETE
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'deleteElements';
$loadedData->massaction_actions['__num__']->html = '';
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'deleteElements' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$output = JText::_('DELETE_FILTERED_ELEMENTS'); //'This will delete all the elements returned in the filter.';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
CHANGE ORDER STATUS
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'changeStatus';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'notify' => '');
foreach($loadedData->massaction_actions as $key => &$value) {
if(($value->name != 'changeStatus' || ($table->table != $loadedData->massaction_table && is_int($key))))
continue;
$db->setQuery('SELECT `category_name` FROM '.hikashop_table('category').' WHERE `category_type` = '.$db->quote('status').' AND `category_name` != '.$db->quote('order status'));
$orderStatuses = $db->loadObjectList();
$output='<div id="'.$table->table.'action'.$key.'changeStatus">';
$output.= JText::_('NEW_ORDER_STATUS').': <select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_changeStatus_value" name="action['.$table->table.']['.$key.'][changeStatus][value]">';
if(is_array($orderStatuses)){
foreach($orderStatuses as $orderStatus){
$orderStatus = $orderStatus->category_name;
$selected='';
if($orderStatus==$value->data['value']){
$selected='selected="selected"';
}
$output.='<option '.$selected.' value="'.$orderStatus.'">'.JText::_($orderStatus).'</option>';
}
}
$checked='';
if(isset($value->data['notify']) && $value->data['notify']==1){
$checked='checked="checked"';
}
$output.='</select><input type="checkbox" '.$checked.' value="1" id="action_'.$table->table.'_'.$key.'_changeStatus_notify" name="action['.$table->table.']['.$key.'][changeStatus][notify]"/><label for="action_'.$table->table.'_'.$key.'_changeStatus_notify">'.JText::_('SEND_NOTIFICATION_EMAIL').'</label></div>';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
ADD A PRODUCT
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'addProduct';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '', 'quantity' => '1');
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'addProduct' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
if(!isset($value->data['type'])) $value->data['type'] = 'add';
$products=array();
if(!empty($value->data) && !empty($value->data['value'])){
JArrayHelper::toInteger($value->data['value']);
$query = 'SELECT product_id,product_name FROM '.hikashop_table('product').' WHERE product_id IN ('.implode(',',$value->data['value']).')';
$database->setQuery($query);
$products = $database->loadObjectList('product_id');
}
if(!isset($value->data['quantity'])) $value->data['quantity'] = '1';
$productType = hikashop_get('type.productdisplay');
$productSelect = $productType->displayMultiple('action['.$table->table.']['.$key.'][addProduct][value]', $products, '', 0);
$output ='<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_addProduct_type" name="action['.$table->table.']['.$key.'][addProduct][type]">';
$datas = array('add'=>'ADD', 'remove'=>'REMOVE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select>';
$output .='<input class="inputbox" type="text" name="action['.$table->table.']['.$key.'][addProduct][quantity]" size="10" value="'.$value->data['quantity'].'" /> '.JText::_('PRODUCTS');
$output .= $productSelect;
if(isset($value->data['update'])) $checked = 'checked="checked"';
else $checked = '';
$output .= '<input type="checkbox" value="update" id="action_'.$table->table.'_'.$key.'_addProduct_update" name="action['.$table->table.']['.$key.'][addProduct][update]" '.$checked.'/><label for="action_'.$table->table.'_'.$key.'_addProduct_update">'.JText::_('UPDATE_PRODUCT_STOCK').'</label>';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
/**************************************************
UPDATE CATEGORIES
*************************************************/
/*
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'updateCategories';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '');
//new dbug($loadedData);
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'updateCategories' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$categories=array();
if(!empty($value->data) && !empty($value->data['value'])){
$query = 'SELECT category_id,category_name FROM '.hikashop_table('category').' WHERE category_id IN ('.implode($value->data['value'],',').')';
$database->setQuery($query);
$categories = $database->loadObjectList('category_id');
}
// Get the category select display (backported from hikamarket)
$categoryType = hikashop_get('type.categorysub');
$categorySelect = $categoryType->displayMultiple('action['.$table->table.']['.$key.'][updateCategories][value]', $categories, '', 0);
// Display
$output ='<select id="action_'.$table->table.'_'.$key.'_updateCategories_type" class="select-listing chzn-done not-processed" name="action['.$table->table.']['.$key.'][updateCategories][type]">';
$datas = array('add'=>'ADD', 'replace'=>'REPLACE','remove'=>'REMOVE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select>';
$output .= $categorySelect;
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
*/
/**************************************************
UPDATE RELATED
*************************************************/
/*
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'updateRelateds';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '');
//new dbug($loadedData);
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'updateRelateds' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$products=array();
if(!empty($value->data) && !empty($value->data['value'])){
JArrayHelper::toInteger($value->data['value']);
$query = 'SELECT product_id,product_name FROM '.hikashop_table('product').' WHERE product_id IN ('.implode(',',$value->data['value']).')';
$database->setQuery($query);
$products = $database->loadObjectList('product_id');
}
$productType = hikashop_get('type.productdisplay');
$productSelect = $productType->displayMultiple('action['.$table->table.']['.$key.'][updateRelateds][value]', $products, '', 0);
$output ='<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_updateRelateds_type" name="action['.$table->table.']['.$key.'][updateRelateds][type]">';
$datas = array('add'=>'ADD', 'replace'=>'REPLACE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select>';
$output .= $productSelect;
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
*/
/**************************************************
UPDATE OPTIONS
*************************************************/
/*
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'updateOptions';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '');
//new dbug($loadedData);
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'updateOptions' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$options=array();
if(!empty($value->data) && !empty($value->data['value'])){
JArrayHelper::toInteger($value->data['value']);
$query = 'SELECT product_id,product_name FROM '.hikashop_table('product').' WHERE product_id IN ('.implode($value->data['value'],',').')';
$database->setQuery($query);
$options = $database->loadObjectList('product_id');
}
$productType = hikashop_get('type.productdisplay');
$productSelect = $productType->displayMultiple('action['.$table->table.']['.$key.'][updateOptions][value]', $options, '', 0);
$output ='<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_updateOptions_type" name="action['.$table->table.']['.$key.'][updateOptions][type]">';
$datas = array('add'=>'ADD', 'replace'=>'REPLACE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select>';
$output .= $productSelect;
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
*/
/**************************************************
UPDATE CHARACTERISTICS
*************************************************/
/*
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'updateCharacteristics';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '');
//new dbug($loadedData);
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'updateCharacteristics' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
$characteristics=array();
$query = 'SELECT * FROM '.hikashop_table('characteristic').' WHERE characteristic_parent_id = 0';
$database->setQuery($query);
$characteristics = $database->loadObjectList();
if(!empty($characteristics)){
$output ='<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_updateCharacteristics_type" name="action['.$table->table.']['.$key.'][updateCharacteristics][type]">';
$datas = array('add'=>'ADD', 'delete'=>'HIKA_DELETE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select><br/><div class="hika_massaction_checkbox" >';
if(!isset($value->data['value'])) $value->data['value'] = '';
if(!is_array($value->data['value'])) $value->data['value'] = (array)$value->data['value'];
foreach($characteristics as $characteristic){
$checked = '';
if(in_array($characteristic->characteristic_id,$value->data['value'])) $checked = 'checked="checked"';
$output .= '<br/><input type="checkbox" name="action['.$table->table.']['.$key.'][updateCharacteristics][value][]" '.$checked.' value="'.$characteristic->characteristic_id.'" />'.$characteristic->characteristic_value;
}
$output .= '</div>';
}else{
$output = '<div class="alert">'.JText::_('MASSACTION_NO_CHARACTERISTICS').'</div>';
}
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
*/
/**************************************************
CHANGE USER GROUP
*************************************************/
$loadedData->massaction_actions['__num__'] = new stdClass();
$loadedData->massaction_actions['__num__']->type = $table->table;
$loadedData->massaction_actions['__num__']->name = 'changeGroup';
$loadedData->massaction_actions['__num__']->html = '';
$loadedData->massaction_actions['__num__']->data = array('value' => '', 'type' => '');
//new dbug($loadedData);
foreach($loadedData->massaction_actions as $key => &$value) {
if($value->name != 'changeGroup' || ($table->table != $loadedData->massaction_table && is_int($key)))
continue;
if(HIKASHOP_J25){
$query = 'SELECT * FROM '.hikashop_table('usergroups',false);
}else{
$query = 'SELECT * FROM '.hikashop_table('core_acl_aro_groups',false);
}
$database->setQuery($query);
$groups = $database->loadObjectList();
if(HIKASHOP_J25){
$output ='<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_changeGroup_type" name="action['.$table->table.']['.$key.'][changeGroup][type]">';
$datas = array('add'=>'ADD', 'replace'=>'REPLACE');
foreach($datas as $k => $data){
$selected = '';
if($k == $value->data['type']) $selected = 'selected="selected"';
$output .='<option value="'.$k.'" '.$selected.'>'.JText::_($data).'</option>';
}
$output .='</select>';
}else{
$output = JText::_('REPLACE_BY').' ';
}
$output .= '<select class="chzn-done not-processed" id="action_'.$table->table.'_'.$key.'_changeGroup_value" name="action['.$table->table.']['.$key.'][changeGroup][value]">'; // categories
foreach($groups as $group){
$selected = '';
if($group->id == $value->data['value']) $selected = 'selected="selected"';
if(HIKASHOP_J25){
$output .='<option value="'.$group->id.'" '.$selected.'>'.JText::_($group->title).'</option>';
}else{
$output .='<option value="'.$group->id.'" '.$selected.'>'.JText::_($group->name).'</option>';
}
}
$output .= '</select>';
$actions_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output);
}
// ----------------------------
}else{
$actions_html['displayResults'] = '<div id="'.$table->table.'action__num__displayResults"></div>';
$actions_html['exportCsv'] = '<div id="'.$table->table.'action__num__exportCsv"></div>';
$actions_html['updateValues'] = '<div id="'.$table->table.'action__num__updateValues"></div>';
}
$js="
function checkAll(id, type){
var toCheck = document.getElementById(id).getElementsByTagName('input');
for (i = 0 ; i < toCheck.length ; i++) {
if (toCheck[i].type == 'checkbox') {
if(type == 'check'){
toCheck[i].checked = true;
}else{
toCheck[i].checked = false;
}
}
}
}";
if(!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration( "<!--\n".$js."\n//-->\n" );
}
This code should remove the error, we have to improve some functions which are currently needing too much resources.