Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Pick up first part of Post code - one page checkout
 
replaya
Jr. Member
 
Total Posts:  22
Joined:  2008-07-17
 

I have come to a stand still, Im trying to retrieve the the correct shipping price according to the first part of UK Post code i.e HU1, W1 etc in one page checkout. I have noticed in the shipping section when entering a postcode, it will only bring out the correct shipping method price if that specific post code is in the table_rates.csv (number of items vs price)

so it my case no of items vs price it would look like this:

Country Region/State Zip/Postal Code # of Items Shipping Price
GBR * HU1 2SU 1 22
GBR * HU1 2SU 2 44
GBR * HU1 2SU 3 66
GBR * HU1 2SU 4 88
GBR * HU1 2SU 5 110
GBR * HU1 2SU 6 132
GBR * HU1 2SU 7 154
GBR * HU1 2SU 8 176
GBR * HU1 2SU 9 198
GBR * HU1 2SU 10 220
GBR * HU1 2SU 0 0

which means if 10 items bought from this particular post code would cost £220

I would like to just to take the first part:

GBR * HU1 1 22
GBR * HU1 2 44
GBR * HU1 3 66
GBR * HU1 4 88
GBR * HU1 5 110
GBR * HU1 6 132
GBR * HU1 7 154
GBR * HU1 8 176
GBR * HU1 9 198
GBR * HU1 10 220
GBR * HU1 0 0

So if the customer enters HU1 2SU in the shipping information field, it will hold the carry on holding the customer post code for delivery but it will also pull out the correct price according to the first part in checkout/onepage/billing.phtml

I have got it to work so it takes the first part in checkout/cart/shipping.phtml in the cart section by messing around with the regular expression

<script type="text/javascript">
    var 
coShippingMethodForm = new VarienForm('shipping-zip-form');
    
Validation.addAllThese(
     
[
           [
'validate-postcode''<?php echo $this->__('Please enter the first part of your valid Post Code. For example W1 or EC1.') ?>', function(v{
                
var element = $('postcode');
                if (
element && ('' != element.value)) {
                              
if (!element.value.match(/(^[A-Za-z]{1,2}[0-9]{1,2}$)/ )) {
                
                        
return false;
                    
}
                }
                
return true;
           
}]
    ]
    
    
);
</script>

can anyone help please

Thankyou

 
Magento Community Magento Community
Magento Community
Magento Community
 
WebShopApps
Guru
 
Avatar
Total Posts:  460
Joined:  2008-05-30
London, UK
 

Have you seen this thread?

Think it’s what you are after.  I’ve written an extension which incorporates the change discussed.  It can be found here

Rgds

Karen

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top