thelia/custom-fields-module 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thelia/custom-fields-module

最新稳定版本:1.0.5

Composer 安装命令:

composer require thelia/custom-fields-module

包简介

CustomFields module for Thelia

README 文档

README

A Thelia module to add custom fields to products, content, categories, and folders with multi-language support.

Features

  • Create custom fields with different types (text, textarea, wysiwyg, content (ID), product (ID), folder (ID), category (ID))
  • Assign custom fields to multiple sources (product, content, category, folder, general)
  • Multi-language support for field values
  • Tab integration in back-office edit pages
  • Twig function for front-office display

Installation

  1. composer require thelia/custom-fields-module
  2. Activate the module in the back-office

Usage

Back-Office

  1. Create Custom Fields: Go to Tools > Custom Fields

    • Enter a title and unique code (e.g., warranty_period)
    • Select field type
    • Choose which sources can use this field (product, content, category, folder, general)
  2. Edit Field Values: When editing a product/content/category/folder:

    • Navigate to the "Custom Fields" tab
    • Enter values for each language using the language selector
    • Save changes
  3. Edit Field Values General: Go to Tools > Custom Fields

    • Navigate to the "General Fields" tab
    • Enter values for each language using the language selector
    • Save changes

Front-Office (Twig Templates)

Use the custom_field_value function to display custom field values:

{* Display custom field for current locale *}
{{ custom_field_value('warranty_period', 'product', product_id) }}

{* Display custom general field *}
{{ custom_field_value('warranty_period') }}

{* Display custom field for specific locale *}
{{ custom_field_value('warranty_period', 'product', product_id, 'en_US') }}

Parameters:

  • code: The custom field code
  • source: Source type (product, content, category, folder) - default : general
  • source_id: The entity ID (no need to specify for general source)
  • locale (optional): Specific locale (defaults to current session locale)

Example

{* In a product template *}
{if custom_field_value('warranty_period', 'product', $PRODUCT_ID)}
    <div class="warranty">
        <strong>Warranty:</strong>
        {custom_field_value('warranty_period', 'product', $PRODUCT_ID)}
    </div>
{/if}

统计信息

  • 总下载量: 37
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2026-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固