WordPress.org

Ready to get started?Download WordPress

Forums

PrestaShop Integration
[resolved] How to patch Shop.php (36 posts)

  1. ericgmbh
    Member
    Posted 1 year ago #

    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/

  2. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

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

  4. ericgmbh
    Member
    Posted 1 year ago #

    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!

  5. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. ericgmbh
    Member
    Posted 1 year ago #

    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!

  7. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  8. ericgmbh
    Member
    Posted 1 year ago #

    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

  9. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  10. ericgmbh
    Member
    Posted 1 year ago #

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

    Thank you.

  11. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

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

    François.

  12. d4b
    Member
    Posted 1 year ago #

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

  13. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    Please post in only one thread. François.

  14. frafra85
    Member
    Posted 1 year ago #

    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

  15. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  16. frafra85
    Member
    Posted 1 year ago #

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

    Any idea?

  17. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    No, if you have effectively applied the patch, it should work. Can you tell me the URL of your site please (by email).

    Thanks,
    François.

  18. frafra85
    Member
    Posted 1 year ago #

    what is your email?

  19. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    you can try contact at aytechnet.fr

  20. frafra85
    Member
    Posted 1 year ago #

    i do it

  21. frafra85
    Member
    Posted 1 year ago #

    Thanks! Now It works correctly !

  22. aytechnet
    Member
    Plugin Author

    Posted 1 year ago #

    So this topic is resolved ? Please reopen it if it is not the case...

  23. RTiss
    Member
    Posted 1 year ago #

    Hi aytechnet,
    Firstly, Thank you very much for your plugin.
    Today, I just downloaded your plugin and try to configure it. I'm not sure if I should ask you here or create a new post. I think I have a similar problem as frafra85 mentioned that the blog redirecting to the prestashop. Let me excuse my English and my knowledge of coding and configuration.

    I'm only a regular user and do not know about coding.
    Now, I have a problem about plugin configuration.

    My wordpress blog: http://relishthai.com
    My prestashop: http://store.relishthai.com

    Below are the steps I already finished.
    1) installed the plugin
    2) activated the pugin
    3) configured the store path (I put "store" and the comment said correct)
    4) put one product id in id_category=X (I used the default prestashop theme so I did not change the tpl name)
    5) add
    <div class="prestashop-sidebar"><ul class="xoxo">
    <?php dynamic_sidebar( 'hooktop-widget-area' ); ?>
    </div><!-- .prestashop-sidebar -->

    to the sidebar.php file (not sure if I understand correctly, I'm very much confused what to do)

    Now, my wordpress blog is redirect to the prestashop site after I configure the path to "store".

    I'm not sure what I have to do next.

    Could you please help me solve this problem? I think your plugin will be very much benefit to my store so I'm trying to understand how to use it.

    Thank you very much for your help in advance. Sorry if I post this message in a wrong place.

  24. RTiss
    Member
    Posted 1 year ago #

    Sorry about the redirecting. I just saw the readme.txt and reread above post again that I need to patch Shop.php. Now, the redirecting problem is solved but my blog still do not show the plugin. I try to find more information how to configure it then.

  25. winworldbcn
    Member
    Posted 1 year ago #

    Hi!
    I have the same problem, I get redirected to a 404 page, I have applied the patch.
    but still redireccionandome to prestashop with error 404

    Thank you!

    WW

  26. RTiss
    Member
    Posted 1 year ago #

    Hi winworldbcn,
    I'm not sure about your case but for mine after patching correctly the redirecting was solve. You might want to check everything again.

    Now, I give up to link the plugin because I cannot code php and javascript to link the plugin to the wordpress and store.

  27. winworldbcn
    Member
    Posted 1 year ago #

    Hi RTiss:

    Hi, I checked everything several times, and as usual, loading the wordpress page I prestashop page appears with the 404, if I look at the url the changes as follows:
    http://www.dominio.es/proves -> wordpress
    http://www.dominio.es/provabotiga -> prestashop
    http://www.dominio.es/provabotiga/proves -> url Error 404, fusion url's

    Thanks
    WW

    P.S. sorry for my little english

  28. RTiss
    Member
    Posted 1 year ago #

    Hi winworldbcn,

    I just checked my email. Now, your links are not working. Since, your store and blog locations are not the same as mine. I'm not sure about your case. You might wanna search for Error 404 coz I do not remember if I have the same error. I know only I used to have redirecting error because I did not patch the shop.php. I hope you can figure things out soon.

    Good Luck :))

  29. zbrox
    Member
    Posted 1 year ago #

    I'm having the same problem. Both installations WordPress and Prestashop are in subfolders. The patch is applied correctly, however I still get a redirect to a 404 in the Prestashop installation.
    Any ideas?

  30. winworldbcn
    Member
    Posted 1 year ago #

    Hi RTiss,

    I have applied patch de shop.php, but I have same problem....any ideas?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.