Last post 23 min ago
Posts last week 110
Average response time last week 29 min
All time posts 67394
All time tickets 10423
All time avg. posts per day 21

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#6599 – Pre purchase - Writing new url's on the fly

Posted in ‘Pre-sale questions’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 10 September 2019 15:25 UTC
greywing1
Hi Guys

We have a component that isn't supported by sh404sef.

It is generating URL's links like the following "index.php?option=com_dutchfactory&Itemid=101&id=27%7Ctestname-co-uk&lang=en&task=viewbids"

Which looks like this using Joomla's url rewriting (without sh404sef".

https://thatname.uk/viewbids/24/test-one-uk


Is there anyway if we bought your software for it to write a rule to automatically on the fly change all of these links as they are created to look like this

https://thatname.uk/test-one-uk

https://thatname.uk/testdomain.co.uk

https://thatname.uk/anothertestname.co.uk

etc - stripping out everything but leaving the domain name

Thanks
 
Tuesday, 10 September 2019 15:45 UTC
wb_weeblr
Hi

Which looks like this using Joomla's url rewriting (without sh404sef".
You should at least get the same result as with Joomla SEF. I can't say much more but if it has a router.php file meant for Joomla this should be used for sh404SEF as well.

Maybe this component has support for an old sh404SEF version or another SEF extension and it does not work. Can't say without actually looking into the details of it but again, whatever is achieved with Joomla SEF should be achieved with sh404SEF.

Best regards
 
Tuesday, 10 September 2019 16:41 UTC
greywing1
Thank you for your reply,

This is the content of the route.php file. If we requested it, is it possible we could pay you to write a plugin for us that sh404 would support to do what we wanted?

This isn't very widely used software so doubt there would be much demand for it from other customers but we are willing to pay if it can be done?

Kind Regards
Martin


-------------


defined('_JEXEC') or die('Restricted access');

// Stupid but idiot
jimport('joomla.application.component.helper');
$Tapp = JFactory::getApplication();

/**
* Dutch Component Route Helper
*
* @static
* @package Dutch Factory
* @subpackage Router
*/
class DutchFactoryHelperRoute
{

/**
* getSEFCatString
*
* @param $id
*
* @return mixed
*/
public static function getSEFCatString($id)
{

$catOb = DutchFactoryHelperTools::getCategoryModel();

return $catOb->getCategoryPathString($id);

}

/**
* getMenuItemByTaskName
*
* Get the Parameter Task ItemID
* if more than one menu items of same task, returns the first
*
* @param string $task_name
*
* @return int
*/
public static function getMenuItemByTaskName($task_name)
{
$database = JFactory::getDBO();
$database->setQuery("SELECT `id` FROM `#__menu` WHERE `link` LIKE '%task=$task_name%' ORDER BY `id` DESC LIMIT 0 , 1 ");

return $database->loadResult();
}

/**
* getMenuItemId
*
* Finds The Menu Item Of the Component
* by the needles as params
*
* needle example: 'view' => 'category'
*
*
* @param $needles
*
* @return null
* @internal param array $needle
*
* @since 1.5.0
*/
public static function getMenuItemId($needles)
{

$component = JComponentHelper::getComponent('com_dutchfactory');

$app = JFactory::getApplication();
$menus = $app->getMenu('site', array());
$items = $menus->getItems('component_id', $component->id);

$match = NULL;

foreach ($items as $item) {

$ok = TRUE;
foreach ($needles as $needle => $id) {
if (@$item->query[$needle] != $id) {

$ok = FALSE;
break;
}
}
if ($ok == TRUE) {
$match = $item;
break;
}
}

if (isset($match)) {

return $match->id;
} else
return NULL;
}

/**
* getItemid
*
* @param null $needles
*
* @return string
*/
public static function getItemid($needles = NULL)
{

require_once('tools.php');

$Itemid = JFactory::getApplication()->input->getInt('Itemid');
if (!$Itemid) $Itemid = DutchFactoryHelperTools::getMenuItemId($needles);

if ($Itemid) return "&Itemid=" . $Itemid;

return "";
}

/**
* getItemidByTask
*
* @param string|null $task
*
* @return bool|mixed
*/
public static function getItemidByTask($task = NULL)
{
if (!$task) {
return NULL;
}
$db = JFactory::getDbo();
$query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%{$task}%' AND `client_id` = 0";

$db->setQuery($query);
if ($db->loadResult()) {
return "&Itemid=" . $db->loadResult();
}

return "&Itemid=0";
}

/**
* getAuctionListRoute
*
* @param string|null $filters
* @param bool $xhtml
*
* @return null|string
*/
public static function getAuctionListRoute($filters = NULL, $xhtml = TRUE)
{

$link = "index.php?option=com_dutchfactory&task=listauctions";
if (is_array($filters)) {
foreach ($filters as $k => $v)
$link .= "&$k=$v";
} elseif ($filters) $link .= $filters;
$link .= self::getItemid(array('task' => 'listauctions'));

return JRoute::_($link, $xhtml);

}

/**
* getUserdetailsRoute
*
* @param int|null $userid
* @param bool $xhtml
* @param string $fragment Url fragment
*
* @return null|string
*/
public static function getUserdetailsRoute($userid = NULL, $xhtml = TRUE, $fragment = '')
{

$link = "index.php?option=com_dutchfactory&task=userdetails" . ($userid ? '&id=' . $userid : '') . '#' . $fragment;

return JRoute::_($link, $xhtml);
}

/**
* getAddFundsRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getAddFundsRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=balance.addfunds" . self::getItemid(array('task' => 'userdetails'));

return JRoute::_($link, $xhtml);
}

/**
* getPaymentsHistoryRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getPaymentsHistoryRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=payments.history" . self::getItemid(array('task' => 'userdetails'));

return JRoute::_($link, $xhtml);
}

/**
* getCheckoutRoute
*
* @param int $orderid
* @param bool $xhtml
*
* @return null|string
*/
public static function getCheckoutRoute($orderid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=orderprocessor.checkout&orderid=$orderid" . self::getItemid(array('task' => 'form', 'task' => 'editauction', 'task' => 'new'));

return JRoute::_($link, $xhtml);
}

/**
* getFeaturedRoute
*
* @param int $auctionid
* @param bool $xhtml
*
* @return null|string
*/
public static function getFeaturedRoute($auctionid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=setfeatured&id=" . $auctionid . self::getItemid(array('task' => 'viewbids', 'task' => 'details'));

return JRoute::_($link, $xhtml);
}

/**
* getAuctionDetailRoute
*
* @param object $auction JTableDutchAuction
* @param bool $xhtml
*
* @return mixed
*/
public static function getAuctionDetailRoute($auction, $xhtml = TRUE)
{
return JHtml::_('auctiondetails.auctionDetailsURL', $auction, $xhtml);
}

/**
* getNewAuctionRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getNewAuctionRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=newauction" . self::getItemid(array('task' => 'form'));

return JRoute::_($link, $xhtml);
}

/**
* getCategoriesRoute
*
* @param int|null $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getCategoriesRoute($catid = NULL, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=listcats" . self::getItemid(array("task" => "listcats"), array("task" => "listauctions"));
if ($catid) $link .= "&cat={$catid}";

return JRoute::_($link, $xhtml);
}

/**
* getAddToCatWatchlist
*
* @param int $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getAddToCatWatchlist($catid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=addwatchcat&cat={$catid}" . self::getItemid(array('task' => 'listcats'));

return JRoute::_($link, $xhtml);
}

/**
* getDelToCatWatchlist
*
* @param int $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getDelToCatWatchlist($catid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=delwatchcat&cat={$catid}" . self::getItemid(array('task' => 'listcats'));

return JRoute::_($link, $xhtml);
}

/**
* getCategoryRoute
*
* @param int|null $catid
* @param string $task
* @param string|null $catslug
* @param bool $xhtml
* @param string|null $filterLetter
*
* @return null|string
*/
public static function getCategoryRoute($catid = NULL, $task = 'categories', $catslug = NULL, $xhtml = TRUE, $filterLetter = NULL)
{

$link = "index.php?option=com_dutchfactory&task={$task}" . (($catid) ? ("&cat={$catid}") : ("")) . $catslug . ($filterLetter ? '&filter_letter=' . $filterLetter : '');

return JRoute::_($link, $xhtml);
}

/**
* getUserRatingsRoute
*
* @static
*
* @param int|null $userid
*
* @return string
*/
public static function getUserRatingsRoute($userid = NULL)
{
if ($userid)
$link = "index.php?option=" . APP_EXTENSION . "&task=userratings&id={$userid}" . self::getItemid(array('task' => 'UserProfile'));
else
$link = "index.php?option=" . APP_EXTENSION . "&task=myratings" . self::getItemid(array('task' => 'userdetails'));

return JRoute::_($link);
}

}
 
Tuesday, 10 September 2019 16:46 UTC
greywing1
oh, sorry the above is a file called route.php

There is also a file called router.php - don't worry we totally understand if you don't want to take this one. This other persons code is all over the place.

-----------

router.php

<?php
/**-----------------------------------------------------------------------------
* com_dutchfactory - Dutch Auction Factory
* -----------------------------------------------------------------------------
*
* @author thePHPfactory
* @copyright Copyright (C) 2014 SKEPSIS Consult SRL. All Rights Reserved.
* @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* Websites: http://www.thePHPfactory.com
* Technical Support: Forum - http://www.thePHPfactory.com/joomla-forum/
* @package : Dutch Auction Factory
* @subpackage: Router
**----------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
/**
*
*/
defined('DS') || define('DS', DIRECTORY_SEPARATOR);

require_once(JPATH_ROOT . DS . 'components' . DS . 'com_dutchfactory' . DS . 'helpers' . DS . 'tools.php');
require_once(JPATH_ROOT . DS . 'components' . DS . 'com_dutchfactory' . DS . 'helpers' . DS . 'route.php');

/**
* dutchFactoryBuildRoute
*
* @param $query
*
* @return array
*/
function dutchFactoryBuildRoute(&$query)
{

$segments = array();
if (empty($query['task'])) {
return $segments;
}

$task = strtolower($query['task']);
unset($query['task']);

switch ($task) {
case 'viewbids':
if (!empty($query['id'])) {

$segments[] = $task;
$id = $query['id'];

if (FALSE !== strpos($query['id'], '|')) {
list($id, $title) = explode('|', $query['id']);
}

$segments[] = $id;
if (isset($title)) {
$segments[] = JFilterOutput::stringURLUnicodeSlug($title);
}

unset($query['id']);
}
break;
case 'accept':
if (!empty($query['bid'])) {
$segments[] = $task;
$segments[] = 'bid';
$segments[] = $query['bid'];
unset($query['bid']);
}
break;
case 'listcats':
case 'tree':

$segments[] = $task;

if (isset($query['cat']) && $query['cat']) {

$path = dutchFactorySEFCatPath($query['cat']);
$segments[] = implode('/', $path) . '/' . $query['cat'];

unset($query['cat']);
}
break;
case 'search';

$segments[] = $task;

break;
case 'tags':

$segments[] = $task;
if (!empty($query['tagid'])) {
list($tagid, $slug) = explode(':', $query['tagid']);
$segments[] = $tagid;
$segments[] = JFilterOutput::stringURLUnicodeSlug($slug);
unset($query['tagid']);
}

break;
case 'listauctions':

$segments[] = $task;

if (!empty($query['cat'])) {

$path = dutchFactorySEFCatPath($query['cat']);
$segments[] = implode('/', $path) . '/' . $query['cat'];

unset($query['cat']);
}

if (!empty($query['users'])) {

$username = dutchFactorySefUsername($query['users']);
if ($username) {
$segments[] = 'user/' . $query['users'] . '/' . JFilterOutput::stringURLUnicodeSlug($username);
unset($query['users']);
}
}
break;
case 'userdetails':

$segments[] = $task;

if (!empty($query['id'])) {

$username = dutchFactorySefUsername($query['id']);
if ($username) {
$segments[] = $query['id'];
$segments[] = JFilterOutput::stringURLUnicodeSlug($username);
}
unset($query['id']);
}

break;

default:
if (FALSE == strpos($task, '.')) {
$segments[] = $task;
} else {
$query['task'] = $task;
}

break;
}

return $segments;
}

/**
* dutchFactoryParseRoute
*
* @param $segments
*
* @return array
*/
function dutchFactoryParseRoute($segments)
{

$vars = array();

switch ($segments[0]) {
case 'viewbids':

$vars['task'] = 'viewbids';
// $v=explode(':',$segments[1]);
// $vars['id']=$v[0];

if (isset($segments[2])) {
$segments[2] = str_replace('|', '', $segments[2]);
$vars['id'] = $segments[1] . '|' . $segments[2];
} else {
$vars['id'] = $segments[1];
}

break;
case 'accept':
$vars['task'] = 'accept';
if (isset($segments[2]) && $segments[1] == 'bid') {
$vars['bid'] = $segments[2];
}
break;
case 'search':

$vars['task'] = 'search';

break;
case 'tags':

$vars['task'] = 'tags';
$vars['tagid'] = $segments[1] . ':' . $segments[2];

break;
case 'listauctions':

$vars['task'] = 'listauctions';

$categories = $segments;
unset($categories[0]);

if (isset($segments[1]) && $segments[1] == "user") {
$vars['users'] = $segments[2];
} else {
$vars['cat'] = end($categories);

}
break;
case 'userdetails':

$vars['task'] = 'userdetails';

$userId = isset($segments[1]) ? $segments[1] : 0;
if ($userId) {
$vars['id'] = $userId;
}

break;

case 'listcats':
case 'tree':

$vars['task'] = $segments[0];
if (count($segments) > 1) {
$vars['cat'] = intval(end($segments));
}

break;

default:

$vars['task'] = $segments[0];

break;
}

$needles = array();
if (!empty($vars['task'])) {
$needles["task"] = $vars['task'];
if ($router_itemID = DutchFactoryHelperRoute::getMenuItemId($needles)) {
$vars["Itemid"] = $router_itemID;
}
}

return $vars;
}

/**
* dutchFactorySEFCatPath
*
* @param $catid
*
* @return mixed
*/
function dutchFactorySEFCatPath($catid)
{

static $paths = array();

if (!isset($paths[$catid])) {

$database = JFactory::getDbo();

$q = $database->getQuery(TRUE);
$q->select('p.*')
->from('#__categories c')
->leftJoin('#__categories p ON c.lft BETWEEN p.lft AND p.rgt')
->where('p.extension=\'com_dutchfactory\' AND p.published=1 AND c.id=' . $database->quote($catid))
->order('p.lft ASC');
$database->setQuery($q);
$pathRows = $database->loadObjectList();

$path = array();
foreach ($pathRows as $r) {

if ($r->id == 1) {
//category system root
continue;
}

$path[] = JFilterOutput::stringURLUnicodeSlug($r->title);
}

$paths[$catid] = $path;
}

return $paths[$catid];
}

/**
* dutchFactorySefUsername
*
* @param $userid
*
* @return mixed
*/
function dutchFactorySefUsername($userid)
{

static $usernames = array();

if (!isset($usernames[$userid])) {

$database = JFactory::getDbo();

$q = "SELECT username FROM #__users WHERE id=" . $database->quote($userid);
$database->setQuery($q);
$rec = $database->loadObject();

$usernames[$userid] = empty($rec->username) ? 0 : $rec->username;
}

return $usernames[$userid];
}
 
Tuesday, 10 September 2019 16:50 UTC
wb_weeblr
Hi

It's the router.php file that matters and it should work pretty much the same with Joomla and sh404SEF - if no other plugin for sh404SEF or another extensions is there and breaking the whole thing.

If you have a router.php, it should work, with no need for custom code. 99% of extensions work without specific sh404SEF support.

Best regards
 
Tuesday, 10 September 2019 17:06 UTC
greywing1
Cheers for that

I'm pretty sure you are write in that in will rewrite them, it looks great software. What we were trying to get the system to do was rewrite them automatically according to a rule without us having to rewrite each url individually.

Can I just confirm that you think that this is possible with your software?

Sorry to be a pain, just saves us asking you questions after we have purchased it.

Thanks
 
Tuesday, 10 September 2019 17:16 UTC
wb_weeblr
Hi

Can I just confirm that you think that this is possible with your software?
I can only say that if it works with Joomla SEF it will work with sh404SEF. Will it require some custom coding? I don't see why but you cannot have any guarantee on that. If some custom coding is required, yes we can be hired to do that.

Best regards
 
Tuesday, 10 September 2019 17:33 UTC
greywing1
Perfect, thank you very much. I'll sign up this evening.

Thanks
GW
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.