Jump to content
espacious

push in cart wrong image url

Recommended Posts

Hi to all,

recently we bought Push On Cart module for our website. But i have a small problem with displaying images.

The image in fact does not show:

https://screenshots.firefox.com/PMHwZxokMa1jGr8S/dev.smartus.hr

I found out that the img url is wrong (it includes the domain name 2x) eg.:

dev.domain.com/162/xiaomi-yi-smart-car-dash-camera.jpg - the link already contains the "domain part" 

http://dev.domain.com/dev.domain.com/162/xiaomi-yi-smart-car-dash-camera.jpg - when inspecting the link the domain is duplicated

 

I have access to all files and database, i know a bit of php but i couldnt find how to correct this error.

The error is present on 1.6.x and 1.7.x versions.

What i want is remove the domain part from the link and let PS add the domain part.

I think is somwhere here the error:

$link = $context->link;

        $image_type = ImageType::getImagesTypes();

        if (!empty($images[0]['id_image']))

        {

            if (Configuration::get('PS_LEGACY_IMAGES'))

                $image_link = Tools::getShopDomain(true).'/img/p/'.(int)$p_id.'-'.$images[0]['id_image'].'-large.jpg';

            else

                $image_link = $link->getImageLink($link_rewrite[0]['link_rewrite'], $images[0]['id_image'], $image_type[0]['name']);

 

Share this post


Link to post
Share on other sites

Ok i found a solution, or a way to solve my problem please advice me if i'm wrong.

I modifyed /classes/Link.php directly, as in the override folder there was already some Link.php (override).

So what i modifyed: in Links.php i added another function, practicaly i copied the "public function getImageLink"

and make this change in the last line of that function.

from this:

return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path;

to this:

return $uri_path;

For any further asisstance dont hesitate to contact me. 

Share this post


Link to post
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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More