Пример #1
0
 /**
  * Searches for current article in article list and sets previous/next product ids
  *
  * @param oxarticle $oArticle       current Article
  * @param object    $oIdList        articles list containing only fake article objects !!!
  * @param oxubase   $oLocatorTarget oxubase object
  *
  * @return integer
  */
 protected function _getProductPos($oArticle, $oIdList, $oLocatorTarget)
 {
     $iCnt = 1;
     $iPos = 0;
     // variant handling
     $sOxid = $oArticle->oxarticles__oxparentid->value ? $oArticle->oxarticles__oxparentid->value : $oArticle->getId();
     if ($oIdList->count() && isset($oIdList[$sOxid])) {
         $aIds = $oIdList->arrayKeys();
         $iPos = oxRegistry::getUtils()->arrayStringSearch($sOxid, $aIds);
         if (array_key_exists($iPos - 1, $aIds)) {
             $oBackProduct = oxNew('oxArticle');
             $oBackProduct->modifyCacheKey('_locator');
             $oBackProduct->setNoVariantLoading(true);
             if ($oBackProduct->load($aIds[$iPos - 1])) {
                 $oBackProduct->setLinkType($oLocatorTarget->getLinkType());
                 $this->_oBackProduct = $oBackProduct;
             }
         }
         if (array_key_exists($iPos + 1, $aIds)) {
             $oNextProduct = oxNew('oxArticle');
             $oNextProduct->modifyCacheKey('_locator');
             $oNextProduct->setNoVariantLoading(true);
             if ($oNextProduct->load($aIds[$iPos + 1])) {
                 $oNextProduct->setLinkType($oLocatorTarget->getLinkType());
                 $this->_oNextProduct = $oNextProduct;
             }
         }
         return $iPos + 1;
     }
     return 0;
 }
Пример #2
0
 public function testuBaseRemoveDuplicatedWords()
 {
     $sValue = 'agentū Лито вfü r test best вfü nest fest test agentū лито';
     $sResult = 'agentū, лито, вfü, r, test, best, nest, fest';
     $oView = new oxubase();
     $this->assertEquals($sResult, $oView->UNITremoveDuplicatedWords($sValue));
 }