Day: December 10, 2015

Magento: Mage::getResourceModel, Mage::getModel 和 Mage::getSingleton() 的区别 when to use Mage::getResourceModel, Mage::getModel and Mage::getSingleton()

Perfect differece with example for getsingleton and getmodel. Mage::getSingleton() Mage::getSingleton() will first check if the same class instance exists or not in the memory. If the instance exists then it will return the same object from the memory. So Mage::getSingleton() is faster than Mage::getModel(). Example $product1 = Mage::getSingleto… Read More

Magento: 获取客户信息 Get Customer’s Full Name, First Name, Last Name and Email Address

1.  获取已登录客户信息 // Check if any customer is logged in or not if (Mage::getSingleton('customer/session')->isLoggedIn()) { // Load the customer's data $customer = Mage::getSingleton('customer/session')->getCustomer(); $customer->getPrefix(); $customer->getName(); // Full Name $customer->getFirstname(); // First Name $cu… Read More

Magento: 获取商店名称及邮件地址 Get Store Email Addresses

General Contact /* Sender Name */ Mage::getStoreConfig('trans_email/ident_general/name'); /* Sender Email */ Mage::getStoreConfig('trans_email/ident_general/email'); Sales Representative /* Sender Name */ Mage::getStoreConfig('trans_email/ident_sales/name'); /* Sender Email */ Mage::getStoreConfig('trans_email/ident_sales… Read More

Magento: 客户登陆验证 How magento store password and validate password

Magento uses MD5 and salt algorithems to store password for customer as well admin user. How magento create encrypted password Magento create encrypted password with, Mage::getModel('core/encryption')->decrypt($password); Here is the logic of decrypt($password) function, $password = "12345678"; $salt = "at"; $encyPasswod = md5($salt.$pa… Read More