سؤال

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