eloy1812 Posted August 11, 2016 Share Posted August 11, 2016 hi, I am creating a module for the front end, in the hookDisplayRightColumnProduct. How I can add a number to the product price? For example, if I press a button I want to add 10 to the price thanks Link to comment Share on other sites More sharing options...
vekia Posted August 11, 2016 Share Posted August 11, 2016 you want to change it only on front view or also in database ? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 12, 2016 Share Posted August 12, 2016 The product price of any product is actually calculated in SpecificPrice::getSpecificPrice() function. In case you want to change the price then you can simply override this fucntion. The price that is displayed on product page can be changed through a small script that can be executed in the hook you are using. Link to comment Share on other sites More sharing options...
eloy1812 Posted August 12, 2016 Author Share Posted August 12, 2016 you want to change it only on front view or also in database ? Only in frontview Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 12, 2016 Share Posted August 12, 2016 The product price on the front product page is shown through the theme's product.tpl file that internally calls that getPrice() function of Product class. The getPrice() function of Product class calls another function which calls another and so on. Th final call is made for SpecificPrice::getSpecificPrice(), that actually returns the price, you can simply override it to change any product price throughout the store. Link to comment Share on other sites More sharing options...
vekia Posted August 12, 2016 Share Posted August 12, 2016 as eloy mentioned, the price should be changed once someone will hit a button on product page and only for front office view - so this should be coded as a javascript, not a php. if you will put price to some <span> or <div> with custom id - it will be very easy to achieve, can you put the price into some div? Link to comment Share on other sites More sharing options...
eloy1812 Posted August 13, 2016 Author Share Posted August 13, 2016 boostrap product.tpl uses "our_price_displayed" as id , my actual template too (leo converse) Could it be done without changing any template file ? 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