WordPress.org

Support

Support » Plugins and Hacks » [Resolved] How to patch Shop.php

[Resolved] How to patch Shop.php

  • Hello,

    Looks like a great plugin nut I struggle to make it work.
    Could you please elaborate a bit more on patching the Shop.php file.
    I get the conflict that I cannot run my WP site instead it shows my prestashop. Just tried to do this:

    --- classes/shop/Shop.php.orig        2013-01-07 09:18:32.000000000 +0100
    +++ classes/shop/Shop.php       2013-01-07 09:25:26.000000000 +0100
    @@ -368,6 +368,9 @@
                            if (!Validate::isLoadedObject($default_shop))
                                    throw new PrestaShopException('Shop not found');
    
    +                       if (defined('PRESTASHOP_INTEGRATION_VERSION')) {
    +                               $shop = $default_shop;
    +                       } else {
                            $params = $_GET;
                            unset($params['id_shop']);
                            if (!Configuration::get('PS_REWRITING_SETTINGS'))
    @@ -388,6 +391,7 @@
                            }
                            header('location: '.$url);
                            exit;
    +                       }
                    }
            }

    but it doesn’t work or I do it in a wrong way could you please tell me what the `— classes/shop/Shop.php.orig 2013-01-07 09:18:32.000000000 +0100
    +++ classes/shop/Shop.php 2013-01-07 09:25:26.000000000 +0100
    @@ -368,6 +368,9 @@` means?

    http://wordpress.org/extend/plugins/prestashop-integration/

Viewing 15 replies - 1 through 15 (of 35 total)
  • Plugin Author aytechnet
    Member

    @aytechnet

    Hello,

    This is a patch made using diff, you can apply it by invoking the patch command (provided you have a shell access to your hosting) or by patching it by hand : the line begining with a + need to be added, the first number after @@ indicates the line number, you should recognize the other lines.

    François.

    Plugin Author aytechnet
    Member

    @aytechnet

    Please do not forget to mark it resolved if this is the case !

    Hi,

    Thanks a lot, but this doesn’t help in my case.
    I’m confident that I do it right but somehow its brakes the page (without redirecting to the shop). Any idea why this happens?

    Thanks!

    Plugin Author aytechnet
    Member

    @aytechnet

    Hi,

    Do you created a /blog (or similar) directory in your PrestaShpop base installation directory ? or the inverse (a /shop in your WordPress base installation directory ?

    François.

    Hi,

    both my blog and prestashop have separate sub-folders on my server:

    http://www.website.com/test
    http://www.website.com/shop

    later I’ll be moving the website probably into the root directory of the server.

    Your suggestion is that this structure is not sufficient?

    Thank you for the help!

    Plugin Author aytechnet
    Member

    @aytechnet

    Bonjour,

    Generally, the blog is on / and the shop /shop (for example) or the shop in / and the blog in /blog.

    You can of course put each software in a separate directory, but what do you to be displayed in / ? maybe a redirection to one of the homepage of one software ?

    For your configuration, you should configure PrestaShop Integration with relative path = ../shop and you should apply the patch above to avoid the redirection.

    François.

    Indeed, currently on / is an old site which will be replaced soon.

    – This is what I’m trying to do, I already set the path to ../shop
    but the patch part doesn’t work.

    Thanks

    Plugin Author aytechnet
    Member

    @aytechnet

    Ok, there could be another “bug” in PrestaShop trying to redirect the page, which has not been detected by me.

    I can investigate provided you have SSH access : please mail me to contact at aytechnet.fr for asking my SSH public key you will have to put in your .ssh/authorized_keys

    Thanks.
    François.

    Hi, I will connect you to a developer specialist on my side
    because I cannot configure SSH access myself.

    Thank you.

    Plugin Author aytechnet
    Member

    @aytechnet

    Hi, did you manage to fix your problem ? Can you update this thread please ?

    François.

    Pictures do not work, plugin sets the path for this from the blog and should leave stores path

    Plugin Author aytechnet
    Member

    @aytechnet

    Please post in only one thread. François.

    Hi and excuse for my poor english.

    I have followed your step and instructions to patch Shop.php.

    This is now my file (part of it):

    // Hmm there is something really bad in your Prestashop !
    				if (!Validate::isLoadedObject($default_shop))
    					throw new PrestaShopException('Shop not found');
    if (defined('PRESTASHOP_INTEGRATION_VERSION')) {
        $shop = $default_shop;
        } else {
    				$params = $_GET;
    				unset($params['id_shop']);
    				if (!Configuration::get('PS_REWRITING_SETTINGS'))
    					$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().'index.php?'.http_build_query($params);
    				else
    				{
    					// Catch url with subdomain "www"
    					if (strpos($default_shop->domain, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $default_shop->domain
    						|| $_SERVER['HTTP_HOST'] === 'www.'.$default_shop->domain)
    						$uri = $default_shop->domain.$_SERVER['REQUEST_URI'];
    					else
    						$uri = $default_shop->domain.$default_shop->getBaseURI();
    
    					if (count($params))
    						$url = 'http://'.$uri.'?'.http_build_query($params);
    					else
    						$url = 'http://'.$uri;
    				}
    				header('location: '.$url);
    				exit;
    			}}
    		}

    But it doesn’t work.

    WordPress (in root) redirect me in prestashop (subdirectory).

    Why ? Could you help me?
    Thanks

    Plugin Author aytechnet
    Member

    @aytechnet

    Hi,

    If you use a recent browser it could be normal : make sure any cache are cleaned (especially redirection cache) as 301 redirection may be cached.

    François.

    it’s not a cache problem, because if i deactivate the plugin the root directory works correctly.

    Any idea?

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘[Resolved] How to patch Shop.php’ is closed to new replies.