View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002623||OXID eShop (all versions)||1.03. Basket, checkout process||public||2011-03-17 13:34||2012-12-10 13:23|
|Product Version||4.4.7 revision 33396|
|Target Version||Fixed in Version||4.5.6 revision 40808|
|Summary||0002623: Bug in oxorder->validateStock|
|Description||im writing a module currently and found a flaw in oxorder->validateStock. When it comes to unsufficient stock in the last orderstep an exception is generated. After checking stock by |
$iOnStock = $oProd->checkForStock( $oContent->getAmount(), $dArtStockAmount );
in line 1110
$oEx->setRemainingAmount( $oProd->oxarticles__oxstock->value );
does not use the return-value of checkForStock ($iOnStock). So it is not possible to pass through a value generated in checkForStock, wich I have to do in my special case. I now have to overload oxorder and copy the whole function only for fixing this.
I do not see any reason, why using the oxarticle-value from the object instead of the calculated value of the function, or do I miss something here?
after searching and traying for nearly 2.5 hours and beeing close to loosing my mind i posted to the list. NOW I found the solution: I also overload oxbasketitem. If I register oxbasket AFTER oxbasketitem the error occurs. So simply registering oxbasket in the first line of System -> Modules in the backend solves the whole problem.
As happy as I am now with having a solution for this, I still do not really understand it. Each and every class is testet for having overloads when being instantiated. So why does it make any difference in wich position oxbasket is listed in the modules-section???
I agree, that usage of oxarticles__oxstock value is incorrect, but value returned from checkForStock is also not a good way to solve the problem, as it can be true/false/integer. We will think about more general solution for this problem.