View Single Post
  #1  
Old 03-25-2016, 06:32 AM
 
Joel Erickson Joel Erickson is offline
 

Newbie
  
Join Date: Mar 2016
Posts: 5
 

Default Override XCart class from Includes folder?

I have learned how to add module classes to override and/or depend on other modules and the classes in the classes/XLite directory, per the instructions in the knowledge base:
http://kb.x-cart.com/display/XDD/Step+3+-+applying+logic+changes
http://kb.x-cart.com/display/XDD/Making+one+module+depend+on+another+one+--+creating+a+menu+in+the+customer+area

For example, I have successfully overridden \XLite\View functionality such as:
PHP Code:
namespace XLite\Module\MB\Override\View\ItemsList\Product\Customer;

abstract class 
ACustomer extends \XLite\View\ItemsList\Product\Customer\ACustomer implements \XLite\Base\IDecorator
{
    
/**
     * Return true if quick-look is enabled on the items list
     *
     * @return boolean
     */
    
protected function isQuickLookEnabled()
    {
        return 
false;
    }


However, I have not been able to figure out how to override classes in the Includes/Utils directory. For example, I have tried something like this:

PHP Code:
namespace XLite\Module\MB\Override\Includes\Utils;

abstract class 
Converter extends \Includes\Utils\Converter implements \XLite\Base\IDecorator
{
    public static function 
buildURL($target ''$action '', array $params = array(), $interface null)
    {
        
$result strval($interface);
        
$urlParams = array();

        if (!empty(
$target)) {
            
$urlParams['target'] = $target;
        }

        if (!empty(
$action)) {
            
$urlParams['action'] = $action;
        }

        
$params $urlParams $params;

        if (!empty(
$params)) {
            
$result .= '?' http_build_query($params'''&');
        }

        if (
$interface == 'cart.php') {
            
$result .= '#testing'// <--------- no effect yet
        
}
        return 
$result;
    }


But it has no effect on the storefront, so this class function is apparently not being called.
__________________
X-Cart Business 5.2.13
Reply With Quote