Hallo,
kann man irgendwie einfach $oArticle->getSelectLists() in der Default-Sprache auslesen?
Gruß
Thoni
Hallo,
kann man irgendwie einfach $oArticle->getSelectLists() in der Default-Sprache auslesen?
Gruß
Thoni
Ich würde es so versuchen:
$oArticle->getLanguage();
$oArticle->getSelectLists();
Den Code von cottoneyejoe habe ich nicht ausprobiert, aber Im Frontend halte ich es eher für unwahrscheinlich. Dort werden nur die Daten in der benötigten Sprache geladen und keine anderen (wegen Performance). Da wird nur ein Modul mit einer eigenen Funktion dafür helfen.
Ich würde das so machen:
TPL: productmain
[{assign var="oSelections" value=$oDetailsProduct->[B]getSelectionsNew()[/B]}]
[{if $oSelections}]
<div class="selectorsBox js-fnSubmit clear" id="productSelections">
[{foreach from=$oSelections item=oList name=selections}]
[{include file="widget/product/selectbox.tpl" oSelectionList=$oList sFieldName="sel" iKey=$smarty.foreach.selections.index blHideDefault=true sSelType="seldrop"}]
[{/foreach}]
</div>
[{/if}]
und in oxarticles.php Folgendes einfügen (besser: über ein Modul erweitern):
public function getSelectListsNew($sKeyPrefix = null)
{
//#1468C - more then one article in basket with different selectlist...
//optionall function parameter $sKeyPrefix added, used only in basket.php
$sKey = $this->getId();
if (isset($sKeyPrefix)) {
$sKey = $sKeyPrefix . '__' . $sKey;
}
if (!isset(self::$_aSelList[$sKey])) {
$oDb = oxDb::getDb();
$sSLViewName = getViewName('oxselectlist', 1);
$sQ = "select {$sSLViewName}.* from oxobject2selectlist join {$sSLViewName} on $sSLViewName.oxid=oxobject2selectlist.oxselnid
where oxobject2selectlist.oxobjectid=%s order by oxobject2selectlist.oxsort";
// all selectlists this article has
$oLists = oxNew('oxlist');
$oLists->init('oxselectlist');
$oLists->selectString(sprintf($sQ, $oDb->quote($this->getId())));
//#1104S if this is variant ant it has no selectlists, trying with parent
if ($oLists->count() == 0 && $this->oxarticles__oxparentid->value) {
$oLists->selectString(sprintf($sQ, $oDb->quote($this->oxarticles__oxparentid->value)));
}
// We do not need to calculate price here as there are method to get current article vat
/*if ( $this->getPrice() != null ) {
$dVat = $this->getPrice()->getVat();
}*/
$dVat = $this->getArticleVat();
$iCnt = 0;
self::$_aSelList[$sKey] = array();
foreach ($oLists as $oSelectlist) {
self::$_aSelList[$sKey][$iCnt] = $oSelectlist->getFieldList($dVat);
self::$_aSelList[$sKey][$iCnt]['name'] = $oSelectlist->oxselectlist__oxtitle->value;
$iCnt++;
}
}
return self::$_aSelList[$sKey];
}
Über
$sSLViewName = [B]getViewName('oxselectlist', 1)[/B];
wird die Sprache in dem Fall auf Englisch festgelegt.
Danke,
ich arbeite nicht Vollzeit dran, bin aber schon weiter gekommen.