Jump to content

Where are all the templates wher a product's price is shown? Chances this will change in the future?


Recommended Posts

I am making a module that extends ProductCore as Product and this new Product will have a new table field, let's call it "is_this_thing" (it's a boolean value).

 

I want to make it so that the price of a product is hidden if the product has is_this_thing = true.

 

I wish I could override a single controller and have this logic propagate to all relevant templates, but I don't think this is possible or is unmanagable in the long term.

 

So, to add that I believe I need to change all relevant templates that show a product's price.

 

Does any one have a list of such templates and what are the chances that I will future updates of PrestaShop will add new places where a product's price is shown and therefore the price should be hidden is_this_thing = true.

 

Thank you for any help or insight!!!

Link to comment
Share on other sites

Can't think of an especially safe way of doing what you're trying to do just in a controller.. it wouldn't be hard to alter the various SQL calls that are made, could directly set the price field in there to whatever you'd like using a mysql IF(), but I'm imagining you want to replace it with some form of message or such rather than just set it to 0.00.. and that's going to run into all kinds of problems I suspect, as there'll be various sections which will expect price to be a number and try to format it accordingly

 

So yes, you're correct that you'd be better off changing the templates. As for which ones show it, that will vary heavily on the theme I'd imagine, plus there'll likely be some references in some modules as well. The quickest and safest way to check I suspect would be to search local files and try to find either $product.price, or even just .price

 

Should narrow it down considerably

 

Only downside then is that the module has suddenly just become more of an override/skin change .. I've never actually found a good way round this issue, would be quite happy to hear if anyone has any better solutions to try and keep changes all within a module folder

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...