本文整理汇总了PHP中mage::getSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP mage::getSingleton方法的具体用法?PHP mage::getSingleton怎么用?PHP mage::getSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mage
的用法示例。
在下文中一共展示了mage::getSingleton方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$customerId = mage::getSingleton('customer/session')->getId();
$customer = mage::getModel('customer/customer')->load($customerId);
if (is_object($customer) || $customer->getId()) {
$this->_customer = $customer;
}
}
示例2: canSave
/**
* Can Save Enabled
* @return string
*/
public function canSave()
{
$cansave = mage::getStoreConfig('payment/pinpayments/can_save');
$isLoggedIn = mage::getSingleton('customer/session')->isLoggedIn();
if ($cansave && $isLoggedIn) {
return true;
}
return false;
}
示例3: getAction
/**
* Add product to shopping cart action
*/
public function getAction()
{
try {
if (!$this->getRequest()->isPost() && !mage::getSingleton('customer/session')->isLoggedIn()) {
return;
}
$result = array();
$data = $this->getRequest()->getPost('payment', array());
if ($data['method'] != 'pinpayments') {
return;
}
$pinCustomerModel = mage::getModel('pinpayments/customer');
$cardToken = array('response' => $pinCustomerModel->getCustomerTokenCard());
$this->getResponse()->setHeader('Content-type', 'application/json');
$this->getResponse()->setBody(json_encode($cardToken));
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例4: getStage1FormData
/**
* @return array
*/
public function getStage1FormData()
{
$session = mage::getSingleton('core/session');
return $session->getEsendexSmsStage1FormData();
}