Php Magento代码需要精确性
我目前正在检查Magento扩展,我对一段代码有点怀疑。我想请你解释一下。我完全理解,但不是这一点:Php Magento代码需要精确性,php,magento,Php,Magento,我目前正在检查Magento扩展,我对一段代码有点怀疑。我想请你解释一下。我完全理解,但不是这一点: $customerID == " " Magento是否有这样的客户id(空间?)? 非常感谢您的回复! 这里是整个函数 public function isAvailable(Varien_Event_Observer $observer) { $event = $observer->getEvent(); $method = $
$customerID == " "
Magento是否有这样的客户id(空间?)?
非常感谢您的回复!
这里是整个函数
public function isAvailable(Varien_Event_Observer $observer)
{
$event = $observer->getEvent();
$method = $event->getMethodInstance(); //$method return the payment method
$result = $event->getResult(); //$result return true if method is active
$quote = $event->getQuote(); //$quote return var from cart
if($method->getCode() == 'custompayment' ){
//$customerGroup = $quote->getCustomerGroupId();
// $customerGroup="";
// $customerID="";
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In
if($login)
{
$customerGroup = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID
$customerID = Mage::getSingleton('customer/session')->getCustomerId(); //Get Customers ID
}
$selectedCustomerGroups = Mage::getStoreConfig('payment/custompayment/specificcustomers');
$selectedCustomerGroupsArray = explode(",", $selectedCustomerGroups);
if($selectedCustomerGroups != "" || $customerID == " "){
if(!in_array($customerGroup, $selectedCustomerGroupsArray)) {
$result->isAvailable = false;
}
}
else{
if($result->isAvailable==1){
$result->isAvailable = true;
}
}
}
由adrien54和JokiRuiz回答。据我所知,没有,但您可以查看表“customer_entity”并检查您是否有空间id。我猜他们会想测试$customerID是否为空,并错误地放置一个空间好的。我认为两者都是真的。“customer_实体”不显示任何空格。谢谢你们两位;)