derhaeuptling/contao-immobilienscout24-import-bundle
Composer 安装命令:
composer require derhaeuptling/contao-immobilienscout24-import-bundle
包简介
Immobilienscout24 import for Contao Open Source CMS
README 文档
README
This bundle allows you to import real estate objects from Immoscout24 into your Contao application (4.8+) and display them as native content.
Warning: This is an early release. There might be features missing. Use at your own risk.
How to get going
Setup
-
Install the bundle and update your database. There is no further configuration necessary.
composer require derhaeuptling/contao-immobilienscout24-import-bundle
-
Add at least one
Immoscout24 Accountin the backend and enter your API credentials. -
Setup a cron job that executes the
immoscout24:synccommand or run it yourself to import real estate objects from the API into your application. You can pass an account's id or description as a parameter to only sync this one account and--dry-runto only see what would be updated without persisting the changes. Use the option--purgeto clear the database table and all downloaded files completely beforehand. -
We are using Contao's Virtual Filesystem feature. If you also want to adjust where the downloaded attachments should be stored, simply mount the
immoscout24directory at another place. See the Contao developer docs for more information about this topic. -
Add one or more Immoscout24 modules in your theme and use it in the frontend:
-
The Real estate list displays a list of real estate objects. If you want to generate a teaser list with 'read more' links, make sure to specify a 'jump to' page with the appropriate reader.
-
The Real estate reader displays a single real estate object based on the url parameter (id).
-
List items can be constrained individually by using a filter expression.
Some filter expression examples:- one object by its ID
realEstateId == 111111111 - some objects by its IDs
realEstateId in [111111111,222222222,333333333] - all active objects
state == STATUS_ACTIVE - all objects published to the homepage channel
'Homepage' in publishChannels - all objects with empty API-Searchfield1
apiSearchData1 != null - all objects that match a KEYWORD in the title field
title matches "/KEYWORD/" - combine filter
'Homepage' in publishChannels&&priceMarketingType == "Kauf"
- one object by its ID
-
Templates and values
The real estate listings contain lots of fields - most likely you'll want to adapt the templates to your needs and only output some of the fields. To do this, there are some helpers for your convenience.
A) Real estate data comes in the form of an entity instance, you can type hint against it to get IDE auto-completion in your templates:
/** var Derhaeuptling\ContaoImmoscout24\Entity\RealEstate $realEstate */ $realEstate
B) You can also obtain a list of all available attributes:
$this->attributes // array [name => label] of publicly accessible fields of the real estate objects // e.g. 'descriptionNote' that can be accessed via $realEstate->descriptionNote
C) To retrieve and format data, you can use these helper functions:
$this->hasData(RealEstate $realEstate, string $attribute) : bool // will return wether $realEstate holds data for the $attribute $this->getFormatted(RealEstate $realEstate, string $attribute) : string // will return the formatted value of $attribute - enumerations, dates and // booleans will resolved to a string representation based on the language // files
D) If you want to resolve enumerations yourself you can find all of them as
public constants in the RealEstate entity.
Some enumeration values can occur multiple times per value. In this case they are implemented as binary flags:
FLAG__TYPE_A = 1; FLAG__TYPE_B = 2; FLAG__TYPE_C = 4; FLAG__TYPE_D = 8; FLAG__TYPE_E = 16; // n-of-value selecting 'type A' and 'type E' $value = -(FLAG__TYPE_A | FLAG__TYPE_E); // = 17
Note that flagged values are stored as negative numbers, so that they can easily be differentiated from regular enumeration values.
Attachments
Real estate objects can have multiple attachments. Note: that currently only images are supported attachment types.
To render an attachment (as an image) you can utilize the getFigureFromAttachment()
function present in the templates. It allows passing in an alternative image size as
second argument:
$figure = $this->getFigureFromAttachment($realEstate->getTitlePictureAttachment()); $figure = $this->getFigureFromAttachment( $realEstate->getTitlePictureAttachment(), $this->alternativeImageSize );
To output the Figure, pass its data to the template you want render. In case of the
legacy image template, make sure to expand the image data beforehand by calling
getLegacyTemplateData():
$this->insert('image', $titlePictureFigure->getLegacyTemplateData());
Here is the full example how to output the title picture with the default image size in a failure-tolerant way:
<div>
<h2>Title Picture</h2>
<?php if(null !== ($titlePictureFigure = $this->getFigureFromAttachment($this->realEstate->getTitlePictureAttachment()))): ?>
<?php $this->insert('image', $titlePictureFigure->getLegacyTemplateData()); ?>
<?php else: ?>
<span>There is no title picture.</span>
<?php endif; ?>
</div>
derhaeuptling/contao-immobilienscout24-import-bundle 适用场景与选型建议
derhaeuptling/contao-immobilienscout24-import-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 192 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「import」 「contao」 「immobilienscout24」 「immoscout24」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 derhaeuptling/contao-immobilienscout24-import-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 derhaeuptling/contao-immobilienscout24-import-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 derhaeuptling/contao-immobilienscout24-import-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Contao Open Source CMS
ImmobilienScout24 PHP-SDK
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Parse use statements for a reflection object
Tool for copying data from a production database to a dev database. Also useful for making backups of production databases.
A fork of konnco/filament-import with support of Laravel 11 since the default importer of Filament 3 is nonsense for basic use case.
统计信息
- 总下载量: 192
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-22