Mass Action error

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #178965

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.24
-- Browser(s) name and version -- : Firefox 33.0.3
-- Error-message(debug-mod must be tuned on) -- : Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /home/mohairbe/public_html/libraries/joomla/database/driver/mysql.php on line 421

Hi, When I try to set up a mass action I get a fatal error

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /home/mohairbe/public_html/libraries/joomla/database/driver/mysql.php on line 421

PHP file allows 264M so should be enough?

Any clues as to the problem

thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #178967

Hi,

I think that you have another limitation, else the limit will not be reached.
You can potentially reduce the number of things to process in the mass actions, and process them in many steps instead of in only one action.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #179100

Hi, The problem is as soon as I press NEW this happens so I cannot get to see anything to limit?

below is the code from mysql.php with the line s said to be at error but this looks ok to me?

419 protected function fetchObject($cursor = null, $class = 'stdClass')
420 {
421 return mysql_fetch_object($cursor ? $cursor : $this->cursor, $class);
422 }

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #179261

Hi,

Please edit the file "plugins/system/hikashopmassaction/hikashopmassaction.php" and replace the function "onMassactionTableActionsLoad()" by:

	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" );
	}

I guess that you have a lot of products with variants in your shop, right ?
This code should remove the error, we have to improve some functions which are currently needing too much resources.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #179390

Hi Xavier,

Sorry this did not work, and yes you are quite right I have 1,000's of products many of them with variations.

rgds

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #179395

Hi,

Please provide a backend and a FTP access in order to debug that directly on your website.
You can send the informations via private message or via our contact form, don't forget to give the url of that topic in the message.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #179934

Hi,

You missed to give us a FTP access ;)
Without this access, I am unfortunately not able to debug your issue.

Before that, could you just try to increase the allowed memory size to 128Mo for example ?

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #179938

Hi, The required info has been sent twice via PM

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #179947

You mean via the contact form, right ?

We have informations to access your backend, but I don't see FTP access or at least a ftp explorer extension installed.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #179981

Sent with header 'FTP access'
thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #180002

Hi,

There is still the "Allowed memory size" error even if I remove the function which are requiring a lot of memory.
So you definitively have to increase the memory size allocation on your server.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #180420

Hi, Finally got this to work but I am having problems with the queries?

1. I need to produce financials from the orders section, when doing this if I select the 'order_created' it prevents any selection following this from being displayed and also only displays a day and not a date.
2. When selecting 'additional information' the data in that field does not stay in1 column after delimiting in excel but puts the data over numerous cells and rows screwing the data.
3. I have made a query to change 'order status' this did change what I needed ok but left error messages as below.



4. How do I get it to show the VAT charged on the products? show the VAT charged on the shipping? the VAT on products seem to be in a box with a lot of other data (tax related) and not just a total.

thanks in advance

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #180523

Hi,

1. Sorry but I don't really understand what you mean. Could you give more details, example, screenshot ?

2. Which additional informations are you selecting ? Are you sure that the data is not over because of the settings of your excel settings ? if you fill any informations in the next row, isn't the previous one reduced to one cell ?

3. This is not a big issue, just a warning, thanks for the report we will correct it for the next release. It doesn't affect the export.

4. It export indeed the product price, shipping price without tax, but you can select the product tax and shipping tax to see these informations too. To have the price displayed with VAT it will require some modifications of the code.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #180609

Hiya,

Thanks for the reply.

1. I think this is created by and error when exporting to CSV from ass actions, the order_date splits into 2 columns before it's delimited in excel? CSV file added

File Attachment:

File Name: hikashop_export1.csv
File Size:64 KB


2. that error comes from using the 'export' function in 'orders' see CSV

File Attachment:

File Name: hikashop_export-1.csv
File Size:98 KB


3. thanks
4. Shipping tax display ok but product tax contains a lot of irrelevant figures instead of just a total like the shipping tax... order_tax_info gives this
"a:1:{s:3:"VAT";O:8:"stdClass":4:{s:11:"tax_namekey";s:3:"VAT";s:8:"tax_rate";s:7:"0.20000";s:10:"tax_amount";d:3.826000000000000067501559897209517657756805419921875;s:23:"tax_amount_for_shipping";d:1.124000000000000110134124042815528810024261474609375;}}"

and by selecting order_product_tax it give the individual amounts instead of a total for the order? am I missing something here?

thanks

Attachments:
Last edit: 9 years 4 months ago by mohairbears. Reason: file wont attach?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #180611

Hi,

1. There is indeed extra double quotes added to the date, and that's broking the csv file.

2. Same problem, too much double quotes in the content.

4. The tax should just be displayed as a price, not the full serialize content.

For all of these issues, I was not able to reproduce them on my local. The export is fine.
Please update to the latest version of HikaShop.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #180726

I have the latest version

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #180886

Hi,

I just tried a massaction from your website, the export order one and everything is exported correctly.
The dates are correct, taxes too, no broken rows, could you tell what you have changed ?
It could help other customers.

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #180892

It still will not work when I export as a CSV? see below it splits into 2 columns then it will not delimit correctly I am using " to delimit, if I omit the date it delimits ok.

File Attachment:

File Name: hikashop_export-3.csv
File Size:0 KB


It's the 'financials' report that I am using to get out the costs for the sales to enter in to Sage.

thanks

I can sort of get what I need by exporting to XLS so ok at present, what I would like to see is a 'total' for VAT products like the shipping VAT total shows if possible.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #180912

I just tried the "Financials" one, export as XLS and as CSV and the content it correct.

What do you mean by " I am using " to delimit" ? Where are you using this value ?

For the VAT, you want a column with just the VAT price of the products for each orders ?
So not the order_full_price ?

Please Log in or Create an account to join the conversation.

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
9 years 4 months ago #180948

Hi, If I open the exported CSV in excel and use 'text to columns' to place the data in individual columns, this works fine if order_date is not selected, if selected then it does not work, maybe you can advise how to open the CSV so it shows what you are seeing to be ok?

Should a CSV file not be in 1 column and not 2 like this export?

Yes a column with the total VAT for all products and not individually, or even to show the total VAT like on the invoice, the shipping VAT is already there to select so I can just minus this out, hope this makes sense to you?

thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.134 seconds
Powered by Kunena Forum