How to use command to format attribute output?>
Output Formatting Command:
Using the output formatting command, it is possible to format any attribute value, for example, converting the product title to Uppercase, Lowercase, String Replace, etc. Every matter should be enclosed with the third bracket and have space before every parameter. All supported formatting commands are listed below:
[substr 0 80], […]
Formatter Description Schema Command:
Formatter | Description | Schema | Command |
strip_tags | Remove all HTML tags | [strip_tags] | [strip_tags], […] |
htmlentities | Convert all applicable characters to HTML entities | [htmlentities] | [htmlentities], […] |
clear | Remove all non-utf-8 characters from the string | [clear] | [clear], […] |
substr | Truncate the string | [substr from to] | [substr 0 80], […] |
str_replace | Replace any string | [str_replace => from => to] | [str_replace => ABC => XYZ], […] or to replace comma, the command will be [ str_replace => ABC => comma ] |
preg_replace | Replace any string | [preg_replace from to] | [preg_replace /abc/ qwe], […] |
ucwords | Uppercase the first character of each word in the string | [ucwords] | [ucwords], […] |
ucfirst | Make the string’s first character uppercase | [ucfirst] | [ucfirst], […] |
strtoupper | Transform the string to upper case | [strtoupper] | [strtoupper], […] |
strtolower | Transform the string to lowercase | [strtolower] | [strtolower], […] |
convert NOTE: This command is not functional anymore | Change price currency | [convert from to ] | [convert USD AUD] or [convert AUD CHF], […] |
number_format | Format a number with grouped thousands | [number_format decimals] Number of decimal = 1 or 2 (any number) Decimal separator = point or comma or space Thousand Separator = point or comma or space | [number_format] or [number_format 2] or [number_format 2 point] or [number_format 2 comma] or [number_format 2 point space] or [number_format 2 point comma] or [number_format 2 point point ] . or [number_format 2 comma point ], […] |
urlToUnsecure | Convert all URLs to HTTP format | [urlToUnsecure] | [urlToUnsecure], […] |
urlToSecure | Convert all URLs to HTTPS format | [urlToSecure] | [urlToSecure], […] |
only_parent | Only add a variable product info | [only_parent] | [only_parent], […] |
parent | Variable product info if variable value is not empty else variation info | [parent] | [parent], […] |
parent_if_empty | Add variable product info if the variation info is empty. Example: Product Description | [ parent_if_empty] | [ parent_if_empty], […] |
strip_shortcodes | Delete shortcodes from the string | [strip_shortcodes] | [strip_shortcodes] , […] |
Example image from CTX Feed to use Output formatting commands:
Hi!
I want to replace all empty descriptions with a “there’s no description here!” description.
Is there a command for “empty” or something similar?
I was thinking about the str_replace command, but I can’t find the word for empty.
Thanks!
Hi! You can do it using Dynamic attribute if you are using the pro version of CTX Feed. To know how, please, contact us from here – webappick.com/contact
Hi,
If I want to put all the product title in lowercase except the first string of each word .
An Example would be:
My Website: SNEAKERS BLUE
I need: Sneakers Blue
In the output type I can make this: ucwords , strtolower ?
Hi, You can simply use ucword as the output type as shown here and the titles will be converted to your desired format.