1b.app
Link copied -

The product name is not displayed if it contains quotation marks

Good afternoon Problem found:

If there are quotes in the product name, then the name of this product is displayed only before the quotes, and subsequent products are not displayed.

{|foreach from="$basketsArray" item="e"|}

{|$e.name|}

Price: {|$e.price|number_format:2:".":""|} UAH

Quantity: {|$e.count|number_format:0:".":""|} pcs

Sum: {|$e.sum|number_format:2:".":""|} UAH

{|/foreach|}
Original question is available on version: ru

Answers:

Hello. Try this template (added |escape so that the quotes are escaped)
{|foreach from="$basketsArray" item="e"|}
{|$e.name|escape|}
Price: {|$e.price|number_format:2:".":""|} UAH
Quantity: {|$e.count|number_format:0:".":""|} pcs
Sum: {|$e.sum|number_format:2:".":""|} UAH
{|/foreach|}
20.12.2023, 20:04
Original comment available on version: ru

The problem with the products was fixed in this ticket https://1b.app/ru/forum/integrations-with-messengers/18045-peremennie-v-shablonn...

But now there is a problem with the address. If it's a postal service, then the name has "Novaya Poshta" in quotation marks. And when substituting a variable, it looks like this:

"Nova Poshta"

I used to put other quotes:

"Nova Poshta"

I tried using {|$clientaddress|escape|}, it looks like this:

"Nova Poshta"
21.12.2023, 15:15
Original comment available on version: ru

The result of using {|$clientaddress|escape|} on the screen
21.12.2023, 15:17
Original comment available on version: ru

You can also put in replace:"-":"":
For example: {|$clientaddress|replace:"'":"<"|}
21.12.2023, 15:20
Original comment available on version: ru


Derkach Dmytriy
OneBox production wrote:
You can also put in replace:"-":"":
For example: {|$clientaddress|replace:"'":"<"|}

The apostrophe replaces it like this, but if you put quotation marks, then there is a 500 error. Is it possible to display quotation marks correctly by default, as in product names?
21.12.2023, 15:35
Original comment available on version: ru

The 500th error will occur if there is an error in the syntax
21.12.2023, 15:38
Original comment available on version: ru

you wrote an example {|$clientaddress|replace:"'":"<"|} - here the apostrophe is changed to an angle bracket
The problem we have is that the quotes in the address change to "
In your example, I tried to put quotation marks instead of an apostrophe so that they would change to a parenthesis - I got an error 500
In any case, the address contains both quotation marks and an apostrophe; will it be possible to replace both with one variable? I would not like to change the apostrophe to any signs, it is part of the word.
Can you simply make the correct display of quotation marks and apostrophes as in the product names?
21.12.2023, 15:44
Original comment available on version: ru


Rodion wrote:
The problem we have is that the quotes in the address change to "

here on the forum this sign (quot) is replaced with quotation marks
21.12.2023, 15:45
Original comment available on version: ru


Rodion wrote:
In any case, the address contains both quotation marks and an apostrophe; will it be possible to replace both with one variable?

Replace can be used 2 times
{|$clientaddress|replace:" ' ":"<"|replace:" " ":">"|}
21.12.2023, 15:48
Original comment available on version: ru


Derkach Dmytriy
OneBox production wrote:
{|$clientaddress|replace:" ' ":"<"|replace:" " ":">"|}

does not replace quotes, error 500
21.12.2023, 15:57
Original comment available on version: ru

Try in replace to wrap what you replace in single quotes
21.12.2023, 16:00
Original comment available on version: ru


Derkach Dmytriy
OneBox production wrote:
Try in replace to wrap what you replace in single quotes

did not help
Can you please correct it (return it as it was) without replacing it with other symbols, because sending messages to the client with some other symbols, especially instead of an apostrophe in a word, is not very good at all
21.12.2023, 18:09
Original comment available on version: ru

Tell me, is there a solution to the problem?
29.12.2023, 18:15
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment