Post by none » Wed Sep 09, 2009 4:01 am

Hi!

I've got a problem. I would like to use the bbclone stat to OpenCart, but these don't work with each other. I've put this code before </head> but this doesn't work.

Code: Select all

<?php
define("_BBC_PAGE_NAME", "Main Site");
define("_BBCLONE_DIR", "http://www.mysite.com/stat/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
?>
In the layout.tpl.

Does know someone how is going to work?

Thanks!!

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am


Post by none » Fri Sep 11, 2009 5:32 pm

Any ideas? :(

Thanks

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am

Post by Qphoria » Fri Sep 11, 2009 7:50 pm

You are point a "DIR" to a url

Should be
define("_BBCLONE_DIR", "home/mysite/public_html/stat/");

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by none » Mon Sep 14, 2009 1:49 am

Hi!

Now its working! The mistake was the wrong file, not the wrong path.
If someone needs this stat, he has tp put that code in the main index.php, not in the layout.tpl!

But anyway I've another problem with this code. I can't see the dynamic page titles in my stat. How to export the dynamic titles into my stat.

I've tired follow things:

Code: Select all

define("_BBC_PAGE_NAME", $_GET["title"]);
define("_BBCLONE_DIR", "/home/content/p/o/w/powered/html/none/stat1/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (file_exists(COUNTER)) include_once(COUNTER);

Code: Select all

define("_BBC_PAGE_NAME", $_GET["$title"]);
define("_BBCLONE_DIR", "/home/content/p/o/w/powered/html/none/stat1/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (file_exists(COUNTER)) include_once(COUNTER);

Code: Select all

define("_BBC_PAGE_NAME", $_GET["n"]);

define("_BBCLONE_DIR", "/home/content/p/o/w/powered/html/none/stat1/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (file_exists(COUNTER)) include_once(COUNTER);

Code: Select all

define("_BBC_PAGE_NAME", "$title");
define("_BBCLONE_DIR", "/home/content/p/o/w/powered/html/none/stat1/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

Code: Select all

define("_BBC_PAGE_NAME", $title);
define("_BBCLONE_DIR", "/home/content/p/o/w/powered/html/none/stat1/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
Does enyone know how is gonna work with the dynamic titles?
Thanks!!

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am

Post by Qphoria » Mon Sep 14, 2009 1:55 am

well layout.tpl is the correct file.. it returns back to index.php anyway so there is no difference

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by none » Mon Sep 14, 2009 2:05 am

Yes it has difference! I spent lots of time with this, but the stat never worked! I've always got error messages from the stat! Like this:

Code: Select all

Warning: fclose(): supplied argument is not a valid stream resource in /home/content/p/o/w/o/html/none/stat1/lib/io.php on line 178


And that was in the line 178:

Code: Select all

foreach ($paths as $file) fclose(fopen($file, "wb"));
And the stat never worked! After I've put this code into the index.php, and voila... The error message disappeared and everythings is working! Except the dynamic title in the stat. Have you got any solution for the dynamic page title?

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am

Post by bandidko » Thu Dec 03, 2015 8:04 pm

Hi
I know this is old but I needed help last week. So this is for those after me. enjoy
this code will work not only for opencart:
you need to put it in index.php

Code: Select all

$myuri = $_SERVER['REQUEST_URI'];
define("_BBC_PAGE_NAME", "$myuri");
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
this one might not work with other than opencart. put in index.php

Code: Select all

define("_BBC_PAGE_NAME", "$title");
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

Newbie

Posts

Joined
Thu Dec 03, 2015 7:43 pm

Post by none » Fri Dec 04, 2015 12:24 am

Thanks for sharing... I'll give a try tomorrow.

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am

Post by TorontoEmporium » Mon Feb 15, 2016 8:01 am

I also wanted to use BBClone with Opencart, but could never seem to get it working so that it recorded the pages that were viewed. So I started coding on my development server and here is what I've come up with:

Code: Select all

$mark_title = "";
// Parse out the QUERY STRING into pieces
$qs = $_SERVER['QUERY_STRING'];
$qs1  = substr($qs,0,8);
$qs2  = substr($qs,8,strlen($qs));

$route_str = "_route_=";
$kill_str = "product/product/captcha";

if (strcasecmp($qs1, $route_str) != 0) {
	$mark_title = "INDEX"; 
} else { 
	if (strcasecmp($qs1, $kill_str) != 0) {
		$mark_title = $qs2;
	}
}

define("_BBC_PAGE_NAME", "$mark_title");
define("_BBCLONE_DIR", "/home/mydir/public_html/bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if ($mark_title != "INDEX") {
	if (is_readable(COUNTER)) { include_once(COUNTER);};
}
Edit your "index.php" file and insert the code near the top.

Important: Make sure that you have SEO turned ON in Store Settings!

This code will record pages viewed EXCEPT for the main INDEX page, and CAPTCHA requests.
You can record those as well if you want by changing the code.
I've tested this using Opencart version 1.5.6 and it works well.

I'm posting this mostly because I spent HOURS searching the net for something like this, and finally gave up and wrote this to work with the best shopping cart software available (IMHO).

It's my hope that this will help others struggling with integrating OC and BBClone.

Cheers!
Max @ Toronto Emporium


Posts

Joined
Sat Feb 22, 2014 8:28 am

Post by none » Sat Oct 15, 2016 3:01 am

Thanks for the updated code. I can confirm that it works with Opencart 2.3 as well.
Thanks

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am

Post by none » Sat Oct 15, 2016 3:44 am

Although I noticed one odd thing with your code. In bbclone stat the "From" referral field remains empty. Even when I get a visitor from google search the "From" field remains empty. With my other bbclone stat I can see is someone came from search engine.

New member

Posts

Joined
Wed Sep 09, 2009 3:53 am
Who is online

Users browsing this forum: No registered users and 53 guests