Page 1 of 1
Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 8:11 am
by raptorheli
Hi,
I have just tested and the return link in the footer is redirect to account/return/add to fill inn product info for return of products
I assume this code will check if customer is logged , and redirect til login page if not logged in.
If you click on the link in the footer , you are redirected to the return page regardless if logged in or not so is seems that the condition is not working
file loctation: catalog/controller/account/return.php
public function index() {
if (!$this->customer->isLogged() ) {
$this->session->data['redirect'] = $this->url->link('account/return', '', true);
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}
Question? Is this a bug in OC 3x ? or is the code incorrect
Any advice to correct this will be appreciated
Raptorheli
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 8:22 am
by straightlight
It doesn't really seem to make sense to me either. Good point. If the customer is not logged in ... why the need to set a session data for redirection. That is a clue. If you comment out that line and retry the return page, does Opencart rather redirects straight to the login page if not logged in?
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 3:34 pm
by raptorheli
Hi,
I have just comment out the line , but it seems to have no effect so it have to be something else
file location: catalog/controller/account/return.php
class ControllerAccountReturn extends Controller {
private $error = array();
public function index() {
if (!$this->customer->isLogged() ) {
//$this->session->data['redirect'] = $this->url->link('account/return', '', true);
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}
Any idea?
Raptorheli
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 4:20 pm
by raptorheli
Hi,
I just put the following code in file: controller/account/return.php and that seem to do the job :-)
At line 223 the php code starts with: public function add() {
added this code :
$this->session->data['redirect'] = $this->url->link('account/return', '', 'SSL');
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 5:14 pm
by Burt65
raptorheli wrote: ↑Sat Oct 28, 2017 8:11 am
Hi,
I have just tested and the return link in the footer is redirect to account/return/add to fill inn product info for return of products
I assume this code will check if customer is logged , and redirect til login page if not logged in.
If you click on the link in the footer , you are redirected to the return page regardless if logged in or not so is seems that the condition is not working
file loctation: catalog/controller/account/return.php
public function index() {
if (!$this->customer->isLogged() ) {
$this->session->data['redirect'] = $this->url->link('account/return', '', true);
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}
Question? Is this a bug in OC 3x ? or is the code incorrect
Any advice to correct this will be appreciated
Raptorheli
I see what you are after, but what happen if the customer did a purchase as a guest or logged in using a social media account?
I think that's the idea behind not having to be logged in for a return as not all customers have an account in OC....
PS
What kind of Raptor do you fly? I got a 90 converted to gas...
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 7:25 pm
by raptorheli
Hi,
To be able to return a product you have already purchased something from the webshop and your order are already registered
therefor it make sense to be logged to access you order and fill out the return form based on the purchased order.
PS: I fly 30 and 90 size ...gas driven
Re: Only access to return page if logged in OC3x
Posted: Sat Oct 28, 2017 9:35 pm
by straightlight
raptorheli wrote: ↑Sat Oct 28, 2017 7:25 pm
Hi,
To be able to return a product you have already purchased something from the webshop and your order are already registered
therefor it make sense to be logged to access you order and fill out the return form based on the purchased order.
PS: I fly 30 and 90 size ...gas driven
That is the point of the first poster actually. The code indicates if the user is not logged in, then to keep a session data of the return link which, in theory, it would not be advisable since Opencart already provides the use of the backward compatibility sessions via the API. Not knowing what a remote API would do with a captured URL is definitely not a safe approach based on web site and information security added by customers. There are two links as such in the return controller file as they should rather be focused on the controller/api controllers in order to validate guests and registered customers since, in addition, the controller/api already uses a login controller to validate those transactions. Granted, this login file is particularly meant for merchants. Nevertheless, it does not prevent anyone on creating a separate one for guests, customers and affiliates..
Re: Only access to return page if logged in OC3x
Posted: Sun Oct 29, 2017 7:49 pm
by Burt65
raptorheli wrote: ↑Sat Oct 28, 2017 7:25 pm
Hi,
To be able to return a product you have already purchased something from the webshop and your order are already registered
therefor it make sense to be logged to access you order and fill out the return form based on the purchased order.
PS: I fly 30 and 90 size ...gas driven
You can purchase as guest or using a social login third party extension and OC will NOT create a Registered account for such purchases...
That's how work in OC 2.x.x.x... I didn't think OC 3.x.x.x was different and it shoudn't for the above reason.
If I chose to purchase as guest, why would I have to returned the product as a Registered Member?
I purchased as Guest and therefore I don't have an account with your shop. Same reason why you don't get rewards points if you purchase as guest...
You have no account...
PS I was not aware of 30 size gas helis... For gas I meant Zenoah engine running on unleaded, not nitro engines...
Re: Only access to return page if logged in OC3x
Posted: Sun Oct 29, 2017 8:50 pm
by straightlight
If I chose to purchase as guest, why would I have to returned the product as a Registered Member?
As described on my post above, you don't need to but neither to add a session data that does not indicate where it leads but rather to set an API from the controller/api in order to handle these types of transactions between guests, customers and affiliates with backward compatibility. This is the way to go.
Re: Only access to return page if logged in OC3x
Posted: Mon Oct 30, 2017 7:57 am
by Burt65
straightlight wrote: ↑Sun Oct 29, 2017 8:50 pm
If I chose to purchase as guest, why would I have to returned the product as a Registered Member?
As described on my post above, you don't need to but neither to add a session data that does not indicate where it leads but rather to set an API from the controller/api in order to handle these types of transactions between guests, customers and affiliates with backward compatibility. This is the way to go.
I didn't ask. If you read it properly, that's not a question! And I couldn't care less about your theory regarding how OC should handle API for those transactions. It works for my needs and I'm making money.
I understand that you have a massive need to impress your pears both on here and Github, but seriously, you may want to consider taking a rest and spend more time reading and
actually understanding the other people posts or bug report in Github for that matter... This also goes for few other members on this forum that feel they are compel to reply to every single post, sometimes by missing the marks by miles.
I know that you guys have the right intentions and that you genuinely care, but too often, you push the envelop to far...
I hope the OP understood what I was trying to convey across regarding the need to be logged in to access the return page...
I gave you my reason for why I don't need customers to be logged in for a return... You may do as you wish with this information...
Cheers
Re: Only access to return page if logged in OC3x
Posted: Mon Oct 30, 2017 8:34 am
by straightlight
I didn't ask. If you read it properly, that's not a question! And I couldn't care less about your theory regarding how OC should handle API for those transactions. It works for my needs and I'm making money.
I understand that you have a massive need to impress your pears both on here and Github, but seriously, you may want to consider taking a rest and spend more time reading and actually understanding the other people posts or bug report in Github for that matter... This also goes for few other members on this forum that feel they are compel to reply to every single post, sometimes by missing the marks by miles.
I know that you guys have the right intentions and that you genuinely care, but too often, you push the envelop to far...
I hope the OP understood what I was trying to convey across regarding the need to be logged in to access the return page...
I gave you my reason for why I don't need customers to be logged in for a return... You may do as you wish with this information...
I see so your version of this is no matter how many people posts on the forum requesting assistance should rather remain in the dark. Well, thank you for sharing that information. I guess people in the future will definitely understand why solutions can't be resolved most of the time by those rather who provides their critics to those who offers to help. Cheers as one would say!
Re: Only access to return page if logged in OC3x
Posted: Mon Oct 30, 2017 9:50 am
by Burt65
straightlight wrote: ↑Mon Oct 30, 2017 8:34 am
I see so your version of this is no matter how many people posts on the forum requesting assistance should rather remain in the dark. Well, thank you for sharing that information. I guess people in the future will definitely understand why solutions can't be resolved most of the time by those rather who provides their critics to those who offers to help. Cheers as one would say!
I was sincerely hope that you would have remain in the dark...

, but here we are, busy dribbling more crap and still incapable of reading or should say understanding...
Whatever helps you rock your boat... I got to work now... Hopefully someone may be able to help you out... we care for you...
Cheers
Re: Only access to return page if logged in OC3x
Posted: Fri Feb 09, 2018 3:20 pm
by fadichmn
I was also seaching for a solution for this and I made some edit here for the url link array.
In controller/account/return.php
Find:
Code: Select all
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('account/return/add', '', true)
);
Replace it with:
Code: Select all
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/return', '', true);
$this->response->redirect($this->url->link('account/login', '', true));
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('account/return/add', '', true)
);
}
Re: Only access to return page if logged in OC3x
Posted: Sat Feb 10, 2018 6:44 am
by straightlight
Rather than redirecting, the error/not_found controller could be called.