Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

abra123cadabra

Archived
  • Posts

    837
  • Joined

  • Last visited

Profile Information

abra123cadabra's Achievements

  1. First of all, thank you very much for this highly sophisticated order editing tool. I installed version 5.0.6 today. Now I'm checking that it works as it should but it does something with the sort order of the order total modules which I don't like. I had a look at the edit_orders_ajax.php but honestly, I don't want to mess it up so I better ask how I can change the sort order. The original orders have the following order: ot_subtotal 1 ot_shipping 3 ot_total 25 ot_netto 30 ot_tax 35 I want to display ot_netto and ot_tax at the end as ot_subtotal, ot_shipping and ot_total are all including tax. After making changes to the order with order editor, the new sort order is as follows: ot_subtotal 1 ot_tax 2 ot_shipping 3 ot_total 4 ot_netto 5 The calculation seems to be correct at first glance but how do I move the ot_tax to be listed after ot_netto? Thanks in advance. abra
  2. Guest

    Wow, please let us know how they got into your site...I am so sorry too - I don't understand people.

  3. Ok, this was the long workaround... I finally figured out why it didn't recognise the value set for $spider_flag... In /catalog/includes/functions/leapfrog.php (line 34) add $spider_flag to the list of globals so that it looks like this: function lf_update_tracking() { global $customer_id, $languages_id, $HTTP_GET_VARS, $HTTP_SERVER_VARS, $spider_flag; Like this you don't need to find and replace any other text as mentioned in my previous post. And the setting to not display bots at all should work now too. They will not be added to the database as they are filtered out first. abra
  4. For the situation when you want to show all guests and bots, here is a fix to the problem that even bots were shown as guests. In /catalog/includes/functions/leapfrog.php (lines 51 to 84) find: } else { // No they don't $wo_customer_id = ''; // Is the visitor a bot? If so, show it's name. // The $spider_flag variable is set in application_top.php. if ($spider_flag == true) { // It's a bot. Extract the bots name $wo_full_name = '[bot] '; $user_agent = getenv('HTTP_USER_AGENT'); if (tep_not_null($user_agent)) { // Bot string is of form - "Mozilla/5.0 (compatible; Yahoo! Slurp; [url="http://help.yahoo.com/help/us/ysearch/slurp%29%22"]http://help.yahoo.com/help/us/ysearch/slurp)"[/url] $needle = '(compatible;'; $bot_name_start_pos = strpos($user_agent, $needle); $bot_name = substr($user_agent, $bot_name_start_pos+strlen($needle)); $bot_name_end_pos = strpos($bot_name, ';'); $bot_name = substr($bot_name, 0, $bot_name_end_pos); $wo_full_name .= tep_db_input(tep_db_prepare_input($bot_name)); } else { $wo_full_name .= 'Unknown spider'; } } else { // This is just a regular guest. $wo_full_name = 'Guest'; } } and replace with: } else { // No they don't $wo_customer_id = ''; // Is the visitor a bot? If so, show it's name. // Check user agent string against spiders.txt. $user_agent = strtolower(getenv('HTTP_USER_AGENT')); $spider = false; if (tep_not_null($user_agent)) { $spiders = file(DIR_WS_INCLUDES . 'spiders.txt'); for ($i=0, $n=sizeof($spiders); $i<$n; $i++) { if (tep_not_null($spiders[$i])) { if (is_integer(strpos($user_agent, trim($spiders[$i])))) { $spider = true; break; } } } } if ($spider){ // It's a bot. Extract the bots name $wo_full_name = '[bot] '; // Bot string is of form - "Mozilla/5.0 (compatible; Yahoo! Slurp; [url="http://help.yahoo.com/help/us/ysearch/slurp%29%22"]http://help.yahoo.com/help/us/ysearch/slurp)"[/url] $needle = '(compatible;'; $bot_name_start_pos = strpos($user_agent, $needle); $bot_name = substr($user_agent, $bot_name_start_pos+strlen($needle)); $bot_name_end_pos = strpos($bot_name, ';'); $bot_name = substr($bot_name, 0, $bot_name_end_pos); if ($bot_name == '') { // Bot string is of form - "msnbot/1.0 ( [url="http://search.msn.com/msnbot.htm%29%22"]http://search.msn.com/msnbot.htm)"[/url] $bot_name_end_pos = strpos($user_agent, '('); $bot_name = substr($user_agent, 0, $bot_name_end_pos); } else { // Bot string is of different form if ($bot_name == ''){ $bot_name = $user_agent; } } $wo_full_name .= tep_db_input(tep_db_prepare_input($bot_name)); } else { // This is just a regular guest. $wo_full_name = 'Guest'; } $wo_full_name .= ' - #'; // just a cosmetic change } abra
  5. I've got the same issue with bots being displayed as guests. It seems that $spider_flag is always false when accessed in /catalog/includes/functions/leapfrog.php. I tried to add another variable to application_top and set it to true or false depending on the value of $spider_flag. Then I used this in leapfrog but it still doesn't work. So my guess is that for some reason $spider_flag cannot be used to check if it's a bot or not. Strangely enough the original purpose of assigning a session id or not is working fine. Maybe $spider_flag is reset later? abra
  6. Based on v_1.8A i replaced the following code in /catalog/admin/includes/functions/seo_assistant.php (lines 11 - 115): define('GMAG', 0xE6359A60); function xor32($a, $B) { return int32($a) ^ int32($B); } //return least significant 32 bits //works by telling unserialize to create an integer even though we provide a double value function int32($x) { return unserialize("i:$x;"); } function mix($a,$b,$c) { $a -= $b; $a -= $c; $a = xor32($a,zeroFill($c,13)); $b -= $c; $b -= $a; $b = xor32($b,$a<<8); $c -= $a; $c -= $b; $c = xor32($c,zeroFill($b,13)); $a -= $b; $a -= $c; $a = xor32($a,zeroFill($c,12)); $b -= $c; $b -= $a; $b = xor32($b,$a<<16); $c -= $a; $c -= $b; $c = xor32($c,zeroFill($b,5)); $a -= $b; $a -= $c; $a = xor32($a,zeroFill($c,3)); $b -= $c; $b -= $a; $b = xor32($b,$a<<10); $c -= $a; $c -= $b; $c = xor32($c,zeroFill($b,15)); return array($a,$b,$c); } //unsigned shift right function zeroFill($a, $B) { $z = hexdec(80000000); if ($z & $a) { $a = ($a>>1); $a &= (~$z); $a |= 0x40000000; $a = ($a>>($b-1)); } else { $a = ($a>>$B); } return $a; } function GCH($url, $length=null, $init=GMAG) { if(is_null($length)) { $length = sizeof($url); } $a = $b = 0x9E3779B9; $c = $init; $k = 0; $len = $length; while($len >= 12) { $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24)); $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24)); $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24)); $mix = mix($a,$b,$c); $a = $mix[0]; $b = $mix[1]; $c = $mix[2]; $k += 12; $len -= 12; } $c += $length; switch($len) /* all the case statements fall through */ { case 11: $c+=($url[$k+10]<<24); case 10: $c+=($url[$k+9]<<16); case 9 : $c+=($url[$k+8]<<8); /* the first byte of c is reserved for the length */ case 8 : $b+=($url[$k+7]<<24); case 7 : $b+=($url[$k+6]<<16); case 6 : $b+=($url[$k+5]<<8); case 5 : $b+=($url[$k+4]); case 4 : $a+=($url[$k+3]<<24); case 3 : $a+=($url[$k+2]<<16); case 2 : $a+=($url[$k+1]<<8); case 1 : $a+=($url[$k+0]); /* case 0: nothing left to add */ } $mix = mix($a,$b,$c); /*-------------------------------------------- report the result */ return $mix[2]; } //converts a string into an array of integers containing the numeric value of the char function strord($string) { for($i=0;$i<strlen($string);$i++) { $result[$i] = ord($string{$i}); } return $result; } function CheckSum($_url) { $chksum = "6" . GCH(strord('info:'.$_url)); return $chksum; } function getPR($_url) { $url = 'info:'.$_url; // $ch = "6" . GCH(strord($url)); $ch = CheckSum($_url); $url='info:'.urlencode($_url); $pr = file("http://www.google.com/search?client=navclient-auto&ch=$ch&ie=UTF-8&oe=UTF-8&features=Rank&q=$url"); $pr_str = implode("", $pr); return substr($pr_str,strrpos($pr_str, ":")+1); } with this: //PageRank Lookup v1.1 by HM2K (update: 31/01/07) //based on an alogorithm found here: [url="http://pagerank.gamesaga.net/"]http://pagerank.gamesaga.net/[/url] //settings - host and user agent $googlehost='toolbarqueries.google.com'; $googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5'; //convert a string to a 32-bit integer function StrToNum($Str, $Check, $Magic) { $Int32Unit = 4294967296; // 2^32 $length = strlen($Str); for ($i = 0; $i < $length; $i++) { $Check *= $Magic; //If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31), // the result of converting to integer is undefined // refer to [url="http://www.php.net/manual/en/language.types.integer.php"]http://www.php.net/manual/en/language.types.integer.php[/url] if ($Check >= $Int32Unit) { $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit)); //if the check less than -2^31 $Check = ($Check < -2147483648) ? ($Check + $Int32Unit) : $Check; } $Check += ord($Str{$i}); } return $Check; } //genearate a hash for a url function HashURL($String) { $Check1 = StrToNum($String, 0x1505, 0x21); $Check2 = StrToNum($String, 0, 0x1003F); $Check1 >>= 2; $Check1 = (($Check1 >> 4) & 0x3FFFFC0 ) | ($Check1 & 0x3F); $Check1 = (($Check1 >> 4) & 0x3FFC00 ) | ($Check1 & 0x3FF); $Check1 = (($Check1 >> 4) & 0x3C000 ) | ($Check1 & 0x3FFF); $T1 = (((($Check1 & 0x3C0) << 4) | ($Check1 & 0x3C)) <<2 ) | ($Check2 & 0xF0F ); $T2 = (((($Check1 & 0xFFFFC000) << 4) | ($Check1 & 0x3C00)) << 0xA) | ($Check2 & 0xF0F0000 ); return ($T1 | $T2); } //genearate a checksum for the hash string function CheckHash($Hashnum) { $CheckByte = 0; $Flag = 0; $HashStr = sprintf('%u', $Hashnum) ; $length = strlen($HashStr); for ($i = $length - 1; $i >= 0; $i --) { $Re = $HashStr{$i}; if (1 === ($Flag % 2)) { $Re += $Re; $Re = (int)($Re / 10) + ($Re % 10); } $CheckByte += $Re; $Flag ++; } $CheckByte %= 10; if (0 !== $CheckByte) { $CheckByte = 10 - $CheckByte; if (1 === ($Flag % 2) ) { if (1 === ($CheckByte % 2)) { $CheckByte += 9; } $CheckByte >>= 1; } } return '7'.$CheckByte.$HashStr; } //return the pagerank checksum hash function getch($url) { return CheckHash(HashURL($url)); } //return the pagerank figure function getpPR($url) { global $googlehost,$googleua; $ch = getch($url); $fp = fsockopen($googlehost, 80, $errno, $errstr, 30); if ($fp) { $out = "GET /search?client=navclient-auto&ch=$ch&features=Rank&q=info:$url HTTP/1.1\r\n"; //echo "<pre>$out</pre>\n"; //debug only $out .= "User-Agent: $googleua\r\n"; $out .= "Host: $googlehost\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); //$pagerank = substr(fgets($fp, 128), 4); //debug only //echo $pagerank; //debug only while (!feof($fp)) { $data = fgets($fp, 128); //echo $data; $pos = strpos($data, "Rank_"); if($pos === false){} else{ $pr=substr($data, $pos + 9); $pr=trim($pr); $pr=str_replace("\n",'',$pr); return $pr; } } //else { echo "$errstr ($errno)<br />\n"; } //debug only fclose($fp); } } // end new code for PR This works fine in my shop. The only thing I didn't fix is the output of checksum in /catalog/admin/seo_assistant.php as modified in v_1.8A. abra
  7. No, that didn't work either. I found some other code and pasted that in. Now it works fine for me. abra
  8. I've updated my SEO assistant version and everything is working as it should apart from the googlerank function. As a lot of people seem to have problems with this, getting the 403 error from google, I thought I just let you know what I found out about this. The problem is not with the webhost as such. It has nothing to do with allow_url_fopen and no workaround with curl is needed. The error comes from google as a result of a wrong parameter (ch). There are quite a few algorithms out there to calculate the checksum from any given url but it seems that the result depends on how the server in combination with the php version installed handles different data types. I couldn't find a working algorithm for my hosts system but I found a working checksum for my shop so I just hardcoded that in. As a result I cannot get any other page ranks. I hope that helps to clear up the confusion why the pagerank works on some systems while it doesn't work on others. abra
  9. In catalog/includes/functions/leapfrog.php, replace lines 96 to 102 with the code above to show page number etc. abra
  10. Well, I thought that too. Some things are much easier to do than one might think! These modifications usually add just a little text to the right of page title where the title is pretty short anyway. So no space problem there. Only with the search keywords, that can get out of hand. People are typing in funny things... I like the idea of having more info on a visitor opening in a separate box. abra
  11. Thanks for clarifying the page count. I guessed that already. As soon as the visitor logs in, the session changes but he keeps that session if he logs out again. Ah well, don't mind. As my shop is not too busy right now and I'm a very curious observer, I added just a few more info to the page title. This is to get info if the visitor is clicking through a product listing as generated on a lot of pages (index.php for products in a category or for a manufacturer, advanced search results, what's new listing etc.). I also wanted to see which keywords they used when using the search function. I'm using other contribs too like allproducts listing (allprods.php). Here is the code that I added to /catalog/includes/functions/leapfrog.php. Just find the first lines of the snippet and add the if statements following. If you have other pages in your shop where variables are passed via the URL, you can easily extend the mod to show even more info. } else { // Just use the page title $page_desc = tep_db_input(HEADING_TITLE); $page_thumb = ""; } // The following modifications allow for more tracking info to be displayed // Add keywords if advanced search is used if(isset($HTTP_GET_VARS['keywords']) && $HTTP_GET_VARS['keywords'] != ''){ $page_desc = $page_desc . ' (' . stripslashes($HTTP_GET_VARS['keywords']) . ')'; } // Add character selected if allproducts contrib is used if(isset($HTTP_GET_VARS['fl']) && $HTTP_GET_VARS['fl'] != ''){ $page_desc = $page_desc . ' (' . stripslashes($HTTP_GET_VARS['fl']) . ')'; } // Add page number viewed when clicking through a listing if(isset($HTTP_GET_VARS['page']) && $HTTP_GET_VARS['page'] != ''){ $page_desc = $page_desc . ' (page ' . stripslashes($HTTP_GET_VARS['page']) . ')'; } Come to think about this, there is no need to add the landing page in the leapfrog any more as my ads pass a variable in the URL too. I'll just add this in for my own entertainment. abra
  12. I didn't dig into the code to see how exactly it is determined that the click belongs to a certain visitor. There is a number before the page title (obviously that's the number of pages loaded for this visitor) but the click number is lower. When does the click number increase? Same goes for the time left of the clicks number. A feature I would like to see is an addition to "Guest". If they were logged in before but are logged out, show the customer name in brackets like this: Guest (Customer Name). Another feature you already mentioned is some stats like: visitor has added something to cart (yes/no) and maybe the cart value. How about adding the landing url in addition to the referal url. Hits from my ads carry some variables in the url that allow me to see which ad they clicked on. It would be nice to see like this if the visitor was referred by organic or paid search results. I know, most of these features are part of the supertracker contribution which I'm using but I really like the dynamic element about leapfrog. abra
  13. The language: The page titles are in the respective language for pages like shipping.php etc. But my products have the same title (German product name) with a translation in the product description as my customers are more likely to look for the German name than for any kind of translation ("Käsekuchenhilfe" instead of "cheese cake help"). So for these pages I definitely need the page language. About opening a new page... this is what I'm doing right now. I just have to remember not to use the left column to navigate to other parts when on the leapfrog page. It'll do for now. You are right, I liked the dark page. The manufacturer code. Looks like I put that in myself. o:) My shop is heavily modified with the standard categories/manufacturers boxes replaced by dropdown lists (avsearch contrib). The results of the selection are displayed using the index.php (as usual). I just wanted to know if someone is looking at a manufacturers product listing as the standard title would be "Let's see what we have here". Maybe you would like to add that to the next version? In catalog/includes/functions/leapfrog.php replace this: } elseif ($HTTP_GET_VARS['cPath']) { // Visitor is browsing categories $cPath = $HTTP_GET_VARS['cPath']; $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[(sizeof($cPath_array)-1)]; $page_desc_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c " . " where cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "' and cd.categories_id = c.categories_id"); $page_desc_values = tep_db_fetch_array($page_desc_query); $page_desc = $page_desc_values['categories_name']; $page_thumb = $page_desc_values['categories_image']; } else { with this: } elseif ($HTTP_GET_VARS['cPath']) { // Visitor is browsing categories $cPath = $HTTP_GET_VARS['cPath']; $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[(sizeof($cPath_array)-1)]; $page_desc_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c " . " where cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "' and cd.categories_id = c.categories_id"); $page_desc_values = tep_db_fetch_array($page_desc_query); $page_desc = $page_desc_values['categories_name']; $page_thumb = $page_desc_values['categories_image']; } elseif ($HTTP_GET_VARS['manufacturers_id']){ // Visitor is looking at a particular manufacturer page $page_desc_query = tep_db_query("select manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $HTTP_GET_VARS['manufacturers_id'] . "'"); $page_desc_values = tep_db_fetch_array($page_desc_query); $page_desc = $page_desc_values['manufacturers_name']; $page_thumb = $page_desc_values['manufacturers_image']; } else { abra
  14. Just updated to the new version. It has now some of the features that I manually added to the first version like visitors country and info on the visitors (spider, guest or logged in customer). I also like to know the selected language of a page. As I stated earlier in this thread I just added a new field to the database table to record the language id and changed the function to add this little info to the page title string. To be honest, I liked leapfrog opening a new page better. Like this if I do something in my admin panel and go back to leapfrog it starts registering visitors clicks from scratch instead of continuing the last "session". Also there is a bit of code missing now. The first version had the manufacturers title included. Just added that back in. Thanks again for a great contribution! abra
  15. Here are the changes I made to /catalog/admin/includes/functions/leapfrog.php to work with Ultimate SEO urls: Find // Get the product image if on product item page $pattern = "/products_id=[0-9]+/"; preg_match($pattern, $row['page_url'], $matches); $productPage = $matches[0]; $productId = substr($productPage, strpos($productPage, "=")+1); if ($productId == "") { $thumbUrl = ""; } else { $itemQuery = "select products_image from products where products_id=" . $productId; $itemResult = mysql_query($itemQuery); $item = mysql_fetch_object($itemResult); $thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item->products_image; } and replace with // Get the product image if on product item page $pattern = "/p-[0-9]+/"; preg_match($pattern, $row['page_url'], $matches); $productPage = $matches[0]; $productId = substr($productPage, strpos($productPage, "p-")+2); $productId = str_replace (".html", '', $productId); if ($productId == "") { $thumbUrl = ""; } else { $itemQuery = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id='" . $productId . "'"); $item = tep_db_fetch_array($itemQuery); $thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item['products_image']; } abra
×
×
  • Create New...