Customize fabrik_view_url in List View LINKS menu

tesla

New Member
Hello,
I try to change the default fabrik_view_url in List View by placing the following in Custom detail URL field:
catalog/products/product/{fu0_cat_itemid_typeid___ID_raw}-
The result is the link I need with the following addition at the end of the URL: "?rowid=14063"
How where I should make a change in order to remove this addition?
Thank you!
 
You'd have to override the ./components/com_fabrik/layouts/listactions/fabrik-view-link.php layout. See the wiki for how to do that. Basically you copy the file to a matching folder in your site template.

Then you'd have to use preg_replace() on $d->link to remove it, wrapped in a test to make sure you only do it to the right links (as the layout is used by all lists) ... something like ...

Code:
if (strstr($d->link, '/products/') {
   $d->link = preg_replace('/\?rowid=\d+/', '', $d->link);
}

Do that before it gets used to build the button.

-- hugh
 
Try with the "unSEFed" link index.php?option=com_fabrik&view=details&formid=your-formID&rowid={fu0_cat_itemid_typeid___ID_raw}
 
Ah, that might work, yes, as we run the custom link through JRoute::_() prior to feeding it to the layout.

-- hugh
 
Thanks so much hugh and troester, for your suggestions!

I tried to use "unSEFed" links with big hopes but with small success :)
When clicking the details view button I try to open a page outside com_fabrik (it is actually a porduct page build within com_hikashop component). The closest I get is:
Custom detail URL: index.php?option=com_fabrik&view=products&formid=product&rowid={fu0_cat_itemid_typeid___ID_raw}-
Result URL: http://mysite.com/cat/products/product/1047-
while the result I need is: http://mysite.com/catalog/products/product/1047-

"cat" and "catalog" are two different menu items, cat is visible while catalog is hidden and the product page is kind of a submenu in it.

I will now play with the proposed by hugh approach and report back.

Thanks a lot!
 
I thought you want to go to an other Fabrik details view.
If you want to go to something else you have to use a correspondent URL, e.g. index.php?option=com_hikashop&hikashop-params....
(I don't know if it's really com_hikashop).
Best is to temporaryly set sefURL=no and copy the link you need.
 
Best is to temporaryly set sefURL=no and copy the link you need.
I tried but cant even open my homepage (although I changed .htaccess back to htaccess.txt and commented (added #) in the line "RewriteBase /" in this file. So, unable to see the structure of the unsef-ed url ...

I tried also what hugh suggesed and as explained in here: copied the files and then edited the content of the newly copied fabrik-view-button.php so that it is now as follows:
.......................
<a data-loadmethod="<?php echo $d->loadMethod;?>" class="<?php echo $d->class;?> btn-default" <?php echo $d->detailsAttributes; ?>
data-list="<?php echo $d->dataList; ?>" "<?php $d->link = preg_replace('/\?rowid=\d+/', '', $d->link);?>"
href="<?php echo $d->link; ?>" title="<?php echo $d->viewLabel;?>" target="<?php echo $d->viewLinkTarget; ?>">
......................


The "?rowid=" is gone from the URL :)
I will just have to figure out how to embed the "If" clause in the php syntax and mission completed :)
 
Last edited:
Should do.
The file must be in ...\com_fabrik\views\list\tmpl\your-template\layouts\listactions

if (strstr($d->link, '/products/') {
$d->link = preg_replace('/\?rowid=\d+/', '', $d->link);
}

is php code, do it before the HTML
Code:
...
defined('_JEXEC') or die('Restricted access');
$d = $displayData;
if (strstr($d->link, '/products/') {
$d->link = preg_replace('/\?rowid=\d+/', '', $d->link);
}
?>
<a ...


Are you running a recent GitHub update?
And your custom list template is a copy of the recent bootstrap list template?
 
I just edited my previous post because I realised I am coping in the wrong folder (which was: components/com_fabrik/views/list/tmpl/my_bootstrap_disk/listactions) not expecting that someone will respond so quick in Sunday afternoon. Sorry for that and big thank you for so high level of service you provide, troester!!
The path I copied the files and it worked is: templates/rot_purity_iii/html/layouts/com_fabrik/listactions/

Otherwise, yes, I am running a 10days old SVN and bootstrap list template.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top