Arnaud Roch-Trève Posted May 4, 2016 Share Posted May 4, 2016 (edited) Hello, Regarding SEO optimisation, I had to add some structured data by overriding modules. To do so, I have to get the product price in several template (product.tpl, product-list.tpl, modules...). But for one module, bockbestsellers, the displayed price is $product.price, and when I get its value I get "[Price] €". Original code : <span class="price">{$product.price}</span> First try code : <span class="price" itemprop="price">{$product.price}</span> And I get this in google structured data test tool : price: 1,94 € With the following warning : The property is not a specification of valid price. I know from my structured data in product.tpl that I need to put away the €. I only need numbers. So I tried something that I saw on this forum : {assign var='priceVar' value=$product.price} <meta itemprop="price" content="{$priceVar|replace:' €':''}"/> But it's not working. Does someone can help me out on this problem ? I'm quite new handling smarty Prestashop template. Additional information : The var_dump result of $priceVar : string '8,48 €' In template product and product-list I do not have the problem because it seems $productPrice is already without currency. And if I can avoid to modify the php of the module it would be great. Thanks. Edited May 4, 2016 by Gundi (see edit history) 1 Link to comment Share on other sites More sharing options...
jllramos Posted May 4, 2016 Share Posted May 4, 2016 (edited) <meta itemprop="price" content="{$priceVar|replace:'$':''}"/> Change $ to € and it work! Use ' €' with space before €: <meta itemprop="price" content="{$priceVar|replace:' €':''}"/> Edited May 4, 2016 by joselu (see edit history) Link to comment Share on other sites More sharing options...
Arnaud Roch-Trève Posted May 4, 2016 Author Share Posted May 4, 2016 Joselu, Thanks for the answer, but I made a mistake in my first post draw, I did write correctly in my code. <meta itemprop="price" content="{$priceVar|replace:' €':''}"/> I edited my post. Sorry. Link to comment Share on other sites More sharing options...
jllramos Posted May 4, 2016 Share Posted May 4, 2016 (edited) Maybe coud be because in code appear <meta itemprop="price" content="{$priceVar|replace:' €':''}"/> and also something like this <span class="price">{$product.price}</span> and search engine is getting the {$product.price} instead of {$product.price|replace:' €:' '}"/> I have tested in blockbestseller and the price appear without € Edited May 4, 2016 by joselu (see edit history) Link to comment Share on other sites More sharing options...
Arnaud Roch-Trève Posted May 6, 2016 Author Share Posted May 6, 2016 (edited) Sorry, I don't completely understand what you trying to tell me. You says that when you use blockbestseller, {$product.price} return the price without € ? So maybe it's coming from the module parameters ? Just in case, Here the whole div : <div class="text_desc" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> <h5 class="float-left"> <a href="{$product.link}" title="{$product.name|escape:'htmlall':'UTF-8'}" itemprop="url"> {$product.name|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'|truncate:30:'...'} </a> <span class="price">{$product.price}</span> {assign var='priceVar' value=$product.price} {$priceVar|replace:' €':''} <meta itemprop="price" content="{$priceVar|replace:' €':''}"/> <meta itemprop="priceCurrency" content="EUR" /> </h5> </div> I use another var than $product.price because of this thread: https://www.prestashop.com/forums/topic/437646-trying-to-get-total-price-in-blockcart-without-currency/ See post #6 and #8 from Nemo1. Thank you for your time jllramos. Edited May 6, 2016 by Gundi (see edit history) Link to comment Share on other sites More sharing options...
bedandw Posted June 7, 2016 Share Posted June 7, 2016 Hi Gundi- did you get an answer, I am getting the same warning offers @type Offer warning price $830.00 (The property $830.00 is not a valid price specification.) priceCurrency USD Link to comment Share on other sites More sharing options...
Smiles Posted July 11, 2016 Share Posted July 11, 2016 Does anyone knows this answer? Link to comment Share on other sites More sharing options...
bedandw Posted July 11, 2016 Share Posted July 11, 2016 I raised this with Google, you can track the responsese below and see if it meets your need. https://groups.google.com/a/googleproductforums.com/d/msgid/webmasters/ccb44505-f263-45bf-b25b-5315920d5a43%40googleproductforums.com?utm_medium=email&utm_source=footer Link to comment Share on other sites More sharing options...
Arnaud Roch-Trève Posted August 1, 2016 Author Share Posted August 1, 2016 Hello Dedandw, I read your Google Thread, but I only see that you have been told to remove the "$". I already know where the problem come from, and I didn't see, in your thread, how I can solve it. Did I misread ? Thanks. Link to comment Share on other sites More sharing options...
bedandw Posted August 1, 2016 Share Posted August 1, 2016 Sorry, am not tracking- Gundi. What exactly is your question? I followed whatever Grace provided in the answer and it worked. I still have to figure out how to get product review come up in the rich snippets but I dont have time to research that now. Link to comment Share on other sites More sharing options...
NickMoum Posted December 3, 2016 Share Posted December 3, 2016 smarty replace doesn't work with multibyte chars. Try the regex_replace <meta itemprop="price" content="{$priceVar|regex_replace:'/€/':' '}"/> Link to comment Share on other sites More sharing options...
Club Vapea! Posted February 6, 2018 Share Posted February 6, 2018 For anyone wondering, for me on PS 1.6.0.14 it was on product.tpl Correct: <span id="our_price_display" class="price" itemprop="price" content="{$productPrice|regex_replace:'/€/':' '}">{convertPrice price=$productPrice}</span> Link to comment Share on other sites More sharing options...
djinni Posted April 7, 2019 Share Posted April 7, 2019 Hi all. I know this is an old thread, but any idea why this doesn't work for £? I've tried all sorts and am stuck. Link to comment Share on other sites More sharing options...
DailyShopBay Posted April 17, 2019 Share Posted April 17, 2019 On 4/7/2019 at 10:39 PM, djinni said: Hi all. I know this is an old thread, but any idea why this doesn't work for £? I've tried all sorts and am stuck. Hi djinni, try to replace £ with GBP, I did the same from € to EUR. Link to comment Share on other sites More sharing options...
djinni Posted April 18, 2019 Share Posted April 18, 2019 Thanks for the reply, actually, I am trying to strip out the £, but it doesn't seem to work. I have tried the suggestions and I can get it to replace a number, so I know the code works, but it doesn't remove the £. Link to comment Share on other sites More sharing options...
DailyShopBay Posted April 23, 2019 Share Posted April 23, 2019 (edited) On 4/18/2019 at 3:08 AM, djinni said: Thanks for the reply, actually, I am trying to strip out the £, but it doesn't seem to work. I have tried the suggestions and I can get it to replace a number, so I know the code works, but it doesn't remove the £. Hi, sorry for delay... What I did was to follow this link: and the comment of mysho. the file I edited was: root/translations/cldr/main--it-IT--currencies (for you can be en-US or an other one) for Euro you have to replace "symbol":"\u20ac" with "symbol":"EUR", for GBP you have to replace "symbol":"\u00a3" with "symbol":"GBP", etc... then, of course, clean the cache and it should works. You can have a look on my website: dailyshopbay On my own, I add the currency at the end but on the Google webmasters tools, I only highlight the price without the currency and it maybe works!! Edited April 23, 2019 by DailyShopBay (see edit history) Link to comment Share on other sites More sharing options...
aurelius7 Posted June 4, 2019 Share Posted June 4, 2019 Try to use $product.price_amount as variable for price without currency sign 2 1 Link to comment Share on other sites More sharing options...
[email protected] Posted October 7, 2019 Share Posted October 7, 2019 On 6/4/2019 at 2:57 PM, aurelius7 said: Try to use $product.price_amount as variable for price without currency sign That works for me in 1.7.6 in the catalogue/_partials/product-prices.tpl Put {$product.price_amount} in stead of the {$product.price} 1 Link to comment Share on other sites More sharing options...
msarmiento Posted October 18, 2023 Share Posted October 18, 2023 <meta itemprop="price" content="{$product.price_amount}" /> Esta es buena y funciona, probado en 1.7.6 y 8.1 Lo añado como meta itemprop para enviar la información independiente a loq ue se ve en la tienda, en España se escriben los decimales con coma, no con punto. Además que la variable product.price muestra el formato que hayamos configurado: con coma y símbolo de euro o el que sea. $product.price_amount muestra solamente la cantidad sin símbolos y soluciona el problema Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now