93 $this->_sParentId = $sParentId;
113 $this->_aSubvariants = $aSubvariants;
134 if (count($aMdSubvariants)) {
135 return reset($aMdSubvariants);
151 foreach ($aSubvariants as $oMdSubvariant) {
152 if (strcasecmp($oMdSubvariant->getName(), $sName) == 0) {
153 return $oMdSubvariant;
157 $oNewSubvariant =
oxNew(
"oxMdVariant");
158 $oNewSubvariant->setName($sName);
159 $oNewSubvariant->setId(md5($sName . $this->
getId()));
160 $oNewSubvariant->setParentId($this->
getId());
163 return $oNewSubvariant;
174 if ($oFirstSubvariant) {
175 return $oFirstSubvariant->getLink();
188 $this->_sName = $sName;
220 foreach ($aVariants as $oVariant) {
221 $dMinVariantPrice = $oVariant->getMinDPrice();
222 if (is_null($dMinPrice)) {
223 $dMinPrice = $dMinVariantPrice;
225 if (!is_null($dMinVariantPrice) && $dMinVariantPrice < $dMinPrice) {
226 $dMinPrice = $dMinVariantPrice;
243 if (!count($aSubvariants)) {
248 foreach ($aSubvariants as $oSubvariant) {
249 if ($oSubvariant->getMaxDepth() > $iMaxDepth) {
250 $iMaxDepth = $oSubvariant->getMaxDepth();
254 return $iMaxDepth + 1;
266 if (!
$myConfig->getConfigParam(
'bl_perfLoadPrice')) {
270 if ($this->_sFPrice) {
282 $sCurrency =
' ' . $this->
getConfig()->getActShopCurrencyObject()->sign;
283 $this->_sFPrice = $sFromPrefix . $sFMinPrice . $sCurrency;
296 public function addNames($sArtId, $aNames, $dPrice, $sUrl)
298 $iCount = count($aNames);
299 $sName = array_shift($aNames);
305 $oVariant->addNames($sArtId, $aNames, $dPrice, $sUrl);
308 $this->_sArticleId = $sArtId;
309 $this->_dPrice = $dPrice;
310 $this->_sUrl = $sUrl;
323 if ($oFirstSubvariant) {
324 return $oFirstSubvariant->getArticleId();
344 foreach ($aSubvariants as $oSubvariant) {
345 if ($oSubvariant->hasArticleId($sArtId)) {
360 $this->_aSubvariants[$oSubvariant->getId()] = $oSubvariant;
372 foreach ($aVariants as $oVariant) {
373 $dVariantPrice = $oVariant->getDPrice();
374 if (is_null($dPrice)) {
375 $dPrice = $dVariantPrice;
377 if (!is_null($dVariantPrice) && $dVariantPrice != $dPrice) {
380 if (!$oVariant->_isFixedPrice()) {