我正在構建prestashop目錄,但只有登錄到客戶才能看到它。這可能嗎。這將是很好,如果內置prestashop登錄用於此..任何幫助表示讚賞。僅登錄prestashop目錄
0
A
回答
1
1
這裏是我的解決方案,它的工作原理就像一個魅力,是一個非常簡單的辦法!
在類\的configuration.php(左右線114),它看起來像這樣
static public function get($key, $id_lang = NULL)
{
if ($id_lang AND isset(self::$_CONF_LANG[(int)$id_lang][$key]))
return self::$_CONF_LANG[(int)$id_lang][$key];
elseif (is_array(self::$_CONF) AND key_exists($key, self::$_CONF))
return self::$_CONF[$key];
return false;
}
它改成這樣:
static public function get($key, $id_lang = NULL)
{
//Grab access to the $cookie which is already loaded in the FrontController as global $cookie;
global $cookie;
if ($id_lang AND isset(self::$_CONF_LANG[(int)$id_lang][$key]))
return self::$_CONF_LANG[(int)$id_lang][$key];
elseif (is_array(self::$_CONF) AND key_exists($key, self::$_CONF))
//If the system is trying to find out if Catalog Mode is ON, then return the configuration setting,
//but override it with the user logon status
if($key == 'PS_CATALOG_MODE')
{
return !$cookie->logged || self::$_CONF[$key];
}
else
{
return self::$_CONF[$key];
}
return false;
}
從本質上講,我想強制系統顯示「目錄模式「,並在他登錄時關閉此功能。
我可以保證這適用於v1.4.3.0和當前版本1.4.8.2的代碼(在這篇文章的時間)沒有改變,所以它應該在那裏工作。
2
我有一個建議。您可以使用PrestaShop 1.5中的客戶組功能,並且只允許登錄的客戶查看價格。對於分組在訪客中的每個客戶,他們都會在目錄模式下看到您的網站。
2
的Prestashop 1.5解決方案:
只需上傳原始文件:
classes\controller\FrontController.php
到:
override/classes/controller/FrontController.php
接下來,命名類。最終的代碼應該是這樣的:
class FrontController extends FrontControllerCore
{
public function init()
{
parent::init();
if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password')
{
Tools::redirect('index.php?controller=authentication?back=my-account');
}
}
}
最後一步是手動刪除下列文件,以便的Prestashop是意識到被覆蓋的類(它會自動重新生成)的:
cache/class_index.php
而且voilà,在不覆蓋核心文件的情況下實現了功能。
相關問題
- 1. Prestashop的登錄API
- 2. 的Prestashop根目錄
- 3. prestashop用戶登錄集成
- 4. 的Prestashop $登錄和$ is_logged
- 5. prestashop中的程序登錄
- 6. Prestashop根目錄在本地
- 7. Prestashop無法登錄管理員
- 8. 僅過濾登錄用戶的記錄?
- 9. 登錄到活動目錄
- 10. azure活動目錄登錄
- 11. 登錄/目錄創建者
- 12. Rails僅密碼登錄
- 13. 僅搜索目錄
- 14. 僅在使用SSL進行登錄時使用SSL僅限於在登錄期間使用https登錄時
- 15. SQL登錄僅在訪問登錄頁面後纔有效
- 16. 允許在登錄時僅登錄一個用戶
- 17. Android登錄活動僅在啓動時顯示Google登錄
- 18. 僅限Facebook登錄按鈕(不允許新用戶登錄)
- 19. 僅用於代理(ssh-D)登錄的登錄shell?
- 20. Prestashop - 錯誤:「安裝」目錄不存在
- 21. 「登錄」 或 「登錄」 或 「登錄」
- 22. PHP單點登錄活動目錄
- 23. 無法登錄或寫入WebDAV目錄
- 24. 活動目錄登錄報告
- 25. 限制子目錄登錄用戶
- 26. 通過活動目錄登錄
- 27. 單點登錄在虛擬目錄
- 28. 如何從FTP登錄目錄
- 29. 註冊後登錄的目錄
- 30. .htaccess登錄不存在的目錄?
這可能工作其昂貴,雖然:([鏈接](http://www.presto-changeo.com/en/prestashop-modules/30-private-shop.html) – rashid 2012-04-10 07:47:57