dhobo Posted January 20, 2014 Share Posted January 20, 2014 Hello, Can anyone tell me which hook and/or override I need to modify if I want to create my own module to modify a product price? The situation is like this: every customer on our shop can have a different price for a product. It's possible that customer A has to pay 50 EUR for product A, while customer B only has to pay 40 EUR for the same product. The logic for this rule has already been written, all I need to know is where to implement it.Basically what I need is something like a function where the input is the product & the logged in customer (this I can get from the session) and it will return the new price. but I can't find which hook I need to implement in my module or which override I need to modify. Anyone any clue which one I need ? thanks Link to comment Share on other sites More sharing options...
NemoPS Posted January 20, 2014 Share Posted January 20, 2014 Actually, why not using customer groups? That way, every customer group can have a separate price. Have you looked into this? It doesn't require any override Link to comment Share on other sites More sharing options...
dhobo Posted January 20, 2014 Author Share Posted January 20, 2014 Yep, I looked into that, and that is unfortunately not enough - customers can be in more than 1 customer group and prestashop unfortunately doesn't handle that well, it will only handle the price/discount for the default customer group. so if my client will be in customer group A, which gives 10% discount on products in category A, and also in customer group B, which gives 10% discount on products in category B, then he will get only 10% discount in one of those categories - dependable on which one is his default - not in both. Link to comment Share on other sites More sharing options...
NemoPS Posted January 20, 2014 Share Posted January 20, 2014 I see. In this case, I'd look into overriding Product::getPriceStatic. Hard to tell you where though, as we don't know your code's logic Link to comment Share on other sites More sharing options...
dhobo Posted January 20, 2014 Author Share Posted January 20, 2014 my code logic is basically just a call to a remote server so really, the prestashop code will be very minimum i just need to have the have the customer & product id, make the remote request, and give back the response (which will be the price).so, very simple I guess Link to comment Share on other sites More sharing options...
NemoPS Posted January 20, 2014 Share Posted January 20, 2014 In this case you can try calling your api at the beginning of the method I mentioned. If some special price is found, return that. Might work, but I can't tell it for sure Link to comment Share on other sites More sharing options...
dhobo Posted January 20, 2014 Author Share Posted January 20, 2014 ok thanks, will try that Link to comment Share on other sites More sharing options...
rastafermo Posted February 13, 2014 Share Posted February 13, 2014 hey, I have the same problem with prestashop 1.4.9... did you solved it? how did you do that? Link to comment Share on other sites More sharing options...
Recommended Posts