Page 1 of 1

URL to a product

Posted: 23 Feb 2018, 12:31
by chricken
Hi,

for a business portal, where my products are listed, each product needs a URL to the detail-view.
I generate the data with the scheduler product export. Works fine, but unfortunately it does not export the URL.
Is it possible to get the URL with this export?

Alternatively, I thought, i could recompose the URL.
Unfortunately, I do not understand, how the URL is being composed.
Example:
https://www.insel-weine.de/shop/shop/de ... g_2016_D.O./
I have no clue, where the d/62 is coming from.

Alternatively it would be helpful to trigger the search engine. But again, I don't know, how.
Is there a possibility to interpret string parameters like:
https://www.insel-weine.de/shop/shop?search=galmes

I hope, someone can help me out with this problem.
Regards
Christian

Re: URL to a product

Posted: 23 Feb 2018, 23:20
by aimeos
You should be able to use the "$this->url()" view helper to create URLs to detail pages:
https://aimeos.org/docs/Developers/Html ... helper#url

You only need to configure the page ID of the product detail page in the "Aimeos shop advanced scheduler" used for the product export.

Re: URL to a product

Posted: 05 Mar 2018, 12:11
by chricken
Hi,
thank you for your answer,
but I honestly have no idea, what I have to do :(

I changed the pageID in the scheduler with no effect.
Do I have to do any changes in the typoscript-configuration?

Regards
Christian

Re: URL to a product

Posted: 06 Mar 2018, 23:08
by aimeos
You need to add that code to https://github.com/aimeos/ai-controller ... andard.xml:

Code: Select all

$detailTarget = $this->config( 'client/html/catalog/detail/url/target' );
$detailCntl = $this->config( 'client/html/catalog/detail/url/controller', 'catalog' );
$detailAction = $this->config( 'client/html/catalog/detail/url/action', 'detail' );
$detailConfig = $this->config( 'client/html/catalog/detail/url/config', [] );

$params = array( 'd_name' => $item->getName( 'url' ), 'd_prodid' => $id );
$url = $this->url( $detailTarget, $detailCntl, $detailAction, $params, [], $detailConfig );
This code is from the sitemap template: https://github.com/aimeos/ai-controller ... andard.xml

Re: URL to a product

Posted: 15 Mar 2018, 08:16
by chricken
Sorry for the the delay, had some other issues.

Got it working finally. It wasn't as easy as it looks at first glance.
I had to add a new XML-node, looking like this:

Code: Select all

<detailURL><![CDATA[<?php
$params = array( 'd_name' => $item->getName( 'url' ), 'd_prodid' => $id );
$url = $this->url( $detailTarget, $detailCntl, $detailAction, $params, [], $detailConfig );
echo $url;?>]]></detailURL>


Now I can go on, thank you :)