Extension Extended ifconfig

Thảo luận trong 'Kho download Module, extensions cho magento' bắt đầu bởi phuong.hoang, 18 Tháng năm 2012.

  1. phuong.hoang

    phuong.hoang Hoàng Thị Phương

    No matter you are a Magento professional developer, a site owner or a developer which works on Magento, "Extended ifconfig" is for you to improves your works and makes it easier to you coding Magento.
    As you know, in Magento layout XML files you can use "action" tag to calling a method. Magento's action can gets name of method in "method" attribute and a boolean condition in "ifconfig" attribute. The ifconfig attribute gets address of a configuration option in Magento admin system and checks it for true or false, if option's value be true then specified method will call.
    Now imagine you want call "addJs" method to loading file.js, if option X is false in your extension configuration settings. Or think you want load this file if option X is false but options Y is equal to "animation". That's right, this is not possible by Magento's default core. The action tag calls defined method if the only defined option just be true and nothing else.
    But "Extended ifconfig" can handles this new functionalities for you. With this extension you can use action in different types and modes to have more functionalities and flexibilities.

    Please note: before installing any extension, first test it on a simulator of your website, if there isn't any problem then install it on your original store.
    Please note: don't forget, always make a backup of your original store before any new extension installation.

    Key Features:

    Full Free Extension
    Checking boolean value (both true and false)
    Checking string and numeric values
    Checking for multiple options
    Using of multiple module
    Checking multiple options in multiple modules
    Using custom operation for checking multiple options

    User Guide:

    You can use this extension in 3 mode:
    1. Magento default mode
    2. Extended default mode
    3. Flexible professional mode

    1. This extension is completely compatible with Magento's default action. So don't worry about it, all default ifconfigs used by Magento core team work like always without problem. Also you can use default ifconfig like before anywhere, anytime.

    2. Extended default mode just adds a new "condition" attribute which will defines the condition for action method. Let's take a look at above examples. You want load a javascript file in frontend when value of Menu Type option is "animation" for your Professional Menu extension.
    You write action tag like this:
    ...action method="addJs" ifconfig="catalog/promenu/type" condition="animation"...
    The extension will gets value of "type" option in "promenu" module and compares it with condition attribute value, if it be equal to "animation" then it will calls addJs method.

    3. In professional mode you can use multiple options of a module or multiple modules, with custom operation to check those. Let's describe it with an example.
    You want load a stylesheet file when your extension is active and style option is true in your extension setting or when value of skin for theme is equal to "modern".
    You must write something like this:
    ...action method="addCss" modules="general/anextension/; design/theme/" options="active, style; skin" conditions="true, 1; modern" operation="(0 and 1) or 2"...
    The ifconfig attribute explodes into two options, "modules" and "options". In modules attribute you define name of section and name of group which you defined for you modules configuration settings in its system.xml file, and you define option in options attribute with the name which you defined inside fields tag in system.xml file. So syntax is modules="section/group/" and options="option_name".
    If you want use multiple module, you must separate those with semicolon(;) in modules, options and conditions attributes; and if you want check for multiple options for each module, you must separate each option with comma(,). So in above example, the extension will gets value of active and style from general/anextension/ path from your extension, so they are general/anextension/active and general/anextension/style, and it gets value of skin field from design/theme path which is design/theme/skin.
    Now we must define conditions for each one of this options. Let's back to options attribute. The extension reads value of this attribute from left to right and marks each option with a number from zero, so active is 0, style is 1 and skin is 2. In condition attribute we must define condition of each option by its sort order. In above example, active option will checks for true value, style for true also and skin for modern value. The result of comparison will save in its option mark number.
    And finally we define our operation to let action to calls addCss. In operation attribute we use mark number of each option instead its name. In the example we said to extension, calls addCss if active option and style both are equal to true or skin option has modern value.

    - Don't use "ifconfig" attribute if you use flexible professional mode.
    - Don't forget second slash in modules attribute.
    - Separate each module with semicolon(;).
    - Separate each module's option with comma(,).
    - You must use both modules and options attributes.
    - If conditions attribute isn't set or its value is null, true value will use for each option.
    - If operation attribute isn't set or its value is null, options mark numbers will use from left to right, and "AND" operator will use for all of them.
    - Conditions can be boolean, string and numeric.
    - For true condition you can use true, TRUE or 1.
    - For false condition you can use false, FALSE or 0.
    - For and operator you can use and, AND or .(dot) symbol.
    - For or operator you can use or, OR, +(plus) symbol.
    - In operation you can use just integers, parentheses and specified operators.
    Configuration Guide:

    This extension has not any configuration settings.

    Các file đính kèm:

    Bài viết khác cùng chuyên mục:

Chia sẻ trang này