【问题标题】:Magento - Send Contact Information from Order FormMagento - 从订单中发送联系信息
【发布时间】:2013-02-27 15:56:58
【问题描述】:

我在客户的商店中使用 Magento,他们有一个他们使用的 CRM (Hubspot)。他们的要求是,当客户通过他们的一站式结账页面进行购买时,输入的联系信息也会发送到他们的 CRM。

表单操作和诸如此类的东西不是我想要的。相反,我希望有人可以概述我将如何获取他们在结账时输入的信息。我需要有一个成功页面并将代码添加到该成功页面吗?

谢谢!

【问题讨论】:

    标签: magento


    【解决方案1】:

    您可以使用app/design/frontend/base/default/template/checkout/success.phtml 页面。首先,将其复制到您自己的包和主题中。然后你可以使用这样的东西:

    $customerId = Mage::getSingleton('customer/session')->getCustomerId();
    $customerData = Mage::getModel('customer/customer')->load($customerId)->getData();
    var_dump($customerData);
    

    你应该能够从那里提取你需要的东西。

    hth!

    【讨论】:

      【解决方案2】:

      假设您正在使用他们的 REST Api @http://developers.hubspot.com/docs/methods/contacts/create_contact

      您可以将您的 api 帖子添加到 app/design/frontend/base/default/template/checkout/success.phtml(只会将信息发送给从前端而非管理员下订单的客户的 crm)

      你也可以创建一个观察者

      在 config.xml 中

          <events>
              <sales_order_place_after>
                  <observers>
                      <hubspot_create_customer_api>
                          <type>singleton</type>
                          <class>hubspotApi/observer</class>
                          <method>createCustomer</method>
                      </hubspot_create_customer_api>
                  </observers>
              </sales_order_place_after>
      

      在你的observer.php中

      class MageIgniter_HubspotApi_Model_Observer 
      {
      
          public function createCustomer($event)
          {
              //$_order = $event->getOrder();
              //$_order->getCustomerFirstname();
              print_r($_order->getBillingAddress()); //get customer billing info
              print_r($_order->getBillingAddress()->getFirstname()); 
      
             //make curl call to post info to api
             //see http://mydons.com/using-curl-functions-in-magento-way/
      
          }
      }
      

      学习如何create an custom module with an observer

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-13
        • 1970-01-01
        • 2012-10-26
        • 1970-01-01
        相关资源
        最近更新 更多