M
M
Maxim Shadrin2017-04-09 20:25:55
MODX
Maxim Shadrin, 2017-04-09 20:25:55

How else to process the last element in the modx snippet?

Hello. Question for modx connoisseurs, surely the solution lies in writing your own snippet, although maybe there are some simpler ways?
Using minishop2, I need to output all options of the "Size" property of a product separated by commas. I did it this way:


But the problem is that the comma is also displayed after the last element, which is understandable, in my implementation it cannot be otherwise. But what if I don't need that comma? How else to process the last element?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Shadrin, 2017-04-14
@makc9I

In normal cases, the placeholder, which is the ordinal number of the element, would help, it could be compared using modifiers and in the case where would be equal to , process without a comma , but, unfortunately, the msOptions snippet did not contain such a placeholder and I had to duplicate the snippet and stupidly cut off the last character from the output using substr

D
DarWiM, 2017-04-13
@DarWiM

I don't remember exactly, but it looks like it might work.&tplLast=`...`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question