All posts by simon

gift vouchers, how to setup, use and manage

Gift Vouchers

There are two types of redeemable ‘credits’ in oscommerce-based carts:

  1. a printed voucher with a redemption code, value and message (physical) – this is basically a coupon
  2. purchased online credit sent to someone’s email address (electronic) – this is a gift voucher

You could have the first type printed up, sold through your online store as a regular product and mailed to the purchaser or recipient. This article is about the second type – the electronic gift voucher – which uses the store’s system to record credit.

Did you know ?

A little known FAQ script included with most installations can be found in the file gv_faq.php.

On www.yourwebsite.com the url address would be then: www.yourwebsite.com/gv_faq.php

Gift Vouchers Process (Buyer’s View)

  1. Purchase the GV product as you would any other product via checkout
  2. The value of the GV value is added to the Buyer’s Account as ‘credit’
  3. Buyer can send credit to a recipient’s email address, or use credit for themselves
  4. Recipient ticks checkbox in checkout to use GV balance – balances below the order value will require the Recipient to pay the balance using a different payment method
  5. Any unusued GV credit is recorded in the Recipient’s Account for later

Gift Vouchers Process (Admin’s View)

  1. GV is setup like any other product, except:
  • weight is usually zero
  • product_model must begin with the word GIFT
  1. Admin can collect purchases of GVs in a queue for checking before release to Buyer
  2. Admin needs to offer other payment methods for use with GVs below order total value
  3. The GV Order Total module should be enabled in Admin >> Modules >> Order Total

There are several considerations* for Admin in the GV system:

  • there is no way of telling Customer GV balances using the default reporting
  • if Release Queueing isn’t enabled in the Order Total module, the GV value will be credited immediately to the Buyer’s account
  • you’ll only be able to see purchased gvs through the order, as any non-queued gvs don’t go through the gv report.
  • there are issues using GVs and Paypal modules, in particular regarding $0.00 order balances and cancelling an order when on the Paypal site (GV value is still removed from Account)

*Not all of these considerations are found throughout all oscommerce-based carts. Zencart for example has a more reliable yet feature limited version of the system.

put lists in a dropdown in alphabetical order

Adding new infoboxes through the Admin of an oscommerce cart is laborious enough without having to hunt through an unsorted list of filenames in a dropdown. So this article’s short tip examples one of php’s really useful functions – sort().

This is an unsorted list of infobox files in a dropdown in a Cre Loaded Admin:

Same list now sorted alphabetically:

The basic code change required to an array:

 $dirs1[] = $file;
            $dirs_array1[] = array('id' => $file1,
                                   'text' => $file1);
          }
        }
        closedir($handle1);
      }

sort($dirs_array1);  // added to sort list alphabetically

set default payment method in checkout

Sometimes its helpful to have a payment method ‘preselected’ for customers in the checkout area, so they avoid getting an error message if they miss that option. Or maybe you want to select a method for them as an example of what it looks like … plenty of reasons. This short article explains how to set a default payment method in oscommerce 2.2 and cre loaded 6.4.1a carts (which is slightly harder as cre is using runoverride files now to ‘steer things in a paypal direction.’)

Oscommerce 2.2 version
Backup the file: /catalog/checkout_payment.php and edit as follows:
Find:

 1) {
          echo tep_draw_radio_field('payment', $selection[$i]['id']);
        } else {
          echo tep_draw_hidden_field('payment', $selection[$i]['id']);
        }
?>

Replace with:

 1) {
          if ($i == 0) { 
                $checked = true;          
                } else {  
           $checked = false;      
           }     
                echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);
           } else { 
                echo tep_draw_hidden_field('payment', $selection[$i]['id']);
           }
?>

Cre Loaded 6.4.1a
Backup the file: /catalog/includes/runoverride/ordercheckout/paypalxc_ordercheckout_paymentmodule.php

To get the selector bar highlighting the payment method row, modify as follows, replacing the payment method name in the ‘name of payment method’ bit:


              

If you’re not sure of the payment module names, go to Admin >> Modules >> Payment area, click on a module and read it’s name from the url in the address bar. Or just check in the /includes/modules/payment folder and drop the .php extension.

To get the radio button to default to the selected payment module, modify the following:

 1 || $ec_enabled ) {
   if ($i == 0) {  // defaults to payment method with id=0 NOT related to sort order in admin
      $checked = true;
   } else {
      $checked = false;
   }
  echo tep_draw_radio_field('payment', $selection[$i]['id'], $checked);
  } else {  ...

The key part in the code is the $i==0 which refers to the payment method id. This ISN’T related to the sort order of the payment modules in the Admin >> Modules >> Payment area, or some ‘name sort’ principle. Instead it just reflects the order of the modules in the database constant MODULE_PAYMENT_INSTALLED.

So if you take a look at the configuration table in your database and search for MODULE_PAYMENT_INSTALLED, your payment modules will be in a row there –
eg moneyorder.php,transfer.php,paypal.php
Here, moneyorder will have the id = 0 (so $i == 0 to be selected by default), transfer’s id = 1, paypal’s id = 2 … etc.

So by changing the $i == 0 in the code examples above to match your payment method id, you can easily set the default payment method at checkout.

how to setup the paypal website payments standard module

The Paypal Website Payments Standard module is a basic ‘button’ type payment facility that allows websites to collect payment from Paypal and non-Paypal customers alike, via hosted pages on the Paypal server.

This post is an outline of settings that work for me using a cre loaded 6.4.1a CE version cart and the default payment module that is supplied with it. No modifications have been made to the original Cre Loaded Paypal files, which are largely based on an old oscommerce version and incorporate the Paypal IPN (Instant Payment Notification) function as well.

There are two parts to setting up the Paypal Website Payments Standard module – firstly the module itself through the admin, and secondly your Paypal account settings. It’s reasonably easy to end up with failed transactions or inventory not being adjusted for sales correctly or Paypal payments but no order in the admin etc, with different settings.

1. Check the Paypal Website Payments Standard module

 

 

  • Check the settings in the cart’s Paypal Website Payments Standard module and note the text in the images (see right) in red – I’ve found that if the settings for these particular entries aren’t as shown, the module may not work as expected.
  • Also, it is a good idea to uninstall and reinstall the module if you are experiencing problems.

2. Check your Paypal Account settings

  • Login to your Paypal account – which should be either a Business or Premier account, as this module will not work with a personal account. As mentioned above, make sure the email addresses in Paypal Website Standard module match exactly the email address used in your PP account. This is often the reason for module problems.
  • Next, go to Profile -> My Selling Tools:

Sales Tax -> Update:
None set.

Website Preferences -> Update:
Auto Return = On
Return Url = https://www.yourstore.com/checkout_process.php
Payment Data Transfer = Off
Encrypted Website Payments = Off
Paypal Account Optional = On (if you want to prevent Paypal from hassling customers into setting up a Paypal account)
Contact Telephone = Off
Express Checkout = No

Instant Payment Notifications -> Update:
Switch on IPN
Notification URL = https://www.yourstore.com/checkout_process.php

Shipping Calculations -> Update:
None set.
Tick “Click here to allow transaction-based shipping values to override the profile shipping settings listed above”

Please note the Auto Return and IPN Notification urls ARE THE SAME: both are checkout_process.php … not checkout_success.php or ipn.php etc.

If you have a Personal Paypal account you can test your settings now with a transaction. Alternatively use the Paypal Developer area and sandbox test accounts. The order should go through smoothly using either the 3-page or 1-page checkout and an IPN result should go through to your store’s email address.

For zen-cart setup try the zen-cart wiki page about setting up the Paypal Website Payments Standard module here
For oscommerce support try this forum how to setup the Paypal Website Payments Standards module here

(If you’ve tried all of the recommendations in this post and it still isn’t working, please use the contact me above for a quote.)

cre loaded epa (easypopulate) gotchas, errors and solutions

The EPA – easypopulate – function has been a feature of cre loaded carts since the mid 2000s and like many cre loaded features, is a tangled mess of old code which has resulted from additional feature ‘add-on’s over time. Here are a couple of gotchas that may be causing issues for your easypopulate uploading and their solutions:

1. Date added and date available overwritten with 1-1-1970 error
You might find that your product date_added and date_available fields get overwritten with 1-1-1970 08:00:00 which isn’t ideal.
The solution here is to make sure that when you edit the EPA upload file, you check to make sure the dates are in a correct format (and not in the default date format of your spreadsheet programme if this is what you’ve used.)

2. Missing manufacturer_name
If you are getting an internal error (500 error) after uploading an EPA (easypopulate) import file, check to see that ALL rows of the EPA include a manufacturer’s name. This is necessary because the manufacturer-related infoboxes in your side columns will break without both manufacturer_ids and manufacturers_names. See screenshot above for example.