View Single Post
  #13  
Old 10-16-2014, 09:34 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean Url settings

I'm close to having this the way that I want it to work. I have it only showing the clean url for the categories you are in just fine, but when you go to a product page it shows the last category you came from to get to the product. It is fine if you come from the home page because it is not a category page so it shows only the product clean url. Below is the code from my converter.php. Any ideas or suggestions?

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 || ('product' === $target && !empty($urlParams))) && 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; } }
__________________
Ver 5.2.6
Reply With Quote