Franck_R Posted July 12, 2010 Share Posted July 12, 2010 Hi,When i choose "the lowest price" or the "highest price".I have a problem when several pages are displayed (after two or three pages)I give you some screens to explain my problem and i can see the same problem on others prestashop website.The first price of the current page doesn't follow the last price of the previous page...Regards,Franck_R Link to comment Share on other sites More sharing options...
mathmenet Posted July 12, 2010 Share Posted July 12, 2010 More one Link to comment Share on other sites More sharing options...
Franck_R Posted July 16, 2010 Author Share Posted July 16, 2010 Hi,My problem is solved.There was a wrong calculation in the getProducts method, more exactly in the definition of 'orderprice' in the SELECT part. (p.`price` * ((100 + (t.`rate`))/100) - IF((DATEDIFF(`reduction_from`, CURDATE()) <= 0 AND DATEDIFF(`reduction_to`, CURDATE()) >=0) OR `reduction_from` = `reduction_to`, IF(`reduction_price` > 0, `reduction_price`, (p.`price` * ((100 + (t.`rate`))/100) * `reduction_percent` / 100)),0)) AS orderprice PS version 1.2.5Thanks. Link to comment Share on other sites More sharing options...
poshook Posted July 29, 2010 Share Posted July 29, 2010 Hi,My problem is solved.There was a wrong calculation in the getProducts method, more exactly in the definition of 'orderprice' in the SELECT part. (p.`price` * ((100 + (t.`rate`))/100) - IF((DATEDIFF(`reduction_from`, CURDATE()) <= 0 AND DATEDIFF(`reduction_to`, CURDATE()) >=0) OR `reduction_from` = `reduction_to`, IF(`reduction_price` > 0, `reduction_price`, (p.`price` * ((100 + (t.`rate`))/100) * `reduction_percent` / 100)),0)) AS orderprice PS version 1.2.5Thanks. what file did you edit? can you explain what exactly have to do? Link to comment Share on other sites More sharing options...
rocky Posted July 29, 2010 Share Posted July 29, 2010 It appears this bug has already been fixed in PrestaShop v1.3.1. It is on line 407 of classes/Category.php in PrestaShop v1.2.5 that should be changed from: (p.price - IF((DATEDIFF(reduction_from, CURDATE()) <= 0 AND DATEDIFF(reduction_to, CURDATE()) >=0) OR reduction_from = reduction_to, IFNULL(reduction_price, (p.price * reduction_percent / 100)),0)) AS orderprice to: (p.`price` * ((100 + (t.`rate`))/100) - IF((DATEDIFF(`reduction_from`, CURDATE()) <= 0 AND DATEDIFF(`reduction_to`, CURDATE()) >=0) OR `reduction_from` = `reduction_to`, IF(`reduction_price` > 0, `reduction_price`, (p.`price` * ((100 + (t.`rate`))/100) * `reduction_percent` / 100)),0)) AS orderprice Link to comment Share on other sites More sharing options...
ngruy Posted August 3, 2010 Share Posted August 3, 2010 Have similar problem with PS 1.3.1. When i choose “the lowest price” or the “highest price”, it´s only work in one page basis. Link to comment Share on other sites More sharing options...
rocky Posted August 3, 2010 Share Posted August 3, 2010 This bug has been reported and confirmed by PrestaShop, but it is difficult to fix, so it probably won't be fixed until PrestaShop v1.4. Link to comment Share on other sites More sharing options...
Franck_R Posted August 9, 2010 Author Share Posted August 9, 2010 I ommited to say that you have to add the following ligne : if($orderBy == "price") $orderBy="orderprice"Add this before the Sql request. Link to comment Share on other sites More sharing options...
x3n0m0rph Posted August 17, 2010 Share Posted August 17, 2010 can u show me a print screen pls? i don`t get it right.. Link to comment Share on other sites More sharing options...
migash Posted September 1, 2010 Share Posted September 1, 2010 Okay. I think I fixed it. The problem was not with the reduced price calculations it was with the tax calculations. When a product was not associated with a tax and therefore 'p.id_tax = 0' the sql statement ended up with a NULL value for t.`rate`. So the price line in the sql statement in Category.php needs to be as follows to assign '1' if the return is NULL:(p.`price` * IF(t.`rate`>0,((100 + (t.`rate`))/100),1) - IF((DATEDIFF(`reduction_from`, CURDATE()) <= 0 AND DATEDIFF(`reduction_to`, CURDATE()) >=0) OR `reduction_from` = `reduction_to`, IF(`reduction_price` > 0, `reduction_price`, (p.`price` * IF(t.`rate`>0,((100 + (t.`rate`))/100),1) * `reduction_percent` / 100)),0)) AS orderpriceDone, and done, Homies! Link to comment Share on other sites More sharing options...
migash Posted September 1, 2010 Share Posted September 1, 2010 Minor follow-up ... you actually do not need the >0 ... can just say IF(t.`rate`, Link to comment Share on other sites More sharing options...
Artx Posted October 11, 2010 Share Posted October 11, 2010 Doesn`t work in 1.3.2.3 ! Help ! Link to comment Share on other sites More sharing options...
CRAZY-Ivan Posted November 11, 2010 Share Posted November 11, 2010 Problem is, when you dont have prices in the main product, but by the attributes...then you have to change the row by thatIF(p.`price` = 0,pa.`price`,(p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1) - IF((DATEDIFF(`reduction_from`, CURDATE()) <= 0 AND DATEDIFF(`reduction_to`, CURDATE()) >=0) OR `reduction_from` = `reduction_to`, IF(`reduction_price` > 0, `reduction_price`, (p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1) * `reduction_percent` / 100)),0)))AS orderprice Link to comment Share on other sites More sharing options...
Roman_vinnitskij Posted February 12, 2011 Share Posted February 12, 2011 line from the 1.4 version works fine, if your version is lower then falle classes / category.php find the line(p.`price` * .............. (about 478 bar) and replace it with(p. `price` * IF (t. `rate`, ((100 + (t. `rate`)) / 100), 1)) AS orderpriceand everything will be ok. 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