furbo/rentman-for-craft

Automatically Import Rentman Products to Craft. Let visitors create orders. Orders are automatically send to rentman as a project request.

1.0.7 2023-12-13 11:16 UTC

This package is auto-updated.

Last update: 2024-12-13 12:29:51 UTC


README

Rentman for Craft

Automatically import Rentman products to Craft. It lets visitors create orders. Orders are automatically sent to Rentman as project requests.

Screenshot Screenshot Screenshot Screenshot

Requirements

This plugin requires Craft CMS 4.2.0 or later, and PHP 8.0.2 or later.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Rentman for Craft”. Then press “Install”.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require furbo/rentman-for-craft

# tell Craft to install the plugin
./craft plugin/install rentman-for-craft

Craft Setup Example

  1. Go to Settings > Plugins > Rentman for Craft > Main settings
  2. Add the API URL, usually https://api.rentman.net/
  3. Add the API Key, more infos here: https://support.rentman.io/hc/en-us/articles/360013767839-The-Rentman-API
  4. Add a cron job that executes the php script httpdocs/craft rentman-for-craft/rentman/update-all (adapt the path to your installation) for example once a day
  5. Choose the templates and urls for products, categories and projects
  6. Click on the Customisation tab: here you can choose your own templates and settings for generated emails and pdfs

Code Examples

Get a single product

{% set product = craft.rentman.getProductById(2550) %}
{{product.displayname}}

Get products by category

<ul>
{% for product in craft.rentman.getProductsByCategory(3207) %}
    <li><a href="{{product.getUrl()}}">{{product.displayname}}</a></li>
{% endfor %}
</ul>

Get all products

<ul>
{% for product in craft.rentman.getAllProducts() %}
    <li><a href="{{product.getUrl()}}">{{product.displayname}}</a></li>
{% endfor %}
</ul>

Get main categories

<ul>
{% for mainCategory in craft.rentman.getCategories() %}
    <li><a href="{{mainCategory.getUrl()}}">{{mainCategory.displayname}}</a></li>
{% endfor %}
</ul>

Get categories first two levels

<ul>
{% for mainCategory in craft.rentman.getCategories() %}
    <li><a href="{{mainCategory.getUrl()}}">{{mainCategory.displayname}}</a></li>
    {% if mainCategory.hasChildren() %}
        <ul>
        {% for child in mainCategory.getChildren().all() %}
            <li><a href="{{child.getUrl()}}">{{child.displayname}}</a></li>
        {% endfor %}
        </ul>
    {% endif %}
{% endfor %}
</ul>

Get all categories in an array (recursive)

{% set categories = craft.rentman.getCategoriesRecursive(0) %}  

Print full categories tree

{{craft.rentman.printCategoryTree(true)|raw}}

Print full categories tree with active category

{{craft.rentman.printCategoryTree(true, 3162)|raw}}

Print partial categories tree with active category

{{craft.rentman.printCategoryTree(false, 3193)|raw}}

Complete twig pages - examples

JavaScript API

The Rentman Plugin for CraftCMS provides a JavaScript API to manage projects and perform associated actions. Here is a detailed guide on how to use this API.

Translations

You can copy the rentman-for-craft.php translations files from the plugin's translations folder to your site's translations folder and translate them there.

Support

If you have any issues with this plugin, please create an issue on GitHub or contact us at Furbo.