|
Mals Shipping Script
Need a more advanced shipping
solution for your Mals-E cart?
Try the Paid Shipping Plug-in
for
UPS, FedEx, USPS and DHL |
If you use the
Mals-E shopping cart and have run out of zones to use in your shipping setup, you might want to try the following. Note that this process requires a basic knowledge
of Mals-E and the shipping setups, and uses the "units" field ("Shipping Units" in the OptionCart system) for its development. It also requires PHP on your site (no mySQL is
necessary.)
Please note that we are not liable for the use of
this free script and any results that might occur. Use at your own discretion and test first!
Last Updated June 21, 2004
Script Changes
June 21, 2004 - Added the
option to use prices or unit values when calculating the shipping. Also set the
system to automatically send shipping rates back to the cart if only one option
is selected with no additional fee choices.
Feb. 26, 2004 - Added the option to keep prices in the drop down box and check boxes from appearing to the customer.
Feb. 4, 2004 - Added the shipping option to display in the cart. Note that this only seems to work with carts on the
ww4 server or higher, and will only post the first 23 characters or so into the cart. Also added the ability to add multiple units per zones if desired.
Jan. 20, 2004 - Added the option to multiply by the units or use the exact shipping costs specified, determined by the
units. Also allowed free shipping to be posted.
Instructions
- Create a blank page called "shipping.php" on your web site.
- Copy and paste the following code into this new page:
- You will need to go through the code and change some of the code:
- At the top of the script, under PART 1: MALS INFO AND CURRENCY, change the Mals ID, Mals server and
currency as needed to be correct for your site. Make sure to keep all quotes, equal sign and semi colon in place.
- Next, under PART 2: UNITS PER ZONE, enter a list of the unit breaks you
want to use for your prices.
- If you want to set a certain number of units per each zone (ie. 1-5 costs $1.50 shipping per unit, 6-10
costs $1.40 per unit, 10+ costs $1.30 per unit), enter the list of unit breaks in this field. (ex. 1-5,6-10,11-99999)
- Use the format UNIT BREAK 1,UNIT BREAK 2, UNIT BREAK 3, where each unit break
is formatted as FROM UNIT #-TO UNIT #.
- Unit breaks should be separated with commas (no spaces)
- Dashes separate the start unit from the end unit.
- Do not use currency symbols.
- Choose whether you want a standard units per zone or individual unit breaks depending on the zone:
- Standard Units Per Zone: Keep the script as-is and enter a single units per zone value, which will apply
to all zones.
- Individual Units Per Zone: Set the script with additional fields: $units_per_zone1, $units_per_zone2,
$units_per_zone3, and so on, one for each of the zones.
ie.) instead of:
$units_per_zone = "1-4,5-10,11-99999";
you would use:
$units_per_zone1 = "1-3,4-6,7-99999";
$units_per_zone2 = "1-2,3-5,6-10,11-99999";
$units_per_zone3 = "1-7,8-9,10-99999";
and so on, one for each zone.
Note that you can have different numbers of unit breaks for each zone if desired. Just make sure to use the same breaks for that particular zone.
- If you use units per zone, you must use the same number of costs per zone as you have unit breaks.
- You must use consecutive numbering in your breaks without duplicating, and must cover units from 1-99999.
(In other words, don't use "2-3,5-9,8-85" because you have skipped units 1, 4 and 86-99999 and you have duplicated the 8 and 9 units)
- Next, under PART 3: SHIPPING OPTIONS, list each zone that you want to display on your site.
- You must label each with $option1, $option2, $option3, etc., where each option is numbered with a
consecutive number and you do not skip any numbers.
- You must format the zone as ZONE NAME:ZONE COST (no spaces).
- The ZONE NAME is the description your customers will see when they select a
shipping option. This description is only posted into the Mals cart when using carts on ww4 or higher, and only shows the first 23 characters or so of the
zone.
- The ZONE COST is the cost per unit of that particular zone.
- Do not use currency symbols for your costs.
- If you plan to use unit divisions (ie. 1-5 = $X shipping, 6-10 = $Y shipping, 11+ = $Z shipping, etc.),
enter a cost per unit value for each unit division, separated by a comma. (ie. $option1="My Zone:1.00,2.00,3.00";). The number of costs per unit for
each zone MUST be the same as the number of units per zone that you set up in part 2 above.
- If you want to add any additional fees to the cart (ie. rush order fees, add a catalog, etc.), enter the additional fees under PART 4:
ADDITIONAL FEES.
- Use the format FEE NAME:FEE COST (no spaces)
- Do not use currency symbols for your costs.
- Note that additional fees will show as an item in your cart and do not add to your shipping charges. These fee names will appear in your orders.
- If you'd like to use the exact dollar amounts set up in your zones, and do not want to multiply by the number of units sent to the page, enter a N under PART 5: MULTIPLY BY UNITS? (Y or N).
Otherwise, leave this as Y.
- Y - This will multiply by the total number of units sent to the page. For example:
$units_per_zone = "1-3,4-6,7-99999";
$option1 = "Shipping Zone:2.50,3.00,3.50";
$multiply_by_units = "Y";
If someone orders items with a total of 5 units, the system will multiply the number of units (5) by the total currency amount for that unit break for the
zone ($3.00) for a total of $15.00
- N - This will use the amount per zone for the unit break, without multiplying by the number of units.
For example:
$units_per_zone = "1-3,4-6,7-99999";
$option1 = "Shipping Zone:2.50,3.00,3.50";
$multiply_by_units = "N";
If someone orders items with a total of 5 units, the system will simply use the total currency amount for that unit break for the zone ($3.00) for a total of
$3.00. Note that it doesn't matter whether the customer orders 4, 5 or 6 units - the price is always going to be $3.00 for that zone.
- To set a minimum charge, enter the amount under // PART 6: MINIMUM CHARGE BEFORE ADDITIONAL FEES.
Do not include currency symbols. If this amount is set, the customer will always pay at least this amount for shipping. Note that
this minimum is set before any additional fees are set up - so it won't override any rush fees, extra delivery fees, etc.
- To set a maximum charge, enter the amount under // PART 7: MAXIMUM CHARGE BEFORE ADDITIONAL FEES.
Do not include currency symbols. If this amount is set, the customer will never pay more this amount for shipping (excluding
additional fees). Note that this maximum is set before any additional fees are set up - so it won't override any rush fees, extra delivery fees, etc.
- To set a handling charge that is applied to all orders, enter the amount under // PART 8: HANDLING CHARGE BEFORE MIN, MAX, ADDITIONAL FEES.
Do not include currency symbols. If this amount is set, the customer will always be charged this handling fee, no matter what the
units or the cost per zone. This handling fee is applied before the minimums or maximums are set, and before any additional fees are set. So if you
have set a handling charge of $15.00, but set a maximum charge of $10.00, the system will only charge $10.00 for all orders, because the maximum is calculated
after the handling charge is added.
- You can change the script to either show prices to the customers or keep them hidden. Under // PART
9: DISPLAY PRICES (Y or N), set the value to "Y" if you want to show customers the prices before the totals are posted to the cart. Or set to
"N" to only display the zones without prices. This only affects the display - it won't affect how the script operates.
- If you want to use
price values instead of units when calculating the shipping amounts,
under // PART 10: USE PRICES OR UNITS? (prices or units),
set the value to "prices". Otherwise keep it as
"units" to use the units value. NOTE:
The "prices" setting may not work on all Mals accounts!!!
Please test your script thoroughly - including recalculating prices
before submitting - before changing this setting to "prices".
- If you want to add an HTML header to the page, you can do so by adding the HTML code for the header between the
tags:
<!-- START OPTIONAL HTML HEADER //-->
<!-- END OPTIONAL HTML HEADER //-->
- If you want to add an HTML footer to the page, you can do so by adding the HTML code for the footer between the
tags:
<!-- START OPTIONAL HTML FOOTER //-->
<!-- END OPTIONAL HTML FOOTER //-->
- Once you have made all your script changes, save the page in your web site. (ie. at http://www.yoursite.com/shipping.php).
- Now, test the setup. Go to http://www.yoursite.com/shipping.php?units=5 where the value after the = sign is the
number of units you want to test. Select a shipping option from the box (just as a customer would) and select any additional fees if available. Test to make sure that
all combinations give the results you want.
- Once you are satisfied with the results, in your Mals cart setup, select Option #8 for your shipping method. In the
box below that option, enter:
To calculate shipping for this order
<a href="http://www.yoursite.com/shipping.php?{x}"><b>click here</b></a>
(Note: You can change the wording if desired.) Save the setup and test again, this time using your Mals cart to check the shipping values you received. Follow through
to complete the order. Please note: the shipping value selected in the drop down box will only post to the Mals cart if using a cart on the ww4 server or higher, and
it will only post the first 23 characters or so of that shipping value.
| Special
Setup - Wholesale Changes: If you use OptionCart Deluxe and want to
set a different shipping cost for your wholesalers, use the following
setup. Otherwise, ignore this part completely.
Say you want to set
up your cart with the following shipping costs:
Retail Customers
$0 - $25 in orders: $3.00
$25 - $85 in orders: $4.00
$85 - $125 in orders: $5.00
Over $125: FREE
Wholesale Customers:
$0 - $30 in orders: $3.50
$30 - $100 in orders: $4.50
$100 - $200 in orders: $5.50
Over $200: FREE
Set up the shipping script with the following changes:
// PART 2: UNITS PER ZONE
$units_per_zone = "0-25.00,25.01-30.00,30.01-85.00,85.01-100.00,
100.01-125.00,125.01-200.00,200.01-999999";
// PART 3: SHIPPING OPTIONS
if (isset($HTTP_COOKIE_VARS[wspass]))
{
include("inc/open.php");
$wsquery = "SELECT Discount FROM Shop_Wholesale WHERE Password='$wspass' AND Active='Yes'";
$wsresult = mysql_query($wsquery) or die ("Unable to select. Try again later.");
if (mysql_num_rows($wsresult) == 1)
$wsrow = mysql_fetch_row($wsresult);
}
if (isset($HTTP_COOKIE_VARS[wspass]) AND $wsrow[0] > 0)
{
// ENTER WHOLESALE VALUES HERE
$option1 = "Shipping:3.50,3.50,4.50,4.50,5.50,5.50,0.00";
}
else
{
// ENTER RETAIL VALUES HERE
$option1 = "Shipping:3.00,4.00,4.00,5.00,5.00,0.00,0.00";
}
// PART 4: ADDITIONAL FEES
// PART 5: MULTIPLY BY UNITS? (Y or N)
$multiply_by_units = "N";
Then change the
values to suit your needs. Essentially, you're
combining your retail and wholesale units per zone, then checking for
the wholesale cookie and discount value. If those wholesale values
exist, you'll use a different option1 price than for retail customers.
(Note: you can add $option2, $option3, $option4, etc. just underneath
$option1 in the wholesale and retail price list if you want, just as you
would in the regular non-modified script.) |
Free support for this script is not provided. However, you may post on our help forum if you would like to talk to other script users about their shipping setup through Mals.
|