Manually selecting labels by sql
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Manually selecting labels by sql
Hi,
I´m using a TYPO3 provider extension [1] mainly for templating. In the template extensions controller I´m outputting a customized navigation which contains Aimeos catalog categories. I can´t find any docs about the Aimeos model and how catalog (mshop_catalog) and text (mshop_text) entitites relate to each other. I am able to select catalog items but need the text labels for this multi language shop.
Do you have any hints on that? Thanks!
Have sun
Robert.
[1] https://fluidtypo3.org/documentation/te ... sions.html
I´m using a TYPO3 provider extension [1] mainly for templating. In the template extensions controller I´m outputting a customized navigation which contains Aimeos catalog categories. I can´t find any docs about the Aimeos model and how catalog (mshop_catalog) and text (mshop_text) entitites relate to each other. I am able to select catalog items but need the text labels for this multi language shop.
Do you have any hints on that? Thanks!
Have sun
Robert.
[1] https://fluidtypo3.org/documentation/te ... sions.html
Re: Manually selecting labels by sql
Hi Robert
Then, the category texts would be already available in each catalog item. We already have the refactoring on our plan so this will be possible in the next release.
In the meantime, you can use SQL statements like this:
You should not try to merge the statements into one because this will result in a slow query and you need to find out the ID of your site first.
Normally, we do not recommend to access the tables manually but the TYPO3 extension is not modular enough yet to get a context object easily which would enable you to do this:boettner wrote: I´m using a TYPO3 provider extension [1] mainly for templating. In the template extensions controller I´m outputting a customized navigation which contains Aimeos catalog categories. I can´t find any docs about the Aimeos model and how catalog (mshop_catalog) and text (mshop_text) entitites relate to each other. I am able to select catalog items but need the text labels for this multi language shop.
Code: Select all
$manager = MShop_Factory::createManager( $context, 'catalog' );
$tree = $manager->getTree( null, array('text') );
In the meantime, you can use SQL statements like this:
Code: Select all
SELECT * FROM mshop_catalog WHERE siteid=<locale.site.id>
SELECT * FROM mshop_catalog_list WHERE parentid IN (<catalog.ids>) AND siteid=<locale.site.id> AND domain='text'
SELECT * FROM mshop_text t JOIN mshop_text_type tt ON t.typeid=tt.id WHERE id IN (<catalog.list.refids>) AND siteid=<locale.site.id> AND tt.code='name'
Enough, and more than 30°Cboettner wrote: Have sun
Re: Manually selecting labels by sql
If you use the latest code from the master branch (http://aimeos.org/docs/TYPO3/Download_A ... atest_code), you can now access the shop data using the MShop objects from your own TYPO3 extension:
Code: Select all
$path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath( 'aimeos' );
require_once $path . '/Classes/Base.php';
$config = \Aimeos\Aimeos\Base::getConfig();
$context = \Aimeos\Aimeos\Base::getContext( $config );
$localeManager = \MShop_Factory::createManager( $context );
// https://github.com/aimeos/arcavias-core/blob/master/lib/mshoplib/src/MShop/Locale/Manager/Default.php#L114
$localeItem = $localeManager->bootstrap( 'default' );
// set both to null to get all items regardless of language and currency
$localeItem->setLanguageId( null );
$localeItem->setCurrencyId( null );
$context->setLocale( $localeItem );
$manager = \MShop_Factory::createManager( $context, 'catalog' );
$node = $manager->getTree( null, array( 'text' ) );
// $node is a tree of nodes, use getChildren() for next level nodes
$textItems = $node->getRefItems( 'text', 'name' );
// for each text item use getContent() for the text and getLanguageId() for the language code
Re: Manually selecting labels by sql
Hi aimeos,
sun gone, problem solved. Thanks aimeos for your quick support.
Best
Robert.
sun gone, problem solved. Thanks aimeos for your quick support.
It was even simpler in my scenario because there´s only one shop in this installation and I could hardcode the site id in my settings:aimeos wrote: In the meantime, you can use SQL statements like this:Code: Select all
SELECT * FROM mshop_catalog WHERE siteid=<locale.site.id> SELECT * FROM mshop_catalog_list WHERE parentid IN (<catalog.ids>) AND siteid=<locale.site.id> AND domain='text' SELECT * FROM mshop_text t JOIN mshop_text_type tt ON t.typeid=tt.id WHERE id IN (<catalog.list.refids>) AND siteid=<locale.site.id> AND tt.code='name'
Code: Select all
SELECT * FROM mshop_catalog_list WHERE parentid IN (<catalog.ids>) AND siteid=<locale.site.id> AND domain='text'
SELECT * FROM mshop_text WHERE id IN (<catalog.list.refids>) AND siteid=<locale.site.id> AND langid=<$GLOBALS['TSFE']->lang>
Robert.