Jump to content

Problem add tracking url in back office


jjpljjpl

Recommended Posts

Hello!
We got a problem when try add shipment tracking url in back office in section transporter.
The URL i am try to put is like this https://www.dbschenker.com/se-sv/om-oss/kundservice/spara-och-sok?language=sv&reference_type=*DWB&reference_number=@

We got error message The url field is invalid when try save. 

I'm guessing that Prestashop doesn't accept any characters in the url. How can we add characters to be accepted .alt increase the allowed length of the url if that should be the problem?

Any idea?

Link to comment
Share on other sites

  • 3 weeks later...

As the colleagues have commented it is quite strange that a url of this kind includes this type of characters.

That field to record the carrier's url uses validation isAbsoluteUrl  in 

classes/Validate.php

You can make an override of this function, or create another one but it would be necessary to overwrite the Carrier.php class as well.

With the function like this you should be able to register urls of this type.

    public static function isAbsoluteUrl($url)
    {
        if (!empty($url)) {
            return preg_match('/^(https?:)?\/\/[$~:;#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9\*]+$/', $url);
        }

        return true;
    }

 

Or save the url directly in the database, table carrier, column url

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...