访问记录的用户prestashop

访问记录的用户prestashop,prestashop,Prestashop,我是prestashop的新手,我在prestashop安装的同一主机中有一个单独的php页面,如何从该页面访问登录的prestashop用户 谢谢 正如N.Wouda告诉你的,你必须使用上下文,举例来说,以获取当前用户的电子邮件: <?php include(dirname(__FILE__) . '/config/config.inc.php'); $c = Context::getContext(); $emailOfLoggedUser = $c->customer->

我是prestashop的新手,我在prestashop安装的同一主机中有一个单独的php页面,如何从该页面访问登录的prestashop用户


谢谢

正如N.Wouda告诉你的,你必须使用上下文,举例来说,以获取当前用户的电子邮件:

<?php
include(dirname(__FILE__) . '/config/config.inc.php');
$c = Context::getContext();
$emailOfLoggedUser = $c->customer->email;
echo $emailOfLoggedUser;
?>

正如N.Wouda告诉你的,你必须使用上下文,举例来说,以获取当前用户的电子邮件记录:

<?php
include(dirname(__FILE__) . '/config/config.inc.php');
$c = Context::getContext();
$emailOfLoggedUser = $c->customer->email;
echo $emailOfLoggedUser;
?>

正如Melvita所指出的,首先需要包括config.inc.php并使用Context对象

上下文存储了什么?

这些对象始终可以通过上下文访问:

Language. Set with the customer or employee language.
Country. Default country.
Currency. Set with the customer currency or the shop's default currency.
Shop. Current shop.
Cookie. Cookie instance.
Link. Link instance.
Smarty. Smarty instance.
这些对象仅可用于客户上下文:

Customer. Existing customer retrieved from the cookie or default customer.
Cart. Current cart.
Controller. Current controller instance.
这些对象仅可用于管理员上下文:Employee。现任雇员

<?php
include(dirname(__FILE__) . '/config/config.inc.php');
$context = Context::GetContext();  //call getContext() from context class
$customer = $context->customer;    //get logged customer info
$customerName = $customer->firstname; //get user first name
$customerLastName = $customer->lastname; //get user last name
//to see all information that the context object can give you on your customer, just so a var_dump on $customer

?>    


来源:?

正如Melvita指出的,首先需要包括config.inc.php并使用Context对象

上下文存储了什么?

这些对象始终可以通过上下文访问:

Language. Set with the customer or employee language.
Country. Default country.
Currency. Set with the customer currency or the shop's default currency.
Shop. Current shop.
Cookie. Cookie instance.
Link. Link instance.
Smarty. Smarty instance.
这些对象仅可用于客户上下文:

Customer. Existing customer retrieved from the cookie or default customer.
Cart. Current cart.
Controller. Current controller instance.
这些对象仅可用于管理员上下文:Employee。现任雇员

<?php
include(dirname(__FILE__) . '/config/config.inc.php');
$context = Context::GetContext();  //call getContext() from context class
$customer = $context->customer;    //get logged customer info
$customerName = $customer->firstname; //get user first name
$customerLastName = $customer->lastname; //get user last name
//to see all information that the context object can give you on your customer, just so a var_dump on $customer

?>    


来源:?

不是通过Prestashop运行的单独PHP页面?还是在Prestashop上的一页?如果是这样,请通过
上下文
-但不清楚您想要的是客户(前台)还是员工(后台)信息。不是通过prestashop运行的!不通过Prestashop运行的单独PHP页面?还是在Prestashop上的一页?如果是这样,请通过
上下文
-但不清楚您想要的是客户(前台)还是员工(后台)信息。不是通过prestashop运行的!