문제

I didn't find anything suitable in the docs and tutorials: I use minishop2 and in my cart I display price and count like this:

[[+price]]  [[+count]]

but also I need to add total sum for the rows, which is price * count. How can I do this on modx without writing some special code?

Something like [[+price]*[+count]] - could I do something like this in the template?

도움이 되었습니까?

해결책

You could try to work something out with Output Modifiers: http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/input-and-output-filters-(output-modifiers)

Example:

[[+price:mpy=`[[+count]]`]]

다른 팁

I do not think you can multiply placeholders like that. What you can do though, is to write a little snippet to do it for you:

[[!mySnippet? &value1=`[[+price]]` &value2=`[[+count]]`]]

Then the content of mySnippet

<?php

$output = $value1 * $value2;

return $output;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top