Jump to content

marcingebus

Members
  • Content count

    6
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Marcin
  1. marcingebus

    [contribution] Tracking Module

    After long war, my version for Courier Opek are working, but not full. I have some problem. First example. 1.Client login at my shop. 2.Client at place: Top » Catalog » My Account » History » Order #8949 see his tracking number. 3. When he click for him ID, then he see result. I test this self on opera browser. When I at the same time have see http://blablabla.pl/catalog/admin/orders.php. And when I click at ID, then for first time all are ok. And when I click agains, & again & again all are ok too. ---------------------------------------------------------- After this example I close opera (all session are closed). Then in admin side see result only for first click. After second click I see error: Fatal error: Call to a member function add_current_page() on a non-object in ...../catalog/includes/application_top.php on line 312 The 312 line are like here: 312: $navigation->add_current_page(); ---------------------------------------------------------- For client all working OK (client must be signed). For admin not. Can somebody help me? (session in configure.php are mysql). ---------------------------------------------------------- Another information: When I see first time error: "Fatal error: Call to a member function add_curren...." I can't open catalog side. When I clear cache of opera, are start like new. (One click in admin-side or must login on client-side as some client & can working in admin-side full).
  2. marcingebus

    [contribution] Tracking Module

    I try to remake the dhl-courier for my courier www.opek.com.pl. The tracking webside are here: http://opek.top100.net.pl/ Everyone can use this form, but must write username/passord. For all, you can use: username (Nazwa uzytkownika): opek password (haslo): opek True list id are (Podaj numer(y) przesylek): 30627320 My source of catalog/op_tracking.php are like here: -------------------------------------- <?php /* $Id: dp_tracking.php, v1.0 2008/09/29 web-engel - osC forum id - chris23 This script will be called via ajax from account_history_info.php and admin/orders.php osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ // prevent direct calls to this page if (!isset($_GET['tracking_id'])) { die('Direct call to script. Exiting.'); } error_reporting(E_ALL); require("includes/application_top.php"); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TRACKING_MODULE); // cookie file for cURL $cookie_name = "opcookie.txt"; $tracking_number = $_GET['tracking_id']; $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"; // dummy UA $opek_id = "opek"; // Set your DHL ID $opek_user_password = "opek"; // Set your DHL password // Note: the tidying code below has been done on language=de only. Haven't tested tidying code on en page $initial_loginurl = "http://opek.top100.net.pl/"; // Login $ch= curl_init(); // initialise curl curl_setopt($ch, CURLOPT_URL, 'http://opek.top100.net.pl/Status.aspx'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, $agent); // set cookie jar / file curl_setopt($ch, CURLOPT_COOKIEJAR, DIR_FS_CATALOG . 'tmp/' . $cookie_name); curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name); curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl); curl_setopt($ch, CURLOPT_POSTFIELDS, "UserName=" . $opek_id . "&Password=" . $opek_user_password ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_exec($ch); if ($error = curl_errno($ch)) { if ($error == 7) { die(TRACKING_CURL_SERVER_ERROR); } if ($error == 6) { die(TRACKING_CURL_NO_ACTIVE_INTERNET); } } // Logged in. Post tracking ID & params and see where we get sent: curl_setopt($ch, CURLOPT_URL, 'http://opek.top100.net.pl/Status.aspx'); curl_setopt($ch, CURLOPT_HEADER, 1); // we need headers returned so we can extact 302 "location" curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEJAR, DIR_FS_CATALOG . 'tmp/' . $cookie_name); curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name); curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl); curl_setopt($ch, CURLOPT_POSTFIELDS, 'TextBoxNrListu=' . $tracking_number); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if ($error = curl_errno($ch)) { if ($error == 7) { die(TRACKING_CURL_SERVER_ERROR); } if ($error == 6) { die(TRACKING_CURL_NO_ACTIVE_INTERNET); } } /* we cannot rely on CURLOPT_FOLLOWLOCATION on shared servers (having openbase_dir / safe_mode enabled) because since PHP 4.4.4 / PHP 5.2.0 this option is disabled dl use a single 302 temporary redirect - get the url */ list($header, $data) = explode("\n\n", $data, 2); preg_match('/Location:(.*?)\n/', $header, $matches); $nurl = trim(str_replace("Location:", "", $matches[0])); // now have redirected url curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLHEADER, 0); curl_setopt($ch, CURLOPT_COOKIEFILE, DIR_FS_CATALOG . 'tmp/' . $cookie_name); curl_setopt($ch, CURLOPT_URL, $nurl); curl_setopt($ch, CURLOPT_REFERER, $initial_loginurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $grab_data = curl_exec($ch); curl_close ($ch); // tidy extraneous whitespace - use on all grabs $grab_data = str_replace("\n", "", $grab_data); $grab_data = str_replace("\r", "", $grab_data); $grab_data = str_replace("\t", "", $grab_data); $grab_data = str_replace(" ", "", $grab_data); $pat[0] = "/^\s+/"; $pat[1] = "/\s{2,}/"; $pat[2] = "/\s+\$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $grab_data = preg_replace($pat, $rep, $grab_data); // set html start and end grab $StartGrab = '<table border="0" cellpadding="3" cellspacing="0" style="width: 720px;" >'; $EndGrab = '</table>'; // Grab delivery status information $text = eregi("$StartGrab(.*)$EndGrab", $grab_data, $content); // start custom tidying // strip tags - keep tracking tables but tidy afterwards $content = strip_tags($content[1], '<table><tr><th></th><td></td></tr></table>'); // remove all html attributes function strip_attributes($msg, $tag, $attr) { $lengthfirst = 0; while (strstr(substr($msg, $lengthfirst), "<$tag ") != "") { $imgstart = $lengthfirst + strpos(substr($msg, $lengthfirst), "<$tag "); $partafterwith = substr($msg, $imgstart); $img = substr($partafterwith, 0, strpos($partafterwith, ">")+1); $img = str_replace(" =", "=", $msg); $out = "<$tag"; for($i = 0; $i <= (count($attr) - 1 ); $i++) { $long_val = strpos($img, " ", strpos($img, $attr[$i]."=")) - (strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1) ; $val = substr($img, strpos($img, $attr[$i]."=") + strlen($attr[$i]) + 1, $long_val); if (strlen($val) > 0) $attr[$i] = " ".$attr[$i]."=".$val; else $attr[$i] = ""; $out .= $attr[$i]; } $out .= ">"; $partafter = substr($partafterwith, strpos($partafterwith, ">")+1); $msg = substr($msg, 0, $imgstart).$out.$partafter; $lengthfirst = $imgstart+3; } return $msg; } $content = strip_attributes($content, "TR", array()); $content = strip_attributes($content, "tr", array()); $content = strip_attributes($content, "TD", array()); $content = strip_attributes($content, "td", array()); $content = strip_attributes($content, "table", array()); // strip empty cells , rows and tables: $content = preg_replace('/<td>\s*<\/td>/i','', $content); // cells $content = preg_replace('/<tr>\s*<\/tr>/i','', $content); // rows $content = preg_replace('/<table>\s*<\/table>/i','', $content); // rows // size table: $content = str_replace('<table>', '<table style="font-size: 11px">' , $content); // the following functions will prevent 'UTF garbled' returned data. We try to use iconv (may be missing on Win32) or mb_convert_encoding (may not be compiled in to PHP) if(function_exists(mb_convert_encoding)){ echo mb_convert_encoding($content, "ISO-8859-1", "UTF-8"); } elseif(function_exists(iconv)){ echo iconv("UTF-8", "ISO-8859-1", $content); } else { echo $content; } ?> -------------------------------------- & not working. I see info from const: INVALID_TK_ID_OP (the XX = OP in my contributions) Can somebody help me? -- MG
  3. marcingebus

    [Contribution] Ship 2 Pay v1.0 (MS1)

    1. You need one specjal country. 2. _EACH_ method of ship must can calculate shipping cost for the specjal country. You must set _each_ method of ship, to can calculate. Setting are depending for the method. 3. ID of specjal country you should write in the file: /catalog/admin/ship2pay.php find line like this (+-21): $order->delivery['country']['id']=170000; -------------------------------------------------------------------------------------- I prepare the specjal country ZZ, you can prepare the same country or can use other country. The good solution are Antarctica. -------------------------------------------------------------------------------------- You can see in drop down menu only ship-method, which can calculate cost of ship for the country defined in file: /catalog/admin/ship2pay.php find line like this (+-21): $order->delivery['country']['id']=170000; -- MG
  4. marcingebus

    [Contribution] Ship 2 Pay v1.0 (MS1)

    Check your version ship2pay (for the multimethod modules you need 2.01, for modules with 1 method, you need 1.5: each befor 2.0). I describe potencial problem in 2.01 version: In the file: /catalog/admin/ship2pay.php find line like this (+-21): $order->delivery['country']['id']=170000; Country with ID=170000 should be working with all method of ship (check config in modules or in zones are if modules working with zones). If you prefer other country, you need change the number in this line, to your best country (the country should working with all method of ship). Genereal: you need one country (realy or specjal/virtual). The country should working with all method of ship. The ID of the country shoul exist in the file /catalog/admin/ship2pay.php in line (+-21): $order->delivery['country']['id']=170000; You need this country i this line only to see the method of ship in drop down menu. Only for this place. -- Marcin Gebus
  5. marcingebus

    [Contribution] Ship 2 Pay v1.0 (MS1)

    New version available. New features in v2.0: can connect multi-shipping module to payments. -- Marcin Gebus
  6. marcingebus

    [Contribution] Ship 2 Pay v1.0 (MS1)

    All are OK, you should to have only one entry with ship modules in table and connect to this entry one or more payments module with key [CTRL] in one step.
×