View Single Post
  #1  
Old 12-17-2015, 12:35 PM
 
codegrunt codegrunt is offline
 

Member
  
Join Date: Dec 2015
Posts: 10
 

Default Class / method precedence in X-Cart 5

I am currently looking into migrating a number of custom modules and features from existing 4.* X-Cart installs into 5.2.

Using the Wholesale pricing module as an example, it has the following method defined:

./classes/XLite/Module/CDev/Wholesale/Model/Product.php

Code:
public function getWholesalePrice($membership) { return \XLite\Core\Database::getRepo('XLite\Module\CDev\Wholesale\Model\WholesalePrice')->getPrice( $this, $this->getWholesaleQuantity() > $this->getMinQuantity($membership) ? $this->getWholesaleQuantity() : $this->getMinQuantity($membership), $membership ); }

I have created a second test module and within it defined the same method:

./classes/XLite/Module/MyDev/MyModule/Model/Product.php

Code:
public function getWholesalePrice($membership) { return 987654321; }


After redeploying the store the result from my getWholesalePrice() method from my test module is what is being called on the front end.

How does X-Cart decide which class override should be used? Is there any way to control the precedence?

Cheers,

Ron

PS: my initial post seemed to go off into the ether (silent moderation?)
__________________
multiple versions (4 and 5)
Reply With Quote