Post by mithunvijay » Mon Nov 13, 2017 12:24 am

Hi,

I am setting up a Version 2.0.1.1 Opencart shop.

As I do not want users to be able to access site without login, I wish to force a customer to login before they can view any page of the site.

Any tips on how to achieve this?

MD
Last edited by mithunvijay on Mon Nov 13, 2017 3:09 pm, edited 2 times in total.

Newbie

Posts

Joined
Fri Jan 07, 2011 2:47 am

Post by IP_CAM » Mon Nov 13, 2017 11:46 am

Well, this one should do, I assume:
FORCE LOGIN free, OC v.2.0.0.0, 2.0.1.0, 2.0.1.1, 2.0.2.0, 2.0.3.1, 2.1.0.1:
https://www.opencart.com/index.php?rout ... n_id=24298
Image
But it's a VqMod, and if you like to use it as OcMod, you should use this copy
in OcMod Format below, just name it to:
force_customer_login.ocmod.xml and upload it by use of the Extension Installer.
Then, reset/clear out the OCMod Cache, also VqModCache, if exist, and try it out!
Good Luck! (untested, I have no running OC-2!) ;)
Ernie
---

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[Force_Customer_Login]]></name>
<code><![CDATA[Force_Customer_Login]]></code>
<version><![CDATA[2.x]]></version>
<author><![CDATA[nailaserwar@gmail.com]]></author>
<file path="catalog/controller/common/header.php">
<operation>
<search><![CDATA[function index()]]></search>
<add position="after"><![CDATA[
	//Q: Force Customer Login
	$match = false;
	if (!empty($this->request->get['route'])) {
	$skip = array(
	'logout',
	'information/contact',
	'forgotten',
	'login',
	'register',
	);

	foreach ($skip as $s) {
	if (strpos($this->request->get['route'], $s) !== false) {
	$match = true;
	break;
	}
	}
	}

	if (!$match) {
	if (!$this->customer->isLogged()) {
	$this->response->redirect($this->url->link('account/login'));
	}
	}
]]></add>
</operation>
</file>
</modification>
other paid Mods:
https://www.opencart.com/index.php?rout ... load_id=42
---
PS: VqMod to OcMod Changes can also be made here, just to mention it! :D
http://dyisol.com/vqmod-to-ocmod-conversion-tool.php

Ernie's OpenCart v.1.5.6.5 LIGHT + OpenShop Admin v.1.75 Test Sites
http://www.ebikes.li - http://www.evelo.li - http://www.openshop.li
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mithunvijay » Mon Nov 13, 2017 3:06 pm

Dear Nailaserwar,

It's perfectly working for me.

Thanks a lot.

Regards,
MD

Newbie

Posts

Joined
Fri Jan 07, 2011 2:47 am

Post by mithunvijay » Thu Nov 16, 2017 7:18 pm

Hello,

I am forcing the user to login first to view site hows subscribe our services but I need one product page to be unlocked from login to paid and get access.

Idea is instead of register button we will add product button to purchase the services after that only user can access site. For paid user will are managing customer approval function.

Can you help me for the same.

Regards,
Mithun Deshmukh

Newbie

Posts

Joined
Fri Jan 07, 2011 2:47 am
Who is online

Users browsing this forum: No registered users and 21 guests