Jump to content

otsmith1

Members
  • Content count

    34
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    neil
  1. otsmith1

    Offical Google Checkout module for osCommerce Support Thread

    Hello, I hope somebody can help me with this. I'm in the UK and have had this GC contribution working perfectly until I added in discount codes from my site. Reading the Google Checkout halp pages it seems that in the UK, entering the discount as a negative item in the basket is the only way of getting a discouny code into GC. Anyway, for some reason when the data is passed back to the response handler ready to be inserted into the various tables, the promo code line item seems to stop the process dead. I presume this is down to the negative amount being posted back. All the values are correct in my GC admin but the SQL with response hanlder stops when it reaches this coupon as a line item. The result is my values are not inserted into order_totals or order_status_history. orders is fully inserted but orders_products is only inserted until it reaches the discount code then it stops. If my users don't use a promo code, then all the order details are inserted into the database correctly so I can safely assume it is this line item that is the problem. Help! :'(
  2. otsmith1

    Offical Google Checkout module for osCommerce Support Thread

    Spot on, that worked. Thanks for your help.
  3. otsmith1

    Offical Google Checkout module for osCommerce Support Thread

    Hello there, I'd appreciate an answer on this if someone out there can help me. I've just installed v1.4beta1 but I'm in the UK and can't seem to get it to add VAT (17.5%) on my taxable products. Can anybody point me to the file to edit? Cheers :thumbsup:
  4. otsmith1

    Price dependent payment module

    No I don't use that module. I have pay in full (worldpay), or pay in 4 instalments (also worldpay). I don't have to do any of the future billing, worldpay do it through their futurepay agreement with the customer. I just get the money in monthly instalments.
  5. otsmith1

    Price dependent payment module

    Hi everyone I've finished by FuturePay hack and it works great. I've been asked to post the code so here goes. I'm sorry if this is a little clumsy, but I took the original WorldPay module and just added a few extra variables. This isn't an official contribution but hopefully somebody else will make it one. I need a WorldPay payment module that took the total, divided it by 4 and then took 4 equal monthly instalments instead of all in one go. WorldPay's FuturePay does this really well, it's just a question of passing the right variables through to worldpay's system. I simply asked WorldPay the exact set up of these variables to achieve what I wanted and they kindly emailed them to me. I then forced these variables into this payment module. Please note these are my variables and work for what I want. You will have to tweak these numbers to get them to work the way you want them to. My biggest problem was to seperate the module from the normal WorldPay module whiich I wanted to run independently from this one. i.e. Pay by WorldPay (full amount) Pay by WorldPay (in 4 instalments) I achieved this by taking Graeme Conkie's original module, copying it, and calling the new one worldpay1.php. I then hacked around with it :-) This is my modified module... <?php /* $Id: worldpay.php,v MS1a 2003/04/06 21:30 Author : Graeme Conkie (graeme@conkie.net) Title: WorldPay Payment Callback Module V4.0 Version 1.4 Revisions: Version MS1a Cleaned up code, moved static English to language file to allow for bi-lingual use, Now posting language code to WP, Redirect on failure now to Checkout Payment, Reduced re-direct time to 8 seconds, added MD5, made callback dynamic NOTE: YOU MUST CHANGE THE CALLBACK URL IN WP ADMIN TO <wpdisplay item="MC_callback"> Version 1.4 Removes boxes to prevent users from clicking away before update, Fixes currency for Yen, Redirects to Checkout_Process after 10 seconds or click by user Version 1.3 Fixes problem with Multi Currency Version 1.2 Added Sort Order and Default order status to work with snapshots after 14 Jan 2003 Version 1.1 Added Worldpay Pre-Authorisation ability Version 1.0 Initial Payment Module osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 Released under the GNU General Public License */ class worldpay1 { var $code, $title, $description, $enabled; // class constructor function worldpay1() { $this->code = 'worldpay1'; $this->title = MODULE_PAYMENT_WORLDPAY_TEXT_TITLE1; $this->description = MODULE_PAYMENT_WORLDPAY_TEXT_DESCRIPTION1; $this->sort_order = MODULE_PAYMENT_WORLDPAY_SORT_ORDER1; $this->enabled = ((MODULE_PAYMENT_WORLDPAY_STATUS1 == 'True') && (70 > 60)? true : false); if ((int)MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID1 > 0) { $this->order_status = MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID1; } if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_WORLDPAY_ZONE1 > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_WORLDPAY_ZONE1 . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->form_action_url = 'https://select.worldpay.com/wcc/purchase'; } // class methods function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { // Ian-san: Need to declare language_id global here 6/4/2003: global $HTTP_POST_VARS, $languages_id, $shipping_cost, $total_cost, $shipping_selected, $shipping_method, $currencies, $currency, $customer_id , $order; $worldpay_url = tep_session_name() . '=' . tep_session_id(); // Multi Currency - Graeme Conkie ver 1.3 - Set up variable // Added decimal point code - contributed by Ian Davidson (Feb 08,2003) - For Yen currency $OrderID = $order->customer['id']; $OrderAmt = number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', ''); $total=($order->info['total'] * $currencies->get_value($currency)); // Multi Currency - ver 1.3 $process_button_string = tep_draw_hidden_field('instId', MODULE_PAYMENT_WORLDPAY_ID1) . tep_draw_hidden_field('currency', $currency) . tep_draw_hidden_field('desc', 'Purchase from '.STORE_NAME) . [B]//futurepay variables tep_draw_hidden_field('futurePayType', 'regular') . tep_draw_hidden_field('startDelayUnit', '3') . tep_draw_hidden_field('startDelayMult', '1') . tep_draw_hidden_field('intervalUnit', '3') . tep_draw_hidden_field('intervalMult', '1'). tep_draw_hidden_field('option', '0') . tep_draw_hidden_field('noOfPayments', '3') . tep_draw_hidden_field('normalAmount', $OrderAmt / 4) . // FuturePay Assign Multi Currency Variable to Amount tep_draw_hidden_field('amount', $OrderAmt / 4); [/B] // Send URL and session name - contributed by Nick Vermeulen 08 Feb, 2003 tep_draw_hidden_field('cartId', $worldpay_url ) . //tep_draw_hidden_field('cartId', $OrderID ) . // Pre Auth Mod 3/1/2002 - Graeme Conkie if (MODULE_PAYMENT_WORLDPAY_USEPREAUTH1 == 'True') $process_button_string .= tep_draw_hidden_field('authMode', MODULE_PAYMENT_WORLDPAY_PREAUTH1); // Ian-san: Create callback and language links here 6/4/2003: $callback_url = tep_href_link(FILENAME_WPCALLBACK); $worldpay_callback = explode('http://', $callback_url); $language_code_raw = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id ='$languages_id'"); $language_code_array = tep_db_fetch_array($language_code_raw); $language_code = $language_code_array['code']; $address = htmlspecialchars($order->customer['street_address'] . "\n" . $order->customer['suburb'] . "\n" . $order->customer['city'] . "\n" . $order->customer['state'], ENT_QUOTES); $process_button_string .= tep_draw_hidden_field('testMode', MODULE_PAYMENT_WORLDPAY_MODE1) . tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('address', $address) . tep_draw_hidden_field('postcode', $order->customer['postcode']) . tep_draw_hidden_field('country', $order->customer['country']['iso_code_2']) . tep_draw_hidden_field('tel', $order->customer['telephone']) . tep_draw_hidden_field('myvar', 'Y') . tep_draw_hidden_field('fax', $order->customer['fax']) . tep_draw_hidden_field('email', $order->customer['email_address']) . // Ian-san: Added dynamic callback and languages link here 6/4/2003: tep_draw_hidden_field('lang', $language_code) . tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code) . tep_draw_hidden_field('MC_oscsid', $oscSid); // Ian-san: Added MD5 here 6/4/2003: if (MODULE_PAYMENT_WORLDPAY_USEMD51 == '1') { $md5_signature_fields = 'amount:language:email'; $md5_signature = MODULE_PAYMENT_WORLDPAY_MD5KEY1 . ':' . (number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '')) . ':' . $language_code . ':' . $order->customer['email_address']; $md5_signature_md5 = md5($md5_signature); $process_button_string .= tep_draw_hidden_field('signatureFields', $md5_signature_fields ) . tep_draw_hidden_field('signature',$md5_signature_md5); } return $process_button_string; } function before_process() { global $HTTP_POST_VARS; } function after_process() { return false; } function output_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_STATUS1'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable WorldPay Module', 'MODULE_PAYMENT_WORLDPAY_STATUS1', 'True', 'Do you want to accept WorldPay payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Worldpay Installation ID', 'MODULE_PAYMENT_WORLDPAY_ID1', '00000', 'Your WorldPay Select Junior ID', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Mode', 'MODULE_PAYMENT_WORLDPAY_MODE1', '100', 'The mode you are working in (100 = Test Mode Accept, 101 = Test Mode Decline, 0 = Live', '6', '5', now())"); // Ian-san: Added MD5 here 6/4/2003: tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Use MD5', 'MODULE_PAYMENT_WORLDPAY_USEMD51', '0', 'Use MD5 encyption for transactions? (1 = Yes, 0 = No)', '6', '4', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('MD5 secret key', 'MODULE_PAYMENT_WORLDPAY_MD5KEY1', '', 'MD5 secret key. Must also be entered into Worldpay installation config', '6', '5', now())"); // Pre Auth Mod - Graeme Conkie 13/1/2003 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_WORLDPAY_SORT_ORDER1', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use Pre-Authorisation?', 'MODULE_PAYMENT_WORLDPAY_USEPREAUTH1', 'False', 'Do you want to pre-authorise payments? Default=False. You need to request this from WorldPay before using it.', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID1', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Pre-Auth', 'MODULE_PAYMENT_WORLDPAY_PREAUTH1', 'A', 'The mode you are working in (A = Pay Now, E = Pre Auth). Ignored if Use PreAuth is False.', '6', '4', now())"); // Ian-san: Added MD5 here 6/4/2003: tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_USEMD51'"); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_WORLDPAY_MD5KEY1'"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_WORLDPAY_STATUS1', 'MODULE_PAYMENT_WORLDPAY_ID1','MODULE_PAYMENT_WORLDPAY_MODE1','MODULE_PAYMENT_WORLDPAY_USEPREAUTH1','MODULE_PAYMENT_WORLDPAY_PREAUTH1','MODULE_PAYMENT_WORLDPAY_SORT_ORDER1','MODULE_PAYMENT_WORLDPAY_ORDER_STATUS_ID1'); } } ?> This needs to be saved in includes/modules/payment. You also need a slightly modifies language file. Mine is... <?php /* $Id: worldpay1.php,v MS1a 2003/04/06 21:30 Author : Graeme Conkie (graeme@conkie.net) Title: WorldPay Payment Callback Module V4.0 Version 1.4 Revisions: Version MS1a Cleaned up code, moved static English to language file to allow for bi-lingual use, Now posting language code to WP, Redirect on failure now to Checkout Payment, Reduced re-direct time to 8 seconds, added MD5, made callback dynamic NOTE: YOU MUST CHANGE THE CALLBACK URL IN WP ADMIN TO <wpdisplay item="MC_callback"> Version 1.4 Removes boxes to prevent users from clicking away before update, Fixes currency for Yen, Redirects to Checkout_Process after 10 seconds or click by user Version 1.3 Fixes problem with Multi Currency Version 1.2 Added Sort Order and Default order status to work with snapshots after 14 Jan 2003 Version 1.1 Added Worldpay Pre-Authorisation ability Version 1.0 Initial Payment Module osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 Released under the GNU General Public License */ define('MODULE_PAYMENT_WORLDPAY_TEXT_TITLE1', 'By 4 Monthly Credit Card Payment Instalments'); define('MODULE_PAYMENT_WORLDPAY_TEXT_DESCRIPTION1', 'Instalments Worldpay Payment Module'); ?> This needs to be called worldpay1.php and saved into includes/languages/english/modules/payment/ I hope this works for everyone as well as it has done for me :-)
  6. otsmith1

    Price dependent payment module

    Hi, I'm hacking together a futurepay module for worldpay. I've got it working fine but I now need it only to be a valid payent option if the order total is above a certian amount. Can anybody help me please? :D Obviously somewhere I need to run the check 'is the order total above XXX' but... Do I do this on the bit of the system that decides what payment modules are installed or do I do this in the payment module itself? i.e. only show this module as an option if order is greater than XXX I'd be really really grateful if anyone could give me the answer to this one... and a bit of code is always nice! thanks a lot ;)
  7. otsmith1

    [Contribution] Cross Sell (X-Sell) Admin

    Ok, there's no point picking through exactly what I did so here's the whole module. Just copy and paste this code into a file, name it what you want (mine's called xsell_products_buynow.php and place it in your modules folder. You simply call this module from the product_info page. I use: <?php include("includes/modules/xsell_products_buynow.php");?> to do this. Ok here's my version of the module: <table class="box" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><BR><B>Related items & accessories for this product:</B><BR><BR> <script type="text/javascript"> <!-- function acknowledge() { var agree = confirm("This item will be added to your cart"); if (agree) { return true; } else { return false; } } //--> </script> <?php /* $Id: xsell_products.php, v1 2002/09/11 osCommerce, Open Source E-Commerce Solutions <http://www.oscommerce.com> Copyright (c) 2002 osCommerce Released under the GNU General Public License */ if ($HTTP_GET_VARS['products_id']) { $xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by xp.products_id asc limit " . MAX_DISPLAY_ALSO_PURCHASED); $num_products_xsell = tep_db_num_rows($xsell_query); if ($num_products_xsell >= MIN_DISPLAY_XSELL) { ?> <!-- xsell_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => ''); new contentBoxHeading($info_box_contents); $row = 0; $col = 0; $info_box_contents = array(); while ($xsell = tep_db_fetch_array($xsell_query)) { $xsell['specials_new_products_price'] = tep_get_products_special_price($xsell['products_id']); if ($xsell['specials_new_products_price']) { $xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>'; $xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>'; } else { $xsell_price = $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])); } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', // 'text' => tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br> //<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $xsell['products_name'] . TEXT_NOW) .'</a>'); 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br><b>' . $xsell_price. '</b><br><BR> <form onsubmit="javascript:return acknowledge();" name="cart" method="post" action="'.tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL').'">Qty <input type="text" name="cart_quantity" value="1" maxlength="2" size="2" onfocus="javascript:this.value=\'\';" style="background-color:99a6b8;border-color:#001c42;color:#001c42;border-style:solid;border-width:1px;font:11px arial;font-weight:normal;width:20px"> <input type="hidden" name="products_id" value="'.$xsell['products_id'].'"> <input type="submit" name="Submit" value="BUY NOW" style="background-color:#cccccc;color:#001C42;border-color:#001C42;border-style:solid;border-width:1px;font:11px arial;font-weight:normal;width:70px"><BR><BR> </form>'); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- xsell_products_eof //--> <?php } } if ($row ==0) { echo('Sorry, there are no selected accessories or related items for this product'); } ?> </td></tr></table><BR> It simply lists the xsell products and places a buy now button and quantity box just below each product. PLEASE NOTE YOUR OSCOMMERCE MUST BE SET TO NOT SHOW THE SHOPPING CART AFTER ADDING A PRODUCT. If this is setup ok your user will stay on the main product information page but be able to add any number of your cross sell products to the shopping cart from there. i'm not an expert, in fact a real amatuer, but I do think this works.
  8. otsmith1

    [Contribution] Cross Sell (X-Sell) Admin

    Hello everyone I've modified the front end module to actually add the related product directly to the shopping cart without leaving the main product information page. I've also added a quantity box just before the BUY NOW button and a simple pop-up window to tell them that it's been added to the cart successfully. If anyone's interested I'll post the code. :) Regards Neil
  9. Hi, I'd really appreciate it if anyone can point me in the right direction on this one. I've just been trying out some new payment and shipping modules and whilst I find I can install them fine on the administration side, they don't show up on the front end of the site!! When I look again I find that the modules have no sort order specified :-( I'm presuming this is preventing them from displaying on the site? How do I manually assign a sort order to these modules? Thank you advance Cheers Neil
  10. otsmith1

    manufacturer's logos

    thank you - took 5 minutes and works perfectly! cheers neil
  11. Hi everyone I have a need for this and I just wondered if there was already a contribution to do it? As the manufacturers and their respective images (logos), are already in the database is it possible to write something that will just output ALL these images to a page? This page could could simply list the manuacturers you use and link through to the products that they have in your site? I can't be the first person to think this would be useful, so I'd appreacite it if someone could point me in the right direction. Cheers Neil :)
×