force login for full site like page

Dear all,

Just trying to make a private shopping club with cs-cart vs 2.2.3 Also there is an option both category and product page blocking as per user group (Professional Edition)

but when i block such category, or product it shows a 404 error.

But I want this redirect goes to custom login page in place of 404 error so that user can understand this are available for sign in user.



May be this can be done with login popup by jquery like so many site does. Thanks in advance for any kind of help.

Hello, titas9x!



Please open file “products.php” in the folder with your installed cs-cart, here is the directory (for 2.2.3 version) cscart/pro/223/controllers/customer/products.php



Find this part of code:

// View product details
//
} elseif ($mode == 'view') {

$_REQUEST['product_id'] = empty($_REQUEST['product_id']) ? 0 : $_REQUEST['product_id'];
$product = fn_get_product_data($_REQUEST['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true, ($auth['area'] == 'A' && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'preview'));

if (empty($product)) {

return array(CONTROLLER_STATUS_NO_PAGE);




replace the line return array(CONTROLLER_STATUS_NO_PAGE); with the line return array(CONTROLLER_STATUS_REDIRECT, "auth.login_form?return_url=" . urlencode(Registry::get('config.current_url')));



It must help.



Best regards, Alt-team

[quote name=‘Alt-team’ timestamp=‘1323072418’ post=‘127268’]

Hello, titas9x!



Please open file “products.php” in the folder with your installed cs-cart, here is the directory (for 2.2.3 version) cscart/pro/223/controllers/customer/products.php



Find this part of code:

// View product details<br />
//<br />
} elseif ($mode == 'view') {<br />
<br />
	$_REQUEST['product_id'] = empty($_REQUEST['product_id']) ? 0 : $_REQUEST['product_id'];<br />
	$product = fn_get_product_data($_REQUEST['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true, ($auth['area'] == 'A' && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'preview'));<br />
<br />
	if (empty($product)) {<br />
	<br />
		return array(CONTROLLER_STATUS_NO_PAGE);
```<br />
<br />
replace the line ```php
return array(CONTROLLER_STATUS_NO_PAGE);
``` with the line ```php
return array(CONTROLLER_STATUS_REDIRECT, "auth.login_form?return_url=" . urlencode(Registry::get('config.current_url')));
```<br />
<br />
It must help.<br />
<br />
Best regards, Alt-team<br />
[/quote]<br />
 <br />
Many Thanks for your help but sorry to say I am not succeed <img src="upload://2gefrk5yIQmBF7b3nb7uvIojpeG.gif" class="bbc_emoticon" alt=":("> here is my code by the I am using cs cart 2.2.3 professional not the community edition can you confirm the code here is mine. <br />
<br />
// View product details<br />
//<br />
} elseif ($mode == 'view') {<br />
<br />
	$_REQUEST['product_id'] = empty($_REQUEST['product_id']) ? 0 : $_REQUEST['product_id'];<br />
	$product = fn_get_product_data($_REQUEST['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true, ($auth['area'] == 'A' && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'preview'));<br />
<br />
	if (empty($product)) {<br />
		/*return array(CONTROLLER_STATUS_NO_PAGE);*/<br />
		/* edit by me to redirect 404 error to login page for block category*/<br />
		return array(CONTROLLER_STATUS_REDIRECT, "auth.login_form?return_url=" . urlencode(Registry::get('config.current_url')));<br />
		/*upto here */<br />
	}

Dear, titas9x,



the changes you have made are correct. Please check if you have set user groups and assigned products to your user groups.



Best regards, Alt-team