Page 1 of 1

Multi-store and Payment modules (paypal as example)(SOLVED)

Posted: Thu Dec 12, 2013 9:52 pm
by Cue4cheap
Hello,

I just set up multi-store and a big surprise was I had an attemped order. It showed me a big issue.

In the paypal module I use (the payflow iframe one but redirect method) in 1.5.6 it goes through the process and send the customer to paypal for payment.
Problems:
1 - The title of the page is my main store name not the multi-store name. A bit confusing to the customer to be on one site and then see payment for the other site.
2 - If they cancel the transaction, which my customer did, they get redirected to the main store versus the multi-store. This is because the return URL info is "hard coded" in the settings you enter on your paypal account.
3 - I would suspect this holds true for the success, silent post, and error return pages because of the same reason. If you go into the paypal module it actually provides the return, error, silent post, success, URLs you are supposed to put in your service settings in you paypal account. So no matter what, it sends you to the main store because those are the URLs the module says to use.

Now I see paypal seems to allow you to embed the return, error, silent post, and success URLs in the info you pass and maybe even the display image so problem # goes away too. But it looks like someone who know how to make the urls for multi-store would have to code them into the payment module. I looked late last night but I can't find the syntax for how to make the URL to embed into the payment module code to return to the correct store. (they are fields to pass to paypal are: RETURNURL = , ERRORURL =, SILENTPOSTURL =, CANCELURL =)

If someone could point me to how to figure out the syntax for how to get which store you are on I could try and embed that info into the parameters above and test.

Mike

Re: Multi-store and Payment modules (paypal as an example)

Posted: Thu Dec 12, 2013 10:30 pm
by labeshops
Remove the return url you have set in paypal. Opencart will send the right one. It sounds like you have included your main domain url in the Paypal settings.

Re: Multi-store and Payment modules (paypal as an example)

Posted: Fri Dec 13, 2013 6:00 am
by Cue4cheap
labeshops wrote:Remove the return url you have set in paypal. Opencart will send the right one. It sounds like you have included your main domain url in the Paypal settings.
I wish that was it. I just tried it and it still has problems.
# 1 still exists. It shows the main store image (name)
#2 when I remove the cancel URL in the paypal manager the cancel button disappears so the customer can't cancel and go back to my store.
#3 In my quick testing (quick because this takes that payment module offline for both stores) I couldn't get a successful transaction so I don't know where it would send a successful transaction (if it would).

So with at least the paypal iframe module multi-store does not seem to work at all for the 2nd store.

Mike

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Dec 14, 2013 5:35 am
by Cue4cheap

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Dec 14, 2013 6:13 am
by Cue4cheap
Also - IF you follow those instructions they work. But since this thread I started for multi-store issues let me point out something. IF you have multiple store and a couple of them DO NOT have SSL certificates then I believe you run the risk of having credit card info input on your site(s) without the SSL certificates. I believe this to be a bad idea.

So what can you do???
My solution: Check for what store it is and if it is one that does NOT have a SSL certificate installed you should have it not do iframe but redirect.

Now this is a 1 minute hack attempt and then I'll have to run. One of these days I might have time to test it 100% but this is a quick attempt at a fix.
In: /catalog/controller/payment/pp_payflow_iframe.php
Find:

Code: Select all

            'SHIPTOCOUNTRY' => $shipping_country['iso_code_2'],
        );
below it add:

Code: Select all

if($this->config->get('config_store_id') == 1 ) {
$urlParams['CANCELURL'] = $this->url->link('payment/pp_payflow_iframe/pp_cancel');
$urlParams['ERRORURL'] = $this->url->link('payment/pp_payflow_iframe/pp_error');
$urlParams['RETURNURL'] = $this->url->link('payment/pp_payflow_iframe/pp_return');
$urlParams['SILENTPOSTURL'] = $this->url->link('payment/pp_payflow_iframe/pp_post');
$urlParams['TEMPLATE'] = "TEMPLATEA";
        }
This will cause paypal to redirect to their site for store ID of 1 versus being in an iframe for store 1
I KNOW this gives a warning when hitting cancel from paypal. I DO NOT KNOW if this will work with a completed transaction or if it has some other vulnerabilities but as I said this is a 1 minute hack. I have obviously not tested it 100%. Use at your own risk.

Mike

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Apr 12, 2014 1:06 am
by flywatches
Thank you for the information! I am trying to do the same thing with our store. We have a default store and then we are setting up several substores. If you hard-code the return, cancel, etc. urls, within the php, wouldnt those specific settings apply to every store since the same php is used to process orders.

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Apr 12, 2014 4:40 am
by Cue4cheap
flywatches wrote:Thank you for the information! I am trying to do the same thing with our store. We have a default store and then we are setting up several substores. If you hard-code the return, cancel, etc. urls, within the php, wouldnt those specific settings apply to every store since the same php is used to process orders.

It would IF you didn't include this check:
if($this->config->get('config_store_id') == 1 )

In this case my #1 store is the only one that has those "hard coded" into it.

Mike

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Apr 12, 2014 5:33 am
by flywatches
Excellent Mike! I think I am getting close to understanding. Did you outline this information elsewhere on the forum so I could follow and integrate?

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Sat Apr 12, 2014 7:45 am
by Cue4cheap
flywatches wrote:Excellent Mike! I think I am getting close to understanding. Did you outline this information elsewhere on the forum so I could follow and integrate?
Which information are you looking for?
If you don't know what store is what, go to system --> settings and click on "edit" for one of them. Look in the URL. You should see "&store_id=X". Use that store # in the line I listed, then it only uses the cancelurl, error url, etc for that store.

OR use <> instead of == and put in only the store you wish to have show up in an iframe. Like:
if($this->config->get('config_store_id') <> 0 ) {

This will have the iframe window shows on the main store and does a redirect on all other stores.

For me we then have the "name" of the store as: "Pay with credit or debit card" in paypal so it doesn't make people think the paypal module is tied to a specific store but just that they are seeing a general title on the top of the page.

Was that what you were looking for? Or did I not answer your question?
Mike

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Tue Apr 15, 2014 8:39 am
by flywatches
Mike,

Thanks again for the follow up. It looks if I'll have to put the PayPal issue off until I figure out how to completely configure a multistore. I am having issues with displaying banners, modules and pages on each store. I also have to decide if I'll be purchasing an multiple SSLs for each site. If not, PayPal setup should be easy to decide since I'll need (I believe) to process payments off site.

Where would I implement your suggestion above?

Re: Multi-store and Payment modules (paypal as example)(SOLV

Posted: Fri Apr 18, 2014 5:56 am
by Cue4cheap
Hmmm.... Sorry I thought I answered your last question....

In this case, as I am using paypal, you make the change in /catalog/controller/payment/pp_payflow_iframe.php

Mike