Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

"math" w tpl nie dziala

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
4Axis
Smarty n00b


Joined: 01 Sep 2015
Posts: 2

PostPosted: Tue Sep 01, 2015 8:04 am    Post subject: "math" w tpl nie dziala Reply with quote

Witam.
Chciałbym wykonać mnożenie w zmiennych w tpl.
Ale niestety nie działa i nie wiem dlaczego. Kod:
Code:

{assign var="name" value=$product['name']|substr:-15}
{assign var="pos" value=$name|regex_replace:"/[\D]/":""}
{assign var="alla" value=$product['quantity']}
{$product['quantity']} --- {$pos} --- {$alla}
{math assign="span" equation="x * y" x=(int)$pos y=(int)$alla}
{$span}

Powyższy fragment kodu generowany jest dla maila z potwierdzeniem zamówienia w prestashop.
Czyste $pos=50 a $alla=1, z (int) $pos=50 a (int)$alla=0.
Jeżeli próbuję math bez (int) to nic nie pokazuje.
Proszę o pomoc
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1399

PostPosted: Tue Sep 01, 2015 8:54 am    Post subject: Reply with quote

http://www.smarty.net/forums/viewtopic.php?t=25693
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: Polish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP