Jump to content

Disallow delivery address being a Postal Box


peterp

Recommended Posts

Hi All,

         I have seen this before but for the life of me I cannot find how we did it last time. What my client requires is that the delivery address to be only a street address and not a Postal Box address. This would have to include the subscribers as well, that is they could not have any delivery addresses that were P.O. Box type address.

I hope somebody remembers how this was done and points me in the right direction.

You help is always appreciated

best regards,

Peterp

Link to comment
Share on other sites

Hi Brian,

               After looking through some old papers I did find reference to tis but unfortunately I cannot get it to display. The showtopic number from the old cubecart forum is 18063 and this was on the 21/7/2013. I did find some references but they don't match any of the code of the current ver 6.2 which is what my client is using. If you can find this topic or update it I would love to try it out.

Thanks for the help very much appreciated.

Best Regards,

peterp

              

Link to comment
Share on other sites

Unfortunately, the "old cubecart forum" (cubecartforums.org) has gone dark. And I can't find the page of that conversation on the Wayback Machine.

If you could reproduce what notes you have, we may be able to get somewhere with it.

Link to comment
Share on other sites

Let's try this:

Assuming Foundation, in content.checkout.confirm.php, at the bottom:

Find:

<div class="hide" id="validate_terms_agree">{$LANG.account.error_terms_agree}</div>

Add after:

<div class="hide" id="validate_line1">We do not ship to PO Boxes.</div>


In 3.cubecart.validate.js:

Find:

    $.validator.addMethod("phone", function(phone, element) {
        phone = phone.replace(/\s+/g, "");
        return this.optional(element) || phone.match(/^[0-9-+()]+$/);
    }, $('#validate_phone').text());


Add after:

    $.validator.addMethod("noPOB", function(line1, element) {
        return this.optional(element) || !line1.match(/(?:P(?:ost(?:al)?)?[\.\-\s]*(?:(?:O(?:ffice)?[\.\-\s]*)?B(?:ox|in|\b|\d)|o(?:ffice|\b)(?:[-\s]*\d)|code)|box[-\s\b]*\d)/i);
    }, $('#validate_line1').text());

Find:

$("#checkout_form").validate({

Then find:

            'delivery[line1]': {
                required: true
            },

Change to:

            'delivery[line1]': {
                required: true,
                noPOB: true
            },

Foundation now squeezes CSS and javascript files into one each respective file. You will need to clear CubeCart's cache.

Force your browser to reload the page resources so that you get a fresh copy of the edited javascript file.

If the customer is not logged in, there will be a form to fill out for the Delivery address (Delivery is Billing unchecked).

In the Delivery Line1 field, enter PO Box 123 and click away. There should be a red warning strip.

Additional work is needed to do the same when creating a Delivery address in the AddressBook (may need to restrict making the checks for this to CubeCart's code). But it might be do-able in the skin's javascript.

 

Link to comment
Share on other sites

Hi Brian,

              I have found the topic 18063 data sheets unfortunately they are larger than the allowed attachment files is there some other way I could send them to you maybe a email address

best regards,

peterp

Link to comment
Share on other sites

  • 2 weeks later...

Hi Brian,

           I hope you got the email I sent to you with the pages I found on this subject. If you didn't receive them please let me know and I will resend them. If you did receive them have you been able to come up with something that will accomplish the desired result of preventing postal boxes being used in the deliver to address for unregisted customers as well as registered customers

Appreciate your thoughts on this issue

Thankyou and best regards,

Peterp

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...