Dvir Yadae
Dvir Yadae

Reputation: 103

remove currency symbol from itemprop="price", in prestashop 1.6

product page: https://www.cdsoft.co.il/index.php?id_product=301391&controller=product

the content of the itemprop="price" is presented with currency symbol : 118 ₪

<span id="our_price_display" class="price" itemprop="price" content="119" data-font-size="14" data-font-size-type="px">118 ₪‎</span>

I'm trying to reach to this:

<span id="our_price_display" class="price" itemprop="price" content="119" data-font-size="14" data-font-size-type="px">118 ₪‎</span>

in product.tpl :

<span id="our_price_display" class="price" itemprop="price" content="{ceil($productPrice|floatval)}">{convertPrice price=$productPrice|floatval}</span>

I've tried to remove the symbol by adding regex:

<span id="our_price_display" class="price" itemprop="price" content="{ceil($productPrice|floatval)|regex_replace:'/ ₪/':' '}">{convertPrice price=$productPrice|floatval}</span>

it didn't work.

any suggestions ?

Upvotes: 0

Views: 167

Answers (1)

m1337
m1337

Reputation: 11

The Regex is looking for a forward slash followed by a space and then the currency symbol, rather than just the currency symbol, while forward slash (/) is being used as a delimiter to enclose the regular expression and as a special character to match the currency symbol (₪).

You can try a different delimiter, such as the tilde (~):

<span id="our_price_display" class="price" itemprop="price" content="{ceil($productPrice|floatval)|regex_replace:'~ ₪~':' '}">{convertPrice price=$productPrice|floatval}</span>

or escape the forward slash:

<span id="our_price_display" class="price" itemprop="price" content="{ceil($productPrice|floatval)|regex_replace:'/ \\\\₪/':' '}">{convertPrice price=$productPrice|floatval}</span>

Upvotes: 1

Related Questions