Painstik, thanks for helping.
I think this is the complete code for updating a customer group:
in admin/includes/classes/class.customer.php find around line 2945
Code: Select all
/**
* _GetGroupList
* Get a list of groups and return them as an array
*
* @param Int $NumGroups A reference variable to hold the number of groups
* @return Array The list of groups
*/
private function _GetGroupList(&$NumGroups)
{
$groups = array();
$query = "SELECT * FROM [|PREFIX|]customer_groups ORDER BY groupname ASC";
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
$NumGroups = $GLOBALS["ISC_CLASS_DB"]->CountResult($result);
while($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
$groups[$row['customergroupid']] = $row;
}
return $groups;
}
/**
* _BuildGroupDropdown
* Build the select box to show a customer's group on the View Customers page
*
* @param Int $CustomerId The ID of the customer from the customers table
* @param Int $SelectedGroup The ID of the group that the customer belongs to
* @param String CustomerName The customer's name for the flashmessage when the group is changed
*
* @return String The select box's HTML
*/
private function _BuildGroupDropdown($CustomerId, $SelectedGroup, $CustomerName)
{
$output = sprintf("<select onchange='updateCustomerGroup(%d, this.options[this.selectedIndex].value, \"%s\", this.options[this.selectedIndex].text)' name='customergroup_%d' id='customergroup_%d'>",
$CustomerId, isc_html_escape($CustomerName), $CustomerId, $CustomerId);
$output .= sprintf("<option value='0'>%s</option>", GetLang("SelectCustomerGroup"));
$output .= $this->GetCustomerGroupsAsOptions($SelectedGroup);
$output .= "</select>";
return $output;
}
/**
* GetCustomerGroupsAsOptions
* Return a list of option tags containing name/values of customer groups
*
* @param Int $SelectedGroup The group to mark as selected in the option tags
*
* @return String The HTML <option> tags
*/
public function GetCustomerGroupsAsOptions($SelectedGroup=0)
{
$this->_customerGroups = &$this->_GetGroupList($numGroups);
$options = "";
foreach($this->_customerGroups as $group) {
if ($SelectedGroup == $group['customergroupid']) {
$sel = "selected='selected'";
}
else {
$sel = "";
}
$options .= sprintf("<option value='%d' %s>%s</option>", (int) $group['customergroupid'], $sel, isc_html_escape($group['groupname']));
}
}
return $options;
}
Found the code you posted and tried to implement it but no luck. I think it is something in the last line where it says "return options;" I think that's the part that updates the customer group and saves it. Maybe what Tony said has to go in one of the last lines??
Anyway I'm not that good in php and just good in reproducing
Any thoughts?