Got it. Here is the final code if anyone else is interested in doing this.
Code:
<?php
namespace XLite\Module\Pmall\PmallSkin\Core;
abstract class Converter extends \XLite\Core\Converter implements \XLite\Base\IDecorator
{
public static function buildCleanURL($target = '', $action = '', array $params = array())
{
$result = null;
$urlParams = array();
if ('product' === $target && empty($action) && !empty($params['product_id'])) {
$product = \XLite\Core\Database::getRepo('\XLite\Model\Product')->find($params['product_id']);
if (isset($product) && $product->getCleanURL()) {
$urlParams[] = $product->getCleanURL() . '/';
unset($params['product_id']);
}
}
if (
('category' === $target && empty($action) && !empty($params['category_id']))
) {
$category = \XLite\Core\Database::getRepo('\XLite\Model\Category')->find($params['category_id']);
if (isset($category) && $category->getCleanURL()) {
$urlParams[] = $category->getCleanURL();
}
}
if (!empty($urlParams)) {
unset($params['category_id']);
}
static::buildCleanURLHook($target, $action, $params, $urlParams);
if (!empty($urlParams)) {
unset($params['target']);
$result = implode('/', array_reverse($urlParams));
if (!empty($params)) {
$result .= '?' . http_build_query($params);
}
}
return $result;
}
}