Scheduler problem

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Scheduler problem

Post by aimeos » 10 Jan 2020, 09:34

The "Aimeos advanced scheduler task" is required e.g. for the product links in the e-mails and the sitemap.

Can you post your site configuration?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 10 Jan 2020, 10:34

Too bad, that's quite an important task haha :)
Site config in typo3/sites/lba/config.yaml
This is my site configuration for the root page and the only one, I have no other root page or site configuration.

----- Begin----

base: 'https://www.productionexample.com/'
baseVariants:
-
base: 'https://localhost10/'
condition: 'applicationContext == "Development"'
errorHandling: { }
languages:
-
title: Deutsch
enabled: true
base: /
typo3Language: de
locale: de_DE.UTF-8
iso-639-1: de
navigationTitle: Deutsch
hreflang: de-DE
direction: ''
flag: de
languageId: '0'
rootPageId: 1
routeEnhancers:
AimeosList:
type: Extbase
namespace: ai
limitToPages:
- 36
routes:
-
routePath: /
_controller: 'Catalog::list'
-
routePath: '/{f_name}~{f_catid}'
_controller: 'Catalog::list'
-
routePath: '/{f_name}~{f_catid}'
_controller: 'Catalog::tree'
AimeosDetail:
type: Extbase
namespace: ai
limitToPages:
- 44
routes:
-
routePath: '/{d_name}'
_controller: 'Catalog::detail'
-
routePath: '/{d_name}/d/{d_prodid}'
_controller: 'Catalog::detail'
-
routePath: '/pin/{pin_action}/{pin_id}/{d_name}'
_controller: 'Catalog::detail'
defaults:
d_pos: ''
AimeosBasket:
type: Extbase
namespace: ai
limitToPages:
- 43
routes:
-
routePath: /
_controller: 'Basket::index'
-
routePath: /{b_action}
_controller: 'Basket::index'
AimeosCheckout:
type: Extbase
namespace: ai
limitToPages:
- 42
routes:
-
routePath: /
_controller: 'Checkout::index'
-
routePath: /{c_step}
_controller: 'Checkout::index'
AimeosConfirm:
type: Simple
limitToPages:
- 41
routePath: /{code}
AimeosProfile:
type: Extbase
namespace: ai
limitToPages:
- 34
routes:
-
routePath: /
_controller: 'Account::index'
-
routePath: /
_controller: 'Account::watch'
-
routePath: /
_controller: 'Account::favorite'
-
routePath: /watch/{wat_action}
_controller: 'Account::watch'
-
routePath: /watch/{wat_action}/{wat_id}
_controller: 'Account::watch'
-
routePath: /fav/{fav_action}
_controller: 'Account::favorite'
-
routePath: /fav/{fav_action}/{fav_id}
_controller: 'Account::favorite'
-
routePath: /history/{his_action}/{his_id}
_controller: 'Account::history'
routes: { }

----- End----

I also attached my page tree. the shortcut of the root page links to Home. (Just for testing all simple solutions I already moved the Shap page tree below Home, but this didn't work)

I didn't post my Aimeos and php version, sorry for that.
Aimeos 19.10.1, Typo3 9.5.11, PHP 7.2.1, testserver Wamp.

While I was looking up the version of Aimeos I realized there are 2 further updates, maybe they will solve something, I should have checked that earlier, but I'm currently working on an offline system due to a new system setup. I will try if the updates change something.

If anything else would be helpful I can provide that. Thank you for your help.
Attachments
Page Tree
Page Tree
Screenshot-2020-1-10 Backend [TYPO3 CMS 9 5 11].png (40.49 KiB) Viewed 3183 times

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 10 Jan 2020, 10:38

As the indentation of the configuration was destroyed in my post, here the original file inside the zip container ;)
Attachments
config.zip
(758 Bytes) Downloaded 150 times

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 10 Jan 2020, 10:53

I did a quick update now and checked the advanced task as well as the frontend sort funcionality, unfortunately it still doesn't work.

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Scheduler problem

Post by aimeos » 10 Jan 2020, 11:18

Here's the relavant site configuration for our test environment:

Code: Select all

rootPageId: 1
base: 'http://127.0.0.1:8000/'
baseVariants: {  }
languages:
  -
    title: Home
    enabled: true
    languageId: '0'
    base: 'http://127.0.0.1:8000/'
    typo3Language: default
    locale: en_US.UTF-8
    iso-639-1: en
    navigationTitle: ''
    hreflang: ''
    direction: ''
    flag: global
errorHandling: {  }
The only notable difference is

Code: Select all

    base: 'http://127.0.0.1:8000/'
in the languages section ("/" in your config)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 10 Jan 2020, 11:59

I really don't know, I tried it with your exact site configuration but everything except the advanced task works. I guess I will do a complete new installation of typo3 and aimeos and see if something changes and as soon as my new system is setup I try it on production server, maybe it is something with the wamp server setup. I'm sure the issue will disappear at some point ;)
Thank you very much for your answers and also for such a great shop system extension!!! :)

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 22 Jan 2020, 13:37

Hey there,
I debugged the code a bit deeper and found out that the error is thrown by a deprecated typo3 function.
aimeos/Classes/Scheduler/Base.php calls

Code: Select all

$rootline = BackendUtility::BEgetRootLine( $pageid );
This still works, but then it calls

Code: Select all

$host = BackendUtility::firstDomainRecord( $rootline );
and this always returns null, debugging a bit deeper showed that firstDomainRecord() is deprecated since typo 3 9.4 and therefore the LegacyDomainResolver handles this. In here the matchRootPageId always returns null, it seems like it doesn't event get called correctly and I didn't find a good solution in here.

Therefore I changed the code of aimeos/Classes/Scheduler/Base.php to the following:

I added

Code: Select all

use TYPO3\CMS\Core\Site\SiteFinder;
and replaced

Code: Select all

$rootline = BackendUtility::BEgetRootLine( $pageid );
$host = BackendUtility::firstDomainRecord( $rootline );
with

Code: Select all

$host = null;
        foreach ($GLOBALS['TSFE']->rootLine as $row) {
            if ($row['is_siteroot'] === 1) {
		$domain = GeneralUtility::makeInstance(SiteFinder::class)
			->getSiteByRootPageId($row['uid'])
			->getBase()
			->getHost();
                $host = rtrim($domain, '/');
		break;
            }
        }
Explanation:
I set the host variable to null. then I loop through the $GLOBALS['TSFE']->rootLine array and check for the first page which is a root page. Then I use site finder to get the domain from the related site configuration and set the host variable to the domain.

If I now debug the last variable in that funciton $_SERVER['HTTP_HOST']

Code: Select all

$_SERVER['HTTP_HOST'] = $host;
this has the following results:
if the site configuration has an entry point

Code: Select all

https://www.example.com/ or https://localhost10/
the $_SERVER['HTTP_HOST'] variable is

Code: Select all

www.example.com or localhost10
Can you tell me if this is the correct behaviour/variable result?

From that point on the error disappears and e.g. a sitemap file is generated with urls (in the normal scheudler task it was without urls). The urls in the sitemap however are not the realURLs, they are followed by e.g.

Code: Select all

?ai%5Bd_name%5D=Demo_article&ai%5Bd_pos%5D=&ai%5Bcontroller%5D=Catalog&ai%5Baction%5D=detail
Is this the expected behaviour? Do search engines (google,etc.) then index this "ugly" url or do they resolve it to the realURL?

And in the scheudler task typoscript configuration I added ...sitemap/location and ...sitemap/baseurl. Am I correct, that I have to set an additional routeEnhancer to make this page accessible because it doesn't work out of the box.

So far I think I got way closer to get everything setup correctly.
Thanks for any answers ;)

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Scheduler problem

Post by aimeos » 22 Jan 2020, 15:26

Thank you for digging through the TYPO3 code! :-)

In the meantime, we also had a response from one of the TYPO3 developers regarding the issue. He suggested to use the SiteFinder class too:

Code: Select all

        $site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pageId);
        $site->getRouter()->generateUri($pageId, ['my-argument' => 13]);
Maybe that code would also generate URLs using the router enhancer rules.

Just for curiosity: Did you create a domain record in the root page (list view of the page with the globe)?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

happy-coding
Posts: 9
Joined: 08 Jan 2020, 15:21

Re: Scheduler problem

Post by happy-coding » 23 Jan 2020, 00:05

Sure, that's the least I can do. Thank you for taking the time for support.
Haha cool thing, I read closer about it here https://docs.typo3.org/m/typo3/referenc ... ation.html and was so caught up with getSiteByRootPageId that I didn't read closer about getSiteByPageId which is faster, cleaner and better.
I now replaced the original

Code: Select all

$rootline = BackendUtility::BEgetRootLine( $pageid );
$host = BackendUtility::firstDomainRecord( $rootline );
with

Code: Select all

$host = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pageId)->getBase()->getHost();
The second Line of your code is cool, but I don't know where this should go, however using this one here above now already creates realURL in the sitemap :D :D :D :roll:
So I guess I have no more questions on that, if I don't encounter further errors, the problem is now solved entirely, thanks for so much help.

Now after all of that I answer your last question, of course I ... didn't. At the end of the day you forgot an obvious configuration step that was so obvious that you simply didn't recognize it anymore. Sorry for causing such a long conversation and time, this solves the problem again.
So now the problem was solved twice with one support answer => genius support answer ;)

Thanks a lot :)

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Scheduler problem

Post by aimeos » 26 Apr 2020, 08:23

@GGamingStudioRespect Which Aimeos version are you using?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply