osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Trim the last 3 characters from a string?

This is a discussion on Trim the last 3 characters from a string? within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; I'm trying to modify a shipping module to add a surcharge onto the shipping cost if certain postcodes are used. ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 09-06-2004, 05:14 AM
Member
 
Join Date: May 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
seank123
Default Trim the last 3 characters from a string?

I'm trying to modify a shipping module to add a surcharge onto the shipping cost if certain postcodes are used.

For example, if someone enters: 'nn128bn' I want to add a £10 surcharge instead of the standard £7.50.

I need to trim the last 3 characters of the end to leave me with 'nn12'

Looking at the PHP documentation I have:

Quote:
if (substr($postcode, 0, -3) == 'nn12') $base = 10;
where $postcode is the postcode from the customers details (ie: $order->delivery['postcode'])


However, $base is always coming up as the default value set previously and not changing to 10

Any ideas what's wrong?? Is it the 'substr' bit or am I using the wrong variable for the postcode?

Cheers in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Admin orders - Display more characters in Model# field?? JonCloud420 osCMax v2 Features Discussion 1 10-19-2006 08:06 PM
conflicting Text Characters html and php anthon osCommerce 2.2 Installation Help 4 11-11-2004 10:35 PM
Change Manufacturer Text String ddecjc osCMax v1.7 Discussion 1 09-15-2004 07:00 AM
Warning: setlocale(): Passing locale category name as string cajivar osCommerce 2.2 Installation Help 0 06-06-2003 09:13 AM


All times are GMT -8. The time now is 11:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax