初探OroCRM和捆绑扩展

CRMs are a tricky business. What some devs consider to be “just log everything about the user” apps, others know to be incredibly advanced and convoluted business apps that not only monitor your interactions with the user, but improve both your communication with them and their experience with you – without either of you knowing that explicitly.

CRM是一项棘手的业务。 有些开发人员认为是“仅记录有关用户的所有内容”应用程序,而其他开发人员则认为它们是令人难以置信的高级且复杂的业务应用程序,它们不仅监视您与用户的互动,而且改善了您与用户的交流以及与您的体验–你们两个都清楚地知道这一点。

什么是CRM? (What’s a CRM?)

Customer Relationship Management apps are often underrated and underused, and far too frequently “included” in the base of a company’s app. If you’ve ever worked in an office cubicle for a large company doing menial work day in day out, chances are you’ve had the company’s (ancient Java) app running in front of you on Windows XP, and if something important about a customer you were just talking to came up, it would be marked in a silly comment box next to their name in an obscure corner of the screen, if that.

客户关系管理应用程序经常被低估和使用不足,并且过于频繁地“包含”在公司应用程序的基础中。 如果您曾经在一家大型公司的办公室隔间工作过,每天都在做一些琐碎的工作,那么您可能已经在Windows XP上运行了该公司的(古老的Java)应用程序,并且您刚要与之交谈的客户出现在屏幕上一个隐蔽的角落,他们旁边的名字旁边便是一个愚蠢的注释框,如果有的话。

CRM is much more than what you’re usually lead to believe – it’s not just semi-relevant and subjective information about a person you once did business with – it’s a collection and collation of all the knowledge about your interactions, and a presentation of all the parameters that statistically help you gain the favor of your correspondent.

CRM远非您通常想像的那样-不仅仅是与您曾经与之打过交道的人的半相关和主观信息-它是对与您互动的所有知识的收集和整理,以及所有内容的展示统计上可以帮助您赢得通讯员青睐的参数。

OroCRM (OroCRM)

Though the CRM field of the PHP world isn’t madly ripe, the recent flurry of developments from Oro had my interest piqued enough to make me take a look. OroCRM is a multi-language CRM built on PHP 5.4+ with the Symfony framework. It’s a behemoth in its own right, and is tuned nicely for cooperation with the Oro Platform, a business application skeleton you can use to build your own custuom business apps that take advantage of the data OroCRM provides. That’s a bit much for this piece, though, so we’ll just take a look at OroCRM this time. Note, however, that an OroCRM installation brings with itself an underlying instance of the Oro Platform, which it is based upon.

尽管PHP世界的CRM领域还不成熟,但是Oro最近的一连串发展吸引了我的兴趣,足以让我看看。 OroCRM是基于Symfony框架,基于PHP 5.4+构建的多语言CRM。 它本身就是一个庞然大物,并且可以与Oro平台进行很好的协作,Oro平台是一种业务应用程序框架,您可以使用它来构建自己的自定义业务应用程序,以利用OroCRM提供的数据。 不过,这笔钱多少钱,所以这次我们只看一下OroCRM。 但是请注意,OroCRM安装附带了Oro Platform的基础实例。

OroCRM was also announced on the Symfony2 blog, so give it a read if you’re interested in its youth – it was only four months ago.

OroCRM也已在Symfony2博客上宣布,因此如果您对它的青春感兴趣,请仔细阅读 -仅四个月前。

Among other features, OroCRM boasts with their marketplace for third party plugins and extensions, their customer segmentation, and import of data from various established tools like Magento. Let’s see how it stacks up in a locally deployed demo app.

OroCRM拥有众多功能,其中包括第三方插件和扩展的市场,客户细分以及从各种成熟工具(如Magento)的数据导入。 让我们看看它如何在本地部署的演示应用程序中堆叠。

正在安装 (Installing)

Installing OroCRM is relatively simple. The steps are covered well in their Github README, or you can follow our detailed guide on getting it up and running with Vagrant, so hop through those if you’d like to follow along with your own installation.

安装OroCRM相对简单。 他们的Github自述文件中很好地介绍了这些步骤,或者您可以按照我们的详细指南来使用Vagrant进行安装和运行,如果希望按照自己的安装步骤进行操作,请跳过这些步骤。

演示版 (Demo)

As soon as we install the app (the Demo app can also be tried out at demo.orocrm.com), we’re greeted by a modern looking dashboard with random information regarding sales.

一旦我们安装了该应用程序(也可以在demo.orocrm.com上试用该演示应用程序),就会看到外观时尚的仪表板,其中包含有关销售的随机信息。

alt

As someone who’s built internal CRMs, I’ll focus on the technical side more than the actual business side when looking at this application, but a thorough business review and a comparison with the competition on some other channel of ours is not out of the question. For an actual user guide, see here.

作为构建内部CRM的人,在研究此应用程序时,我将重点放在技术方面,而不是实际业务方面,但是进行全面的业务审查以及与我们其他渠道的竞争者进行比较并不是没有问题的。 。 有关实际的用户指南, 请参见此处

The first thing I noticed is how smoothly responsive the theme is. Even on this chart-rich screen, resizing the browser window did little to cause horizontal scrollbars and immediately placed the dash elements one under the other, instead of distributing them into two columns as is the default in full screen mode (image above is single column, image below is double).

我注意到的第一件事是主题响应的流畅程度。 即使在这个图表丰富的屏幕上,调整浏览器窗口的大小也几乎不会导致水平滚动条,并立即将破折号元素一个放置在另一个滚动条下,而不是像全屏模式中的默认设置那样将它们分布到两列中(上图是单列) ,以下图片是双图)。

alt

If you try clicking on “Sent” in the “Recent emails” frame, you can see an email there. The email can be previewed and clicking the recipient’s name will lead you to their exhaustive user screen:

如果您尝试单击“最近的电子邮件”框中的“已发送”,则可以在此处看到电子邮件。 可以预览电子邮件,单击收件人的名字将带您进入他们详尽的用户屏幕:

alt

As someone who has had to tie an in-house CRM to regular IMAP inboxes with custom header support for a volume of ten million emails per month, I can appreciate this feature – I’m fully aware of how difficult it is to build it well without confusing your users (your company’s employees, primarily).

作为必须将内部CRM与具有自定义标头支持的常规IMAP收件箱绑定在一起的人,每月必须接收一千万封电子邮件,我很感激此功能–我完全意识到构建好它有多么困难而不会混淆您的用户(主要是您公司的员工)。

Note also that it’s all built with ajax – no page reloads are happening here, and this makes the entire experience that much smoother.

还要注意,它们都是用ajax构建的–这里没有页面重新加载发生,这使整个体验变得更加流畅。

You can easily create dashboard, user groups and roles, and so much more – just explore the options above. But what if we want to extend this app? What if we need to tweak it a bit?

您可以轻松创建仪表板,用户组和角色,以及更多其他功能-只需浏览以上选项即可。 但是,如果我们要扩展此应用程序怎么办? 如果需要微调怎么办?

延伸 (Extending)

OroCRM, being a Symfony app, is also extended with bundles – tweaking existing ones or building new ones, everything goes.

OroCRM是Symfony应用程序,还通过捆绑软件进行了扩展–调整现有软件或构建新软件,一切顺利。

It’s important to note that due to this heavy tie-in with Symfony, one should be more than familiar with Symfony and the way it works. This might be discouraging to some newcomers, seeing as Symfony is a very complex framework.

需要特别注意的是,由于与Symfony的紧密联系,人们不仅仅应该熟悉Symfony及其工作方式。 鉴于Symfony是一个非常复杂的框架,这对于某些新手来说可能会令人沮丧。

创建一个新的捆绑包 (Creating a New Bundle)

Bundles are created just like in regular Symfony apps. If you’d like to follow along, you can do this with the Symfony console:

与常规Symfony应用程序一样,创建捆绑包。 如果您想继续,可以使用Symfony控制台执行此操作:

php app/console generate:bundle

The console will ask for input on a variety of information. I gave it the namespace of SitePoint/Bundle/TestBundle. I used the default suggestions for all other inputs, and only said no to the last two items: automatically updating the kernel, and automatically updating the routing. Oro has a special way of enabling bundles, and it’s important to answer “no” to these questions.

控制台将要求输入各种信息。 我给它命名为SitePoint/Bundle/TestBundle 。 我对所有其他输入使用了默认建议,仅对最后两项表示“否”:自动更新内核,以及自动更新路由。 Oro具有启用捆绑包的特殊方法,对这些问题回答“否”很重要。

To enable it, we create the file src/SitePoint/Bundle/TestBundle/Resources/config/oro/bundles.yml with the following content:

要启用它,我们创建文件src/SitePoint/Bundle/TestBundle/Resources/config/oro/bundles.yml ,其内容如下:

bundles:                                               
    - SitePoint\Bundle\TestBundle\SitePointTestBundle

To look at your Oro installation in dev mode, access it via the app_dev.php url, like so:

要在开发人员模式下查看Oro安装,请通过app_dev.php网址进行访问,如下所示:

http://test.app:8000/app_dev.php

To be able to do this, you need to remove the blocking check from app_dev.php, removing this entire block, or tweaking it so it’s more permissive:

为了做到这一点,您需要从app_dev.php删除阻塞检查,删除整个块,或者对其进行调整,以使其更加宽松:

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

After that, we clear the cache (php app/console cache:clear). This will take a while, but after it’s done, your bundle will be “installed”. You can see it’s there through the dev console, though it won’t be in actual use anywhere.

之后,我们清除缓存( php app/console cache:clear )。 这将需要一段时间,但完成后,将“安装”您的捆绑包。 您可以通过开发人员控制台看到它的存在,尽管它不会在任何地方实际使用。

alt
添加新的屏幕和菜单选项 (Adding a New Screen and Menu Option)

Based on our newly created bundle, let’s give Oro a new menu option and a default view for said option.

基于我们新创建的捆绑包,让我们给Oro一个新的菜单选项和一个默认视图。

The bundle created via the means specified above will add some default files – including a default view and a default controller. We’ll change those a little bit and explain why we’re doing what we’re doing.

通过上述方法创建的捆绑软件将添加一些默认文件-包括默认视图和默认控制器。 我们将对这些内容进行一些更改,并解释为什么我们正在做我们正在做的事情。

第1步 (Step 1)

Change the default controller. Give the file src\SitePoint\Bundle\TestBundle\Controller\DefaultController.php this content, instead of what it currently contains:

更改默认控制器。 为文件src\SitePoint\Bundle\TestBundle\Controller\DefaultController.php此内容,而不是当前包含的内容:

<?php

namespace SitePoint\Bundle\TestBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class DefaultController extends Controller
{
    /**
     * @Route("/hello", name="sitepoint_link")
     * @Template()
     */
    public function indexAction()
    {
        return array('name' => "hello link");
    }
}

We need to add the “Route” and “Template” use statements because Symfony relies heavily on reading the annotation text to resolve dependencies. Notice how I’m telling it about a new @Route in the annotation? That’s the “Route” I’m “use”ing above. Same with Template. If you’re using an IDE like PhpStorm, don’t let the “alias never used” warnings throw you off – PhpStorm doesn’t know the annotations are the ones using them.

我们需要添加“ Route”和“ Template” use语句,因为Symfony严重依赖于阅读注释文本来解决依赖关系。 请注意,我是如何在注释中告诉它有关新@Route的? 那就是我上面“使用”的“路线”。 与模板相同。 如果您使用的是类似PhpStorm的IDE,请不要让“别名从未使用过”警告让您失望– PhpStorm不知道注释是使用它们的注释。

In the action, we just give a variable a random value and pass it to the template. With this, we’re done with a basic controller.

在操作中,我们只给变量一个随机值,然后将其传递给模板。 这样,我们就完成了一个基本的控制器。

第2步 (Step 2)

Create the file src\SitePoint\Bundle\TestBundle\Resources\config\navigation.yml and give it the following content:

创建文件src\SitePoint\Bundle\TestBundle\Resources\config\navigation.yml并为其提供以下内容:

oro_menu_config:
    items:
        sitepoint_tab:
            label: SitePoint Test
            uri:   '#'
            extras:
                position: 300
        sitepoint_tab_link:
            label: SitePoint Link 1
            route: sitepoint_link
            extras:
                routes: ['/^sitepoint_link/']
                description: This is a SitePoint link
    tree:
        application_menu:
            children:
                sitepoint_tab:
                    children:
                        sitepoint_tab_link: ~

oro_titles:
    sitepoint_link: My link page title

This builds a new menu item. First it defines a new tab named “SitePoint Test” – this will be the main menu entry among the possible menu options already there. Then, it gives it a child link, as defined in the “tree” section near the bottom. The link (defined above) has a name “SitePoint Link 1”, and uses the route “sitepoint_link” (yet to be defined, but also used in the controller’s @Route declaration).

这将建立一个新的菜单项。 首先,它定义了一个名为“ SitePoint Test”的新选项卡–这将是已经存在的可能菜单选项中的主菜单项。 然后,为其提供一个子链接,如底部附近的“树”部分中所定义。 链接(上面定义)的名称为“ SitePoint Link 1”,并使用路由“ sitepoint_link”(尚未定义,但也用于控制器的@Route声明中)。

第三步 (Step 3)

Delete the default routing.yml file (src\SitePoint\Bundle\TestBundle\Resources\config\routing.yml) and create a new one at src\SitePoint\Bundle\TestBundle\Resources\config\oro\routing.yml with the following content:

删除默认的routing.yml文件( src\SitePoint\Bundle\TestBundle\Resources\config\routing.yml ),并使用以下命令在src\SitePoint\Bundle\TestBundle\Resources\config\oro\routing.yml创建一个新src\SitePoint\Bundle\TestBundle\Resources\config\oro\routing.yml内容:

sitepoint_link:
    resource:     "@SitePointTestBundle/Controller"
    type:         annotation
    prefix:       /user

This made sure Oro loads the new route configuration, reads its functionality from the annotation of the default controller, and adds a “user” prefix in front of it.

这样可以确保Oro加载新的路由配置,从默认控制器的注释中读取其功能,并在其前面添加一个“用户”前缀。

第4步 (Step 4)

Change the default template src\SitePoint\Bundle\TestBundle\Resources\views\Default\index.html.twig into the following:

将默认模板src\SitePoint\Bundle\TestBundle\Resources\views\Default\index.html.twig更改为以下内容:

{% extends "OroUIBundle:Default:index.html.twig" %}
{% block content %}
    {{ name }}!
{% endblock content %}

This is important due to the ajax nature of Oro. The application expects a certain format to be returned, and unless it gets back a specific type (extended from the default OroUI template), it wil become confused and break.

由于Oro的ajax特性,这一点很重要。 该应用程序期望返回某种格式,除非它返回特定类型(从默认的OroUI模板扩展),否则它会变得混乱和中断。

第5步 (Step 5)

Reload navigation generation, and clear the cache:

重新加载导航生成,并清除缓存:

php app/console oro:navigation:init
php app/console cache:clear

You should now be able to visit the new menu option in the browser and see “Hello link”:

您现在应该可以在浏览器中访问新菜单选项,并查看“ Hello链接”:

alt

Other customizations are possible as well, but are outside the scope of this post and will likely be covered in followup articles if there’s enough interest for them.

其他自定义也是可行的,但是不在本文的讨论范围之内,如果有足够的兴趣,可能会在后续文章中介绍。

结论 (Conclusion)

As you can see, OroCRM is a fully-featured, highly robust, and extremely extensible CRM for the modern era. It uses a powerful framework, and sports a modern design.

如您所见,OroCRM是功能齐全,功能强大,可扩展性强的现代CRM。 它使用了强大的框架,并采用了现代设计。

However, it’s also extremely overbloated. It pulls in Zend and Symfony both? Why? Those frameworks alone weigh over a hundred megs each with dependencies. I feel like they’re far too desperately trying to cover both all the options they can think of and not reinvent the wheel, which is something that, in my experience, isn’t a healthy combination.

但是,它也过于夸张。 它同时吸引了Zend和Symfony? 为什么? 仅这些框架就有超过一百兆的依赖关系。 我觉得他们过于拼命地试图涵盖他们能想到的所有选项, 不是重新发明轮子,以我的经验来看,这不是一个健康的组合。

Will you be giving it a go? Are you using it in production? Let us know – and if you’ve built some elaborate open source Oro extensions, we’d love to publish your workflow! Get in touch!

你会尝试吗? 您在生产中使用它吗? 让我们知道–如果您已经构建了一些精心设计的开源Oro扩展,我们很乐意发布您的工作流程! 取得联系

翻译自: https://www.sitepoint.com/first-look-orocrm-extending-bundles/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值