This contrib adds a new menu controller to allow ignoring a particular IP address from affecting statistics.
Useful for testing your site without being picked up as a customer. Currently, the only place this exists is
the “Products Viewed” report, but it is easily modified to include future statistics.
DOWNLOAD
DEMO (user:demo/pass:demo)
To test the demo:
1. Enter your IP in the Admin IP.
2. View the Reports->Products Viewed report and take count of a product.
3. Visit that product on the front end.
4. Verify the Product Viewed count did NOT increase.
5. Change the Admin IP to something else.
6. Visit the product again.
7. Verify it the viewed count DID increase.
Enjoy
Q!
Useful for testing your site without being picked up as a customer. Currently, the only place this exists is
the “Products Viewed” report, but it is easily modified to include future statistics.
DOWNLOAD
DEMO (user:demo/pass:demo)
To test the demo:
1. Enter your IP in the Admin IP.
2. View the Reports->Products Viewed report and take count of a product.
3. Visit that product on the front end.
4. Verify the Product Viewed count did NOT increase.
5. Change the Admin IP to something else.
6. Visit the product again.
7. Verify it the viewed count DID increase.
Enjoy
Q!
Last edited by Qphoria on Wed Sep 10, 2008 3:43 am, edited 1 time in total.
Nice job!
I had it working for a little while and then I ended up having to wipe the whole cart system out and restart from scratch. When I
tried to re-install it, my menu on the top goes away. Can't figure out why. I think it has something to do with the
'./admin/template/default/module/menu.tpl' file.
This is what my code looks like after I add the change from the original. And this is where my error ends up at.
This is what I have to do in order to have my menu come back after it disappears.
Any suggestions of what I may be doing wrong?
I had it working for a little while and then I ended up having to wipe the whole cart system out and restart from scratch. When I
tried to re-install it, my menu on the top goes away. Can't figure out why. I think it has something to do with the
'./admin/template/default/module/menu.tpl' file.
This is what my code looks like after I add the change from the original. And this is where my error ends up at.
Code: Select all
['', '', '', null, null],
// Ignore Admin IP - Edited: geek@simplygeek.net
['', 'Admin IP', '../admin/index.php?controller=admin_ip’, null, null],
// End of Edit
['', '', '', null, null],
['', '', '', null, null]
Code: Select all
['', '', '', null, null],
// Ignore Admin IP - Edited: geek@simplygeek.net
//['', 'Admin IP', '../admin/index.php?controller=admin_ip’, null, null],
// End of Edit
['', '', '', null, null],
['', '', '', null, null]
Honestly, we can't get rid of this file-based menu fast enough!
The string looks ok, but I wonder if it doesn't like you adding the //comments before and after it.
Soon we will have an db-based admin menu (like this) to replace the file-based one and never have these problems again!
The string looks ok, but I wonder if it doesn't like you adding the //comments before and after it.
Soon we will have an db-based admin menu (like this) to replace the file-based one and never have these problems again!
Last edited by Qphoria on Sat Aug 23, 2008 4:47 am, edited 1 time in total.
I tried removing the //comments out before I posted and still nothing. I can still make it work by adding '../admin/index.php?controller=admin_ip' on toQphoria wrote: Honestly, we can't get rid of this file-based menu fast enough!
The string looks ok, but I wonder if it doesn't like you adding the //comments before and after it.
Soon we will have an db-based admin menu (like this) to replace the file-based one and never have these problems again!
the end of my URL and it seems to work fine. I just don't have a direct menu access to it. Oh well, I am sure that we will get it all fixed and straightened
out.
Edit:
I figured out what my problem was now.
Just a note for everyone that wants to use this mod at all, my mistake was that there must have been an extra carriage return (CR) somewhere in the code. The extra CR came from me just "copy, cut, and paste" from the PDF instruction file. I went and I manually edited the '../admin/template/default/module/menu.tpl' file instead of copy and paste and then my problem was fixed. I suggest you edit that file manually and not with your mouse.
Last edited by Anonymous on Sat Aug 23, 2008 12:52 pm, edited 1 time in total.
Haha! I am learning and picking up PHP and the OpenCart system, slowly but surely.Qphoria wrote: good catch!
Actually, I have never been so proud of myself before tonight. Ha!
And I almost got a store up and fully functional just the way I need it to be setup as well.
Sorry, just had to gloat for a second there. Okay, now back on track...
I've found similar sorts of problems with "cut & paste" of coding, with extra lines of space being added. This is primarily due to Windows using a carriage return AND a line feed, while Linux and Mac just use a carriage return. Text editors in Windows still behave like typewriters!
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool
If you're not living on the edge ... you're taking up too much space!
I have created a little mod as an extension to Qphoria's Ignore Admin IP @ Products Viewed Report.
So, this mod ignores admin IP @ People Online Report (as I know when I am online) and is based on the previous mod.
Only 2 extra files have to be modified (please backup them before make changes):
/admin/controller/home.php:
and /admin/controller/report_online.php:
This is not the most beautiful solution but it works (hopefully).
Bye
Frame
So, this mod ignores admin IP @ People Online Report (as I know when I am online) and is based on the previous mod.
Only 2 extra files have to be modified (please backup them before make changes):
/admin/controller/home.php:
Code: Select all
.
.
function index() {
$response =& $this->locator->get('response');
$database =& $this->locator->get('database');
$url =& $this->locator->get('url');
//Added by Frame
$config =& $this->locator->get('config');
//EOF
$language =& $this->locator->get('language');
$template =& $this->locator->get('template');
$customer =& $this->locator->get('customer');
$currency =& $this->locator->get('currency');
$module =& $this->locator->get('module');
.
.
.
.
$view->set('online', $url->ssl('report_online'));
//Added by Frame
if ($_SERVER['REMOTE_ADDR'] == $config->get('config_admin_ip')) {
if ($config->get('config_admin_ip_status') == "0") {
$user_info = $database->getRow("select count(*) as total from session");
} else {
$user_info = $database->getRow("select count(*) as total from session where ip <> '".$config->get('config_admin_ip')."'");}
} else {
$user_info = $database->getRow("select count(*) as total from session");
}
//EOF
$view->set('users', $user_info['total']);
Code: Select all
.
.
function index() {
$database =& $this->locator->get('database');
$language =& $this->locator->get('language');
//Added by Frame
$config =& $this->locator->get('config');
//EOF
$response =& $this->locator->get('response');
$template =& $this->locator->get('template');
$module =& $this->locator->get('module');
.
.
foreach ($results as $result) {
$value = array();
$a = preg_split("/(\w+)\|/", $result['value'], - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0; $i < count($a); $i = $i + 2) {
$value[$a[$i]] = unserialize($a[$i + 1]);
}
//Added by Frame
if ($_SERVER['REMOTE_ADDR'] == $config->get('config_admin_ip')) {
if ($config->get('config_admin_ip_status') == "0") {
if (isset($value['user_id'])) {
$user_info = $database->getRow("select username from user where user_id = '" . (int)$value['user_id'] . "'");
$name = $language->get('text_admin', $user_info['username']);
} elseif (isset($value['customer_id'])) {
$customer_info = $database->getRow("select concat(firstname,' ',lastname) as name from customer where customer_id = '" . (int)$value['customer_id'] . "'");
$name = $customer_info['name'];
} else {
$name = $language->get('text_guest');
}
$rows[] = array(
'name' => $name,
'time' => date('dS F Y h:i:s A', strtotime($result['time'])),
'ip' => $result['ip'],
'url' => $result['url'],
'total' => (isset($value['products']) ? count($value['products']) : 0)
);
} else {
if (isset($value['user_id'])) {
$user_info = $database->getRow("select username from user where user_id = '" . (int)$value['user_id'] . "'");
$name = $language->get('text_admin', $user_info['username']);
}elseif (isset($value['customer_id'])) {
$customer_info = $database->getRow("select concat(firstname,' ',lastname) as name from customer where customer_id = '" . (int)$value['customer_id'] . "'");
$name = $customer_info['name'];
} else {
$name = $language->get('text_guest');
}
if ($_SERVER['REMOTE_ADDR'] <> $result['ip']) {
$rows[] = array(
'name' => $name,
'time' => date('dS F Y h:i:s A', strtotime($result['time'])),
'ip' => $result['ip'],
'url' => $result['url'],
'total' => (isset($value['products']) ? count($value['products']) : 0)
);}
}
} else {
if (isset($value['user_id'])) {
$user_info = $database->getRow("select username from user where user_id = '" . (int)$value['user_id'] . "'");
$name = $language->get('text_admin', $user_info['username']);
} elseif (isset($value['customer_id'])) {
$customer_info = $database->getRow("select concat(firstname,' ',lastname) as name from customer where customer_id = '" . (int)$value['customer_id'] . "'");
$name = $customer_info['name'];
} else {
$name = $language->get('text_guest');
}
$rows[] = array(
'name' => $name,
'time' => date('dS F Y h:i:s A', strtotime($result['time'])),
'ip' => $result['ip'],
'url' => $result['url'],
'total' => (isset($value['products']) ? count($value['products']) : 0)
);
}
//EOF
}
$view = $this->locator->create('template');
Bye
Frame
Last edited by frame on Tue Oct 07, 2008 2:43 pm, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 9 guests