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.
Anyone fancy replicating this V6 mod for V7:
https://forum.kryptronic.com/viewtopic.php?id=19121
Basically it only allowed products links to be displayed in the Recently Visited Pages widget. The code is totally different in V7.
Rob
Offline
Thanks John - Found it now.
Offline
You can't beleive how stunned I was to see this post as I have spent the last day or so trying to do this very thing. As I have not got any real hard core experience with OOPHP I had got a way to make this work with a bit of a hack in the includes but it had a lot of limitations so when I seen this, this morning I was gobsmacked! I was struggling to track down where the array used was being formed in the core files. First off thanks so much for the post.
I hope it helps anyone else wanting to do the same, as I had to adapt the script to the new ECPv7 and wanted to leave as much of the existing code(v7) in place as possible as I assume there are good reasons things are done as they are and so made the following changes.
1) Back up skinwidgets.php first in case it all goes horribly wrong.
2) Locate function recent at line 224
3) Remove all the code between lines 228 and 287
4) Replace with the following code block: This is the code from post https://forum.kryptronic.com/viewtopic.php?id=19121 modified to reflect changes in database and core structure and to incorporate what to me looks like lines that were probably not there in CCP6.
function recent () { // +-- // | This function prints the frontend recent pages menu. // +-- // +-- // | Get component information in an array for all apps. This is // | done to make sure we eliminate any inactive apps in our menu. // +-- $app_all_cache = $this->globals('core.app_all_cache'); $where = ""; if (!(empty($app_all_cache))) { foreach ($app_all_cache as $appid => $appdata) { $where .= "app=" . $this->CORE_DB->quote($appdata['id']) . " OR "; } // End of foreach statement. } // End of if statement. if (preg_match('/ OR $/',$where)) {$where = rtrim($where, ' OR ');} ///// webmaster spadedlady added DISTINCT to sql call below, added //// sql call line for namespace, and increased count to 8 from 5. $sql = "SELECT DISTINCT app, namespace, reference, dispname FROM core_stats WHERE"; $sql .= " interface=" . $this->CORE_DB->quote('FrontEnd'); $sql .= " AND namespace=" . $this->CORE_DB->quote('prodshow'); $sql .= " AND sessionid=" . $this->CORE_DB->quote($this->globals('core_session.sid')); $sql .= " AND disprecback=" . $this->CORE_DB->quote(1); if (!(empty($where))) {$sql .= " AND (" . $where . ")";} else {$sql .= " AND app=" . $this->CORE_DB->quote();} $result = $this->CORE_DB->sql_do(array('sql' => $sql, 'table' => 'core_stats', 'order' => array('time' => 'DESC'), 'count' => 5, 'offset' => 0)); ///// webmaster spadedlady added DISTINCT to sql call above, added //// sql call line for namespace, and increased count to 8 from 5. if ($this->IsError($result)) {return 1;} if (empty($result)) {return 1;} // +-- // | Build the menu array. // +-- $menu_array = array(); foreach ($result as $num => $row) { $params = array(); if (!(empty($row['reference']))) {$params = array('ref' => $row['reference']);} $menu_array[] = array('text' => $row['dispname'], 'app' => $row['app'], 'namespace' => $row['namespace'], 'params' => $params); } // End of foreach statement.
If I have screwed up here or made some glaring error let me know. Perhaps there is a better way to add this code without removing the original code. I notice the function was previously defined as femenurecent- I would suspect to use this you would need to adapt the widget itself, the skin and the includes- which seems like more changes with potential to cause issues - my client did not want to use the recent pages in its original form at all so it suits me to make this a fixed change in direct substitution for th eold recent function.
Thanks once again for the original code and post. Very much appreciated.
K
Offline