PHP code example of sioweb / oxid-metadata-multi-select

1. Go to this page and download the library: Download sioweb/oxid-metadata-multi-select library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sioweb / oxid-metadata-multi-select example snippets



$aModule = [
    'settings' => [
        ['group' => 'some_group_name', 'name' => 'aFieldName', 'type' => 'select', 'multiple' => true, 'style' => 'width:400px;', 'constraints' => '1|2|3', 'value' => '']
    ]
];


/**
 * Metadata version
 */
$sMetadataVersion = '2.0';

$sQ = "SELECT oxstdurl, oxobjectid, oxseourl FROM oxseo WHERE oxtype='static' && oxlang = ? && oxshopid = ? GROUP BY oxobjectid ORDER BY oxstdurl";

$oStaticUrlList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oStaticUrlList->init('oxbase', 'oxseo');
$oStaticUrlList->selectString($sQ, [0, 1]);

$aModule = [
    // ...
    'settings' => [
        ['group' => 'some_group_name', 'name' => 'aFieldName', 'type' => 'select', 'multiple' => true, 'value' => '', 'style' => 'width:400px;', 'constraints' => implode('|', array_keys($oStaticUrlList->aList))]
    ]
];


$sLangName = "Deutsch";

$aLang = array(
    'charset' => 'UTF-8',
    'SHOP_MODULE_aFieldName' => 'Multi-Select-Feld',
);


$sQ = "SELECT oxstdurl, oxobjectid, oxseourl FROM oxseo WHERE oxtype='static' && oxlang = ? && oxshopid = ? GROUP BY oxobjectid ORDER BY oxstdurl";

$oStaticUrlList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oStaticUrlList->init('oxbase', 'oxseo');
$oStaticUrlList->selectString($sQ, [0, 1]);
foreach($oStaticUrlList as $key => $oItem) {
    $aLang['SHOP_MODULE_aFieldName_' . $key] = $oItem->oxseo__oxstdurl->getRawValue() . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $oItem->oxseo__oxseourl->getRawValue();
}