Jump to content

bjcworks

Members
  • Content count

    12
  • Joined

  • Last visited

Everything posted by bjcworks

  1. bjcworks

    Canada Post Automatic Labels

    I haven't read all the posts in this forum but I thought I would mention that I have just implemented a rewrite of the CP Automated Labels addon (5445) using the Canada Post XML API for non-contract accounts guideline to replace the previous get-page/post-page API. I haven't formally packaged the changes at this point but this is what I have done: catalog/includes/modules/shipping/canadapost.php --> addon 5842 --> most constants for labels can be set in Admin now including Test mode for labels --> contains Lettermail and Letterpost functions but these can be turned off in Admin catalog/admin/ship_canadapost.php --> XML API has 3 steps: Create Shipment, Acquire Artifact (shipping label) and Acquire Tracking PIN (tracking no.) --> the look and feel is basically the same, labels are still in PDF form and stored in the same subfolder catalog/admin/includes/classes/shipping_form.php --> all redundant code removed catalog/admin/third-party/cert/cacert.pem --> third party cert required and provided by CP catalog/admin/shipping_label.php --> remove, not required catalog/admin/includes/functions/ship_canadapost.php --> remove, not required I have implemented these changes in this 2.2 website, thesoapfarm.com Please advise if this has value.
  2. You didn't indicate which file this query was located in but from what I can see the MySQL syntax is incorrect in the string "from, cp_tracking orders where" and should read "from orders where". The string ", cp_tracking" might be required between "date_purchased" and "from" - check the code to determine this requirement.
  3. This module functions like the old Canada Post version in that it provides an EDD (estimated delivery date) for each of the CP shipping options. This module is integrated with the Automated Shipping Label module. The EDDs start when CP has the parcel in their hands so you could capture the EDDs and add your turn around times to produce total delivery estimates.
  4. bjcworks

    Second Currency

    I added the EUR currency for further testing and my code works fine through the life cycle of orders. I use SPPC Quantity Price Breaks and have made 2nd currency "title" and "display" changes to PriceFormatter, product_listing, shopping_cart, specials, whats_new, featured and associated boxes and had to make sure the formatting works throughout as well. Currency title and displays work correctly for all 3 modes, CAD, EUR, EUR(CAD) and any other currency set in admin. Byron
  5. bjcworks

    Second Currency

    I didn't want the order reversed but rather the currency change to occur on the prices immediately if I was switching from CAD to USD, i.e. show as USD (CAD) rather than just USD. The original code required an additional action such as a display of a category to invoke a currency class function to display USD (CAD). My code change still works for the setting in admin. Regards, Byron
  6. bjcworks

    Second Currency

    I have a question re the behaviour of the curriencies box. I have 2 currencies, CAD (default) and USD. When changing from CAD to USD in the currencies box, page displays change to USD. If you then click on a Category menu or What's New, the page displays change to USD (CAD). Is this the design intent? The code in question is in application_top.php if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) { $currency = $_GET['currency']; $currency_alt = $_GET['currency']; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; if (! tep_not_null($currency_alt)) $currency_alt = $currency; } I changed my version to the following so that when changing from CAD to USD in the currencies box, page displays change to USD (CAD) immediately. if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) { $currency_alt = $_GET['currency']; $currency = ($currency_alt != DEFAULT_CURRENCY) ? DEFAULT_CURRENCY : $currency_alt; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; if (! tep_not_null($currency_alt)) $currency_alt = $currency; } Please advise, Byron
  7. bjcworks

    Second Currency

    Great contribution Jack. I noticed a typo "$currecny" at line 175 of the install.txt for boxes/curriencies.php and also in the catalog/includes/boxes/curriencies.php: $activeCurrency = tep_not_null($currecny) ? $currency : $currency_alt; If you leave the spelling of $currecny as is $currency_alt will always be selected which displays correctly. If you correct the spelling of $currecny then $currency will always be selected (because of the settings in application_top.php) which doesn't display correctly. I have changed mine to $activeCurrency = tep_not_null($currency_alt) ? $currency_alt : $currency; What do you think? Byron
  8. Hi Jesse, I have been working on other priorities and finally got back to testing your contribution. I found an error in the way cookies were configured in my test site, it is fixed now and your contribution works great. Thanks for your support during my fumbling. I found a couple of small items missing in the INSTALL.htm as follows: Open admin/includes/classes/order.php +++++++++++++++++++++++++++++++++++++++++++++++++++ Comment: 'shipping_method' is missing in INSTALL.htm Find: 'orders_status' => $order['orders_status'], Add AFTER: 'cp_tracking' => $order['cp_tracking'], 'shipping_method' => $shipping_method, // missing in INSTALL.htm Open /admin/includes/languages/english.php +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comment: missing in INSTALL.htm Find: the last define('IMAGE_XXXXXXXXXX', 'YYYYYYY'); Add AFTER: define('IMAGE_ORDERS_SHIP', 'Create Canada Post Shipping Label'); I have made changes to admin/orders.php by moving the shipping_label button on the Edit page next to the tracking_number input box. I also added tracking and label buttons. The 3 buttons will only display if the required information is in the order. I did this so that my wife wouldn't be confused when or when not to create a shipping label for her orders. If you are interested in the code please let me know and I will email it to you. Thanks again for the wonderful contribution and support. Regards, Byron
  9. Thanks for getting back to me Jesse. When Hostgator originally compiled libcurl for me they retrograded our PHP version back to 4. Yesterday I requested them to reestablish PHP 5.2.6. So that happened and the following is our libcurl compilation: libcurl/7.18.2 OpenSSL/0.9.7a zlib/1.2.3 libidn/0.5.6 libssh2/0.18 I tried another test and I am having less success now because the login within Step 2 is failing with: https://sso-cal.canadapost-postescanada.ca/.../login/redirect HTTP/1.1 500 Internal Server Error Date: Wed, 25 Jun 2008 16:20:29 GMT Content-Length: 82 Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: JSESSIONID=84hjLvwNGPvGMmLygvpglwml1jrfn4ZJyWn2hBJTnykjKtqWsyzW!-1464866007; path=/ Cache-Control: no-cache, no-store <html><body> <form name=Login action="/sso/login.jsp?~language=EN" method=POST> So I am checking through everything to see if I created my own problem. Do you have any ideas? Regards, Byron
  10. Thanks for great contribution but I have run into a small problem. I have reviewed the forum posts but haven't found a similar issue noted anywhere. I am able to login to CP, i.e. I have received the "Step 2. Logged In." message. When the program moves onto Step 3, I receive a 404 Error, URI not found. I have turned on debug and the URL that was submitted is as follows: https://sso-cal.canadapost-postescanada.ca HTTP/1.1 404 Not Found Date: Fri, 20 Jun 2008 21:59:17 GMT Content-Length: 1214 Content-Type: text/html Connection: close ........ I didn't include the text between .............. </FONT><P><FONT FACE="Courier New">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.</p><p>If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.</FONT></P> I reviewed the Case 3 code in ship_canadapost_ajax.php: case 3: // curl init $ch = cp_setup(false); $response = cp_submit_page($ch, $response, SSO); $response = cp_submit_page($ch, $response); curl_close($ch); I am wondering about the 2nd arg, "$response" in the 1st cp_submit_page call, how is this arg initialized because that arg is used to expand the URL? I will dig into this in more detail but I am hoping you can give me guidance in what to research. Regards
  11. bjcworks

    [Contribution] Admin Notes

    I think this problem occurs with register_globals = off. I also fixed the date_status_change problem. My fixes are located in 2 places in /catalog/admin/admin_notes.php Near line 57 locate the following code: case 'update': tep_db_query("update " . TABLE_ADMIN_NOTES . " set contr_last_modified = now(), status = '" . $status . "', admin_note = '" . $admin_note_new . "', category = '" . $file_type_id . "', config_comments = '" . $config_comments . "', last_update = '" . $last_update . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"); tep_redirect(tep_href_link(FILENAME_ADMIN_NOTES, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $contr_id . '&sort=' . $HTTP_GET_VARS['sort'])); break; Replace that code with the following code: case 'update': // Custom - Fix date_status_change if ($HTTP_POST_VARS['date_status_change']) tep_db_query("update " . TABLE_ADMIN_NOTES . " set date_status_change = now() " . " where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"); // Custom - Use $HTTP_POST_VARS with register_globals = off tep_db_query("update " . TABLE_ADMIN_NOTES . " set contr_last_modified = now(), status = '" . $HTTP_POST_VARS['status'] . "', admin_note = '" . $HTTP_POST_VARS['admin_note_new'] . "', category = '" . $HTTP_POST_VARS['file_type_id'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" . $HTTP_POST_VARS['last_update'] . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"); tep_redirect(tep_href_link(FILENAME_ADMIN_NOTES, 'page=' . $HTTP_POST_VARS['page'] . '&sID=' . $HTTP_POST_VARS['contr_id'] . '&sort=' . $HTTP_POST_VARS['sort'])); break; Near line 182 locate the following code: <script language="javascript"> var LastUpdate = new ctlSpiffyCalendarBox("LastUpdate", "new_contr", "last_update","btnDate1","<?php echo $sInfo->last_update; ?>",scBTNMODE_CUSTOMBLUE); </script> <tr><form name="new_contr" <?php echo 'action="' . tep_href_link(FILENAME_ADMIN_NOTES, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('contr_id', $HTTP_GET_VARS['sID']) ; ?> <td><br><table border="0" cellspacing="0" cellpadding="2"> Replace that code with the following code: <script language="javascript"> var LastUpdate = new ctlSpiffyCalendarBox("LastUpdate", "new_contr", "last_update","btnDate1","<?php echo $sInfo->last_update; ?>",scBTNMODE_CUSTOMBLUE); </script> <?php // Custom - Initial "Status" setting $initial_status = $sInfo->status; // Custom - Fix date_status_change in 1st line of form statement below ?> <tr><form name="new_contr" <?php echo 'action="' . tep_href_link(FILENAME_ADMIN_NOTES, tep_get_all_get_params(array('action', 'info', 'sID', 'date_status_change')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('contr_id', $HTTP_GET_VARS['sID']); if($initial_status != $HTTP_GET_VARS['status']) echo tep_draw_hidden_field('date_status_change', 'true') ?> <td><br><table border="0" cellspacing="0" cellpadding="2">
  12. bjcworks

    Links Manager II

    Hello Jack, Wonderful contribution. I think I have found the reason for this problem. I am using version 1.18 and am using only one language - English. In admin/links.php at line 111, $links_language = tep_db_prepare_input($_POST['links_language']); is set to "en". When $links_language is used to store the language_id in the Links Description table later on, the language_id is set to zero instead of the appropriate language id. This happens for both Insert and Update. A "links submit" sets the language id correctly but when an admin "approve" of the link is done, the language id is set to zero on the Update. I inserted one line of code following line 117 (marked //new) to set $links_language to the appropriate language_id. Please let me know if this is the correct fix. Thanks $links_language = tep_db_prepare_input($_POST['links_language']); $languages_array[] = array('id' => '99', 'text' => 'All'); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $languages_array[] = array('id' => $i + 1, //$languages[$i]['id'], 'text' => $languages[$i]['name']); if($links_language == $languages[$i]['code']) $links_language = $languages[$i]['id']; // new }
×