This is probably pretty simple for most...
I have this line in Magento which is part of what posts to Pinterest.
<?php echo urlencode( $_product->getShortDescription() ) . " $" . urlencode( number_format( $_product->getPrice(),2 ) ); ?>
Somewhere in this, I need to strip tags as the short description uses a WYSIWYG editor and subsequently adds tags to database, I believe what I need to insert to the above is the following (as Magento has this function already):-
$this->stripTags
Please could anyone advise how this can be correctly added to the above without it breaking the page? Let me know if I need to supply anything further.
Thanks in advance.
This uses php's builtin function strip_tags and should work:
<?php echo urlencode( strip_tags($_product->getShortDescription()) ) . " $" . urlencode( number_format( $_product->getPrice(),2 ) ); ?>
To use Magento's function, use this:
<?php echo urlencode( $this->stripTags($_product->getShortDescription()) ) . " $" . urlencode( number_format( $_product->getPrice(),2 ) ); ?>
though this can only work if $this points to a valid object instance of "something" (sorry, I don't know Magento's internals)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With