Jump to content

sciulli

Members
  • Content count

    14
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Va Tavenner
  1. This modification was created for a store which offers downloadable products as well as customization services for those products. We needed a way to create custom invoices based on quotes provided to customers. We also wanted a simple way for customers to pay their invoices so that their orders and invoices were updated automatically via PayPal IPN and viewable within their account history. This modification allows you to integrate a billing system (invoices) within your catalog which will allow your customers to pay their invoices via PayPal directly from their accounts. Invoices are updated via PayPal IPN and viewable from the customer's account history. Although created for one-time invoices, this could be modified for recurring payments by adding the extra PayPal variables for subscriptions to the account_history_info.php file. 1. Install osCommerce PayPal IPN contribution http://www.oscommerce.com/community/contributions,2679 (tested with v1.4) 2. Install Step by Step Manual Order contribution v1.8 http://www.oscommerce.com/community/contributions,1589 (Which will allow you to create new accounts and orders via admin.) 3. Create a new product in your catalog entitled "Customization Services" and DISABLE the status so that the product is not active/viewable within the public catalog. (for our catalog we set the price to $0.00 and the price is defined within each invoice that is created.) 4. open account_history_info.php (make a backup copy before modifying!) --------- You will need to know the product ID for the new Customization Services product and also the value of completed orders (quickest way is to click on each in your admin panel and get the value from the address bar). --------- around line 193 in account_history_info.php find: <?php for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) { echo ' <tr>' . "\n" . ' <td class="main" align="right" width="100%">' . $order->totals[$i]['title'] . '</td>' . "\n" . ' <td class="main" align="right">' . $order->totals[$i]['text'] . '</td>' . "\n" . ' </tr>' . "\n"; } After this add ///////// //BEGIN INVOICE MODIFICATION //define the status id for completed orders here $completedpymt = 3; //define the product id of the product "Customization Services" here $iProduct = 18; $product_info_query = tep_db_query("select p.products_id, o.orders_status from " . TABLE_ORDERS_PRODUCTS . " as p, " . TABLE_ORDERS . " as o where o.orders_id = '" . $HTTP_GET_VARS['order_id'] . "' AND p.orders_id = '" . $HTTP_GET_VARS['order_id'] . "'"); $product_info = tep_db_fetch_array($product_info_query); $products_id = $product_info['products_id']; $status = $product_info['orders_status']; //if order status is not completed and product ID is "Customization Services" then display link for paypal payment if (($products_id == $iProduct) && ($status != $completedpymt)) { $form_action_url = 'https://secure.paypal.com/cgi-bin/webscr'; echo '<tr><td align="right" valign"bottom" colspan="2"><br><br>'; echo tep_draw_form('checkout_confirmation', $form_action_url, 'post'); echo tep_draw_hidden_field('cmd', '_xclick'); echo tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_IPN_ID); echo tep_draw_hidden_field('item_name', STORE_NAME .' Customization Services ('. HTTP_SERVER .')'); echo tep_draw_hidden_field('amount', str_replace('$', '', $order->info['total'])); echo tep_draw_hidden_field('notify_url', tep_href_link('ext/modules/payment/paypal_ipn/ipn.php', '', 'SSL', false, false)); echo tep_draw_hidden_field('no_note', '1'); echo tep_draw_hidden_field('no_shipping', '1'); echo tep_draw_hidden_field('custom', $customer_info['customers_id']); echo tep_draw_hidden_field('currency_code', 'USD'); echo tep_draw_hidden_field('invoice', $HTTP_GET_VARS['order_id']); echo tep_draw_hidden_field('return', tep_href_link(ACCOUNT_HISTORY_INFO, '', 'SSL')); echo tep_draw_hidden_field('cancel_return', tep_href_link(ACCOUNT_HISTORY_INFO, '', 'SSL')); echo tep_draw_hidden_field('cbt', 'Complete your Order Confirmation'); echo tep_draw_hidden_field('bn', 'osCommerce PayPal IPN v1.0'); echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n"; echo '</td></tr>'; } //END INVOICE MODIFICATION /////// To create an invoice from admin side for existing customers: 1. Click on Customers >> Create Order 2. To include the order specifications or quote details, add the info to the comments section at the bottom of the next page.
  2. sciulli

    Paypal IPN checkout error

    I ran into a similar problem. PayPal changed something and now requires certain fields to have values, although it worked previously without a value within the field. You'll need to view what values are sent to PayPal. For me, it was that the lc (language code) wasn't being defined for certain orders. Posted what worked for me here: http://forums.oscommerce.com/index.php?sho...54entry877754
  3. I'm trying to develop a page that will display groupings of links based on purchase (defined by product type . order status and purchase date). Example: display all listings within the past year for completed purchases of product #2. I'm using options_type contribution for text input fields. What I would like the mod to do is return query results as follows: (oa.order_id) (oa.products_options) (oa.products_options_values) 4 Title This is my title 4 Ad This is my text 4 URL http://url.com 5 Title This is my title1 5 Ad This is my text1 5 URL http://url1.com and print out as (bold)This is my title (italic)This is my text (url)http://url.com (bold)This is my title1 (italic)This is my text1 (url)http://url1.com Instead, all the results are underlined, only the first letter of each row is being returned and they are in random order. $end_date = strftime ("%Y-%m-%d", strtotime("-1 year")); $result = tep_db_query("select oa.products_options as title, oa.products_options_values as value from orders_products op, orders o, orders_products_attributes oa where op.products_id = 2 and o.date_purchased > '. $end_date .' and o.orders_id = op.orders_id and o.orders_id = oa.orders_id AND o.orders_status =3"); while ( $row = tep_db_fetch_array($result)) { foreach ($row as $rows) { if ($row['oa.products_options'] == 'Title') { // title selected - print bold print '<B>'.$rows['oa.products_options_values'].'</B><BR>'; } else if ($row['oa.products_options'] == 'Ad') { // ad selected - print italic print '<i>'.$rows['oa.products_options_values'].'</i><BR>'; } else if ($row['oa.products_options'] == 'URL') { // url selected - print link print '<a href='.$rows['oa.products_options_values'].'>'.$rows['oa.products_options_values'].'</a><BR>'; } else { // other category - print regular print '<u>'.$rows['oa.products_options_values'].'</u><BR>'; } } // end foreach } I've copied/pasted snippets from all over so it's terrible code and reading about php arrays isn't getting me anywhere. Any help is appreciated.
  4. I was able to get the Option Type (for text options) to function by creating duplicates of these two sections in categories.php: Entire 1st section beginning with: (near line 280) ///////////////////////////////////////////////////////////////////// // BOF: WebMakers.com Added: Update Product Attributes and Sort Order // Update the changes to the attributes if any changes were made Entire 2nd section beginning with: (near line 750) <?php ///////////////////////////////////////////////////////////////////// // BOF: WebMakers.com Added: Draw Attribute Tables In the duplicate sections, I limited the options queries to option types (products_options_type = '1'), the values query to text id (pov.products_options_values_id = 0) and renamed all references to queries (renamed $options to $textoptions, $values to $textvalues, $attributes to $textattributes). Here's a sample of the changes made for the 2nd section: $textoptions_query = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_type = '1' and language_id = '" . $languages_id . "' order by products_options_name"); while ($textoptions = tep_db_fetch_array($textoptions_query)) { $textvalues_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pov.products_options_values_id = 0"); This might help if you need a reference point for where to start. I would post all of it but mine included other modifications which might conflict with different setups. There may be an easier way to incorporate it into the existing sections, but I wasn't able to figure it out.
  5. sciulli

    [Contribution]Paypal IPN - Devosc

    Same problem here. After a year of smooth payment processing, suddenly our membership site is only receiving intermittent PayPal IPN notification. We receive the email notification. It appeared to resolve yesterday but the problem began again today. I've emailed PayPal in hopes of finding a solution (or cause).
  6. sciulli

    [Contribution]Paypal IPN - Devosc

    I've installed the debug contribution and am receiving the following message for each paypal ipn definition in database_tables: INFO: Use of undefined constant TABLE_PAYPAL_IPN - assumed 'TABLE_PAYPAL_IPN' At /cat/includes/database_tables.php:61 unknown() Called from /cat/includes/application_top.php:58 require(string: "/home/*****/public_html/php/cat/includes/database_tables.php") Called from /cat/login.php:13 require(string: "/home/*****/public_html/php/cat/includes/application_top.php") I have STS templates also installed. Any assistance would be greatly appreciated.
  7. sciulli

    [Contribution]Paypal IPN - Devosc

    I've been using PayPal_Shopping_Cart_IPN v1.7. I only accept paypal and only have virtual products, so I configured checkout to only require an email and password then skip straight to checkout_confirmation. //3.8.2004 added to skip shipping and payment screens $sendto = false; $billto = $customer_default_address_id; $payment_modules = new payment(paypal); I've installed v2.6 and now during checkout it keeps looping back to checkout_confirmation rather than proceeding to checkout_process. Which files within the contribution need to be modified so I can keep the simplified checkout? I've been unsuccessfully attempting different things for the past two days so any guidance would be greatly appreciated.
  8. sciulli

    Membership contribution.

    I'm not sure if this is what you're looking for, but our site has membership tiers (or levels) as well as a free section. Visitors can download certain designs for free. Members are given access to download designs based on their membership level. The higher the membership, the more features available to them. I created memberaccess.php to check a member's status: <?php /* $Id: memberaccess.php,v 1.0 2004/07/13 03:01:48 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ /* Membership Access - Copyright (c) 2004 Va Tavenner - birds_etc@yahoo.com */ // Return a customer greeting function tep_customer_pgreeting() { global $customer_id, $customer_first_name; if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $pgreeting_string = sprintf(TEXT_GREETING_PRODUCT, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } else { $pgreeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); } return $pgreeting_string; } define('TEXT_GREETING_PRODUCT', 'Hello <span class="greetUser">%s!</span>'); //fetch order variables from the ORDERS table //5.21.04 added the order by statement $member_query=(tep_db_query("select orders_status, orders_id, date_format(date_purchased, '%Y-%m-%d') as date_purchased_day from " . TABLE_ORDERS . " where customers_id = '$customer_id' order by date_purchased DESC")); $member = tep_db_fetch_array($member_query); $ordernumber = $member['orders_id']; $orderstatus = $member['orders_status']; $orderdate = $member['date_purchased_day']; //define length of membership by product ID number $expiry_query=(tep_db_query("select products_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '$ordernumber'")); $expiry = tep_db_fetch_array($expiry_query); $product=$expiry['products_id']; //product id determines length of membership, product 155 is for one month etc if ($product == '155') $exp=1; if ($product == '156') $exp=3; if ($product == '157') $exp=6; if ($product == '158') $exp=12; //define expiration of membership by product ID number list($y, $m, $d) = explode('-', $orderdate); $member_timestamp = mktime(23, 59, 59, ($m)+$exp, $d, $y); $newtime = $member_timestamp; $member_expiry = date('m-d-Y', $newtime); //define whether membership is current or expired if ($member_timestamp <= time()) $active=expired; if ($member_timestamp > time()) $active=current; //define whether payment for order was completed if ($orderstatus == '3') $orderstat=completed; if ($orderstatus != '3') $orderstat=incomplete; //set access status //if they are a member with a completed order but expired membership if (tep_session_is_registered('customer_id') && ($orderstat==completed) && ($active == expired)) $memaccess='renew'; //if they are a member with a completed order and current membership if (tep_session_is_registered('customer_id') && ($product!='158') && ($orderstat==completed) && ($active == current)) $memaccess='member'; //if they are a member with a completed order and current pro membership if (tep_session_is_registered('customer_id') && ($product=='158') && ($orderstat==completed) && ($active == current)) $memaccess='pro'; //if they are not a member or haven't logged in yet if (!tep_session_is_registered('customer_id')) $memaccess='new'; ?> In product_info.php, or any page where you want to define what certain members will see, insert the following at the top: include('memberaccess.php'); Then where the member-specific information will be displayed insert: //////////////////////// //Define what they will see based on conditions defined in memberaccess.php /////////////////////// //if they are not a member or haven't logged in yet if ($memaccess == 'new') {echo tep_customer_pgreeting(). "You must log in or become a member in order to access this design.";} /////////////////////// //if they are a member with a completed order but expired membership if ($memaccess == 'renew') {echo tep_customer_pgreeting(). "<BR>Your membership expired: <B>".$member_expiry. "</B>. Please renew your membership.";} /////////////////////// //if they are a member with a completed order and current standard membership if ($memaccess == 'member') {echo "<table border=0 width=100% class=infoBox><tr class=infoBoxContents><td align=left class=main><b>".tep_customer_pgreeting(). <table border=0 width=100% class=infoBox><tr class=infoBoxContents><td align=left class=main><b>".tep_customer_pgreeting(). "</B></td><td align=right class=main>Your membership expires <B>".$member_expiry."</B></td></tr></table>The following design options are available:"; /////////////////////// } //if they are a member with a completed order and current pro membership if ($memaccess == 'pro') {echo "<BR><BR><table border=0 width=100% class=infoBox><tr class=infoBoxContents><td align=left class=main><b>".tep_customer_pgreeting(). "</B></td><td align=right class=main>Your membership expires <B>".$member_expiry."</B></td></tr></table>The following design options are available"; }
  9. sciulli

    [contribution] Simple Template System (sts)

    Would it be possible to define a template product_info.php file based on the category the products are located in? So for example, a template for any product in category ID=36 would look like: "product_info.php_36.html". Something like: ///////Product-specific templates (contributed by Chris L.) // Are we in the product_info.php script? if ($scriptbasename == "product_info.php") { if (isset($HTTP_POST_VARS['categories_id'])) { $sts_categoriesid = $HTTP_GET_VARS['categories_id']; // Look for category-specific product template file like "product_info.php_36.html" $sts_check_file = STS_TEMPLATE_DIR . "product_info.php_$sts_categoriesid.html"; if (file_exists($sts_check_file)) { // Use it $sts_template_file = $sts_check_file; } } } /////// Thanks in advance!
×