Jump to content

Featured Replies

Posted

I am trying to generate a shorter preview text for a Commerce package in a plugin template, but I can’t figure it out. 

Doing a strip_tags on $item->description has no effect, since the product description is a translatable item. 
And $item->truncated(), which I see being used in some theme templates doesn’t seem to work from the plugin. (Call to undefined method IPS\nexus\Package\Product::truncated()) 

Anyone got any ideas?

You could try:

$desc = \IPS\Member::loggedIn()->language()->get("nexus_package_{$item->id}_desc");

strip_tags($desc);

substr($desc,0,1024);

etc

Probably $item->description() or ->content() will do it.

Not tested.

Edited by Adriano Faria

Recently Browsing 0

  • No registered users viewing this page.