You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
have found the code below , which appears to select the user type can this be modified to show only wholesale products i.e. "L " visibility if the wholesaler has logged in ?
can anyone tell me what each line does ?
// +-- // | Handle visibility. // +-- $usergroup = $this->globals('core_user.usergroup'); if (empty($usergroup)) { if (!(empty($where))) {$where .= 'AND ';} $where .= '(prodview=' . $this->CORE_DB->quote('A') . ') '; } else { if (!(empty($where))) {$where .= 'AND ';} $where .= '((prodview=' . $this->CORE_DB->quote('A') . ') OR '; $where .= '(prodview=' . $this->CORE_DB->quote('L') . ' AND '; $where .= '(prodviewg LIKE ' . $this->CORE_DB->quote_like($usergroup . ',', 'SUFFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg=' . $this->CORE_DB->quote($usergroup) . ')))'; } // End of if statement.
does this code test for the user group , or could an if statement be placed in this code to determine which usergroup logged in to display relavent product, also is it this peice of code which locks out non wholesale users from seeing wholesale products ?
also found this code in the same file which seems to also have something to do with it, could an elseif statement go in this part to elminate the all products "A" displaying if usr group is equal to "L"
e
// +-- // | Handle visibility. // +-- $view_product = 1; if ($product['prodview'] == 'N') { $view_product = 0; } elseif (($product['prodview'] == 'L') && (!($this->globals('core_user.usergroup')))) { $view_product = 0; } elseif ($product['prodview'] == 'L') { $group_found = 0; $group_list = $this->make_list($product['prodviewg']); foreach ($group_list as $num => $group) { if ($group == $this->globals('core_user.usergroup')) {$group_found = 1;} } // End of foreach statement. if (empty($group_found)) {$view_product = 0;} } // End of if statement.
Offline
// +-- // | Handle visibility. // +-- $usergroup = $this->globals('core_user.usergroup'); if (empty($usergroup)) { if (!(empty($where))) {$where .= 'AND ';} $where .= '(prodview=' . $this->CORE_DB->quote('A') . ') '; } else if ($usergroup == 'wholesale') { if (!(empty($where))) {$where .= 'AND ';} $where .= '(prodview=' . $this->CORE_DB->quote('L') . ' AND '; $where .= '(prodviewg LIKE ' . $this->CORE_DB->quote_like($usergroup . ',', 'SUFFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg=' . $this->CORE_DB->quote($usergroup) . '))'; } else { if (!(empty($where))) {$where .= 'AND ';} $where .= '((prodview=' . $this->CORE_DB->quote('A') . ') OR '; $where .= '(prodview=' . $this->CORE_DB->quote('L') . ' AND '; $where .= '(prodviewg LIKE ' . $this->CORE_DB->quote_like($usergroup . ',', 'SUFFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup, 'PREFIX') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(',' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg LIKE ' . $this->CORE_DB->quote_like(', ' . $usergroup . ',', 'WRAP') . ' OR '; $where .= 'prodviewg=' . $this->CORE_DB->quote($usergroup) . ')))'; } // End of if statement.
John
Offline
nice to know i had found the right areas to mod, i did try a couple of ideas that did'nt work ,
works a treat and so simple to an expert , easy to see why you are part of beta team
thanks John
Offline