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