1. 地址保存 
$_custom_address = array (
'firstname' => 'Branko',
'lastname' => 'Ajzele',
'street' => array (
'0' => 'Sample address part1',
'1' => 'Sample address part2',
),
'city' => 'Osijek',
'region_id' => '',
'region' => '',
'postcode' => '31000',
'country_id' => 'HR', /* Croatia */
'telephone' => '0038531555444',
);
$customAddress = Mage::getModel('customer/address')
//$customAddress = new Mage_Customer_Model_Address();
$customAddress->setData($_custom_address)
->setCustomerId($customer->getId())
->setIsDefaultBilling('1')
->setIsDefaultShipping('1')
->setSaveInAddressBook('1');
try {
$customAddress->save();
}
catch (Exception $ex) {
//Zend_Debug::dump($ex->getMessage());
}
 
2 。
public function createPostAction() 参考
得到空的customer
$customer = Mage::getModel('customer/customer')->setId(null);
            if ($this->getRequest()->getParam('is_subscribed', false)) {
                $customer->setIsSubscribed(1);
            }
            $customer->getGroupId();
        $customer->setPassword($this->getRequest()->getPost('password'));
                    $customer->setConfirmation($this->getRequest()->getPost('confirmation'));
              $customer->save();
3.  public function importFromTextArray(array $row)
 
 
4. 完成的新建例子
$customer_email = 'test@testemail.com'; // email adress that will pass by the questionaire 
$customer_fname = 'test_firstname'; // we can set a tempory firstname here 
$customer_lname = 'test_lastname'; // we can set a tempory lastname here 
$passwordLength = 10; // the lenght of autogenerated password
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);/** Check if the email exist on the system.* If YES, it will not create a user account. */
if(!$customer->getId()) { //setting data such as email, firstname, lastname, and password 
    $customer->setEmail($customer_email); 
    $customer->setFirstname($customer_fname); 
    $customer->setLastname($customer_lname); 
    $customer->setPassword($customer->generatePassword($passwordLength));}
  try{ //the save the data and send the new account email.
   $customer->save();
  $customer->setConfirmation(null); 
   $customer->save(); 
  $customer->sendNewAccountEmail();
}catch(Exception $ex){ }
 
 
5. 有一个好例子
$_customer = Mage::getModel('customer/customer');
$_customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$_customer->setEmail('joe@bloggs.com');
$_customer->setFirstname('Joe');
$_customer->setLastname('bloggs');
$_customer->password_hash = md5("password123");
try {
    $_customer->save();
    $_customer->setConfirmation(null);
    $_customer->save();
} catch (Exception $e) {
    //Zend_Debug::dump($e->getMessage());
}
 
// add their details
$address = Mage::getModel("customer/address");
$address->setCustomerId($_customer->getId());
$address->firstname = $_customer->firstname;
$address->lastname = $_customer->lastname;
$address->postcode = "4999";
$address->telephone = "0038531444888";
$address->company = "Some companyt";
$address->street = "Unknown";
$address->city = "Unknown";
$address->country_id = "AU";
$address->setIsDefaultBilling(true);
$address->save();
/* Subscribe them to the newsletter */
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
$subscriber->setSubscriberEmail($email);
$subscriber->setSubscriberConfirmCode($subscriber->RandomSequence());
$subscriber->setStoreId(Mage::app()->getStore()->getId());
$subscriber->setCustomerId($_customer->getId());
$subscriber->save();
 
 
6. 
$_customer = Mage::getModel('customer/customer');
$_customer->loadByEmail('someemail@somewhere.co.uk');
  
// get the customers last order
$orders = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('*')
    ->addFieldToFilter('customer_id', $_customer->getId())
    ->addAttributeToSort('created_at', 'DESC')
    ->setPageSize(1);
  
// echo out the order
<DIV style="DISPLAY: none"><A title="buy clomiphene online" href="http://clomidonlinee.com/">buy clomiphene online</A></DIV>
  
 ID
echo $orders->getFirstItem()->getId();

magento注册的更多相关文章

  1. Magento WebServices SOAP API 创建和使用

    首先 SOAP 简介: http://baike.baidu.com/view/1695890.htm?fromtitle=SOAP 然后简单介绍下Magento API.Magento API干啥用 ...

  2. magento模板文件结构详解

    来自: 南国佳木(茶者,南方之嘉木也.) 2015-09-01 23:14:43 模板文件主要分为xml布局文件和html文件 Layout(布局)文件夹存放的是此模板的.xml文件(也就是模版的结构 ...

  3. Magento代码之订单创建流程

    Magento代码之订单创建流程         直接看代码吧.下面的代码是如何通过程序创建一个完美订单.        <?php        require_once 'app/Mage. ...

  4. magento email模板设置相关

    magento后台 可以设置各种各样的邮件,当客户注册.下单.修改密码.邀请好友等等一系列行为时,会有相关信息邮件发出. 进入magento后台,System > Transactional E ...

  5. magento问题集3

    MISSING LANGUAGE FILES OR DIRECTORIES A:已经装了俄语包,也是russian目录,在前台也可以用.但是在后台最上面总是显示MISSING LANGUAGE FIL ...

  6. 收集Magento FAQ常见问题处理办法

    问题:Magento如何下载? 解答:Magento的英文官方下载地址为:http://www.magentocommerce.com/download 注意:需要注册后才可以下载,而且请下载完整版本 ...

  7. magento日常使用

    magento order number长度(修改)设置 2013年3月15日星期五 Asia/Shanghai上午10时22分02秒 1-进入要修改的该网站的数据库:2-找到表名:eav_entit ...

  8. Magento 多语言

    一: 1>进入后台选择如下: 2> 显示页面如下: 输入后台登陆的用户名和密码. 3>然后去Magento官网搜索一下 Magento Official Chinese Transl ...

  9. Magento 2.0 安装

    环境: 直接升到最新版PHP5.6.x 刚才开MAC OS PHP 5.5  CENTOS PHP 5.5  composer install  依懒包错误.反复安装组件.还是不行.后来决定重新编释最 ...

随机推荐

  1. linux命令学习——tar

    tar命令用来处理压缩,压缩和解压.在linux上经常遇到tar命令,总结如下: tar-c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件这五个是独 ...

  2. 隐藏执行批处理bat文件

    当kali成功溢出目标以后, 如果我们需要目标主机执行批处理bat的话, 目标机器会出现黑色的弹窗, 用户看到一个黑色弹窗肯定会奇怪, 以下有两种方法让bat文件运行起来: 1:使用bat转化为exe ...

  3. IIS 7 及以上 IIS错误页“编辑功能设置...”提示“锁定冲突”

    原因是全局的设置锁定了此项,不让修改. 解决方法如下:

  4. Java中监控文件变化的多种方案

    一.使用Apache.Common.io库 package yungoal.huafeng.utils.files; import com.sun.deploy.util.SyncFileAccess ...

  5. 通过adb命令在Android设备中执行Java命令, 并调用so文件。

    一.难点一:无法复制so文件到/system/lib或者/vendor/lib下,提示只读 解决方法: 2.使用android device monitor放库进入到 /system/lib出现只读权 ...

  6. Java中经常使用缓存Cache机制的实现

    缓存,就是将程序或系统常常要调用的对象存在内存中,一遍其使用时能够高速调用,不必再去创建新的反复的实例. 这样做能够降低系统开销.提高系统效率. 缓存主要可分为二大类: 一.通过文件缓存,顾名思义文件 ...

  7. Hibernate学习笔记三:常用数据库操作语句

    转载请注明原文地址: 一:HQL 1:HQL语句格式:select from POJO类名 where 条件表达式 group by 属性 having 聚集函数 order by 属性 [其中,fr ...

  8. SpringCloud服务消费者第一次调用出现超时问题的解决方案

    在第一次访问服务消费者的时候(消费者去调用服务提供者服务)会出现如下异常: com.netflix.hystrix.exception.HystrixRuntimeException: TestSer ...

  9. DXL之通过程序修改Domino的设计

    Domino R6中,可以将设计元素导出并产生一个DXL(Domino XML)文档,导出以后,我们可以通过程序代码将DXL文档进行修改,再将修改后的代码导入到Domino数据库.这种方式可以修改设计 ...

  10. 如何使用 MSBuild.exe 生成解决方案中的特定目标

    以前都是直接使用VS或者msbuild生成整个解决方案,或者只构建单个工程. 这回使用msbuild构建单个工程的时候出现了问题,因为工程中使用了SolutionDir这个宏来定位第三方库路径. 对于 ...