responsiv/currency-plugin 问题修复 & 功能扩展

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

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

responsiv/currency-plugin

最新稳定版本:v2.1.1

Composer 安装命令:

composer require responsiv/currency-plugin

包简介

Currency plugin for October CMS

README 文档

README

Tools for dealing with currency display and conversions. You can configure currencies and converters via the Settings page.

  • Settings → Currencies
  • Settings → Exchange Rates
  • Settings → Site Definitions

Get Started

A quick start guide for this plugin can be found at the following link:

Official Documentation

This plugin is partially documented in the official October CMS documentation.

Article Purpose
Currency Twig Filter Formatting Currency in Twig markup
Currency Form Widget Displaying currency as an input field
Currency List Column Displaying currency in a list column

Understanding Currency Definitions

There are multiple currency definition types that are important to operation the Currency plugin. Each definition type is described in more detail below.

Default Currency

The default currency is used when there is no multisite context or when there is no currency set in one of the other definitions. In the currency form widget, if the model does not implement the multisite feature, then the value is stored in the default currency.

Note: The default currency is set by opening the Settings → Currencies page and checking the Default checkbox on a currency listed on this page.

Primary / Base Currency

The primary currency is a base currency that sets the currency for use when writing values in a multisite context. For example, if the model implements the multisite feature, then the value is stored in the primary currency set by the active site.

The primary currency is available in Twig as this.site.base_currency and this.site.base_currency_code.

{{ this.site.base_currency_code }}

Note: The primary currency is set by opening the Settings → Site Definitions page and selecting a currency in the Base Currency dropdown.

{{ product.price|currency({ from: this.site.base_currency_code })}}

Display Currency

The display currency has a specific purpose of converting a currency from its stored value before displaying it.

The display currency is available in Twig as this.site.currency and this.site.currency_code.

{{ this.site.currency_code }}

For example, if a value is stored in the primary currency as USD and the site definition has a display currency of AUD.

{{ product.price|currency({
    from: this.site.base_currency_code,
    to: this.site.currency_code
})}}

This can be shortened by setting the site option to true.

{{ product.price|currency({ site: true })}}

Note: The primary currency is set by opening the Settings → Site Definitions page and selecting a currency in the Display Currency dropdown.

License

This plugin is an official extension of the October CMS platform and is free to use if you have a platform license. See EULA license for more details.

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-03-28