Example #1
0
 /**
  * Returns product list containing searchable product or its parent and its variants
  *
  * @return oxlist
  */
 public function getProductList()
 {
     if ($this->_oSearchProductList === null) {
         $this->_oSearchProductList = oxNew("oxlist");
         // main search product is found?
         if ($oMainSearchProduct = $this->getMainProduct()) {
             // storing self to first list position
             $this->_oSearchProductList->offsetSet($oMainSearchProduct->getId(), $oMainSearchProduct);
             // adding variants..
             foreach ($oMainSearchProduct->getVariants() as $oVariant) {
                 $this->_oSearchProductList->offsetSet($oVariant->getId(), $oVariant);
             }
         }
     }
     return $this->_oSearchProductList;
 }
Example #2
0
 /**
  * Returns user payment history list object
  *
  * @param string $sOXID object ID (default is null)
  *
  * @return object oxlist with oxuserpayments objects
  */
 public function getUserPayments($sOXID = null)
 {
     if ($this->_oPayments === null) {
         if (!$sOXID) {
             $sOXID = $this->getId();
         }
         $sSelect = 'select * from oxuserpayments where oxuserid = ' . oxDb::getDb()->quote($sOXID) . ' ';
         $this->_oPayments = oxNew('oxlist');
         $this->_oPayments->init('oxUserPayment');
         $this->_oPayments->selectString($sSelect);
         $myUtils = oxUtils::getInstance();
         foreach ($this->_oPayments as $oPayment) {
             // add custom fields to this class
             $oPayment = $myUtils->assignValuesFromText($val->oxuserpayments__oxvalue->value);
         }
     }
     return $this->_oPayments;
 }
Example #3
0
 /**
  * If page number is not passed trying to fetch it from list of ids. To search
  * for position in list, article ids list and current article id must be passed
  *
  * @param int       $iPageNr  current page number (user defined or passed by request)
  * @param oxlist    $oIdList  list of article ids (optional)
  * @param oxarticle $oArticle active article id (optional)
  *
  * @return int
  */
 protected function _findActPageNumber($iPageNr, $oIdList = null, $oArticle = null)
 {
     //page number
     $iPageNr = (int) $iPageNr;
     // maybe there is no page number passed, but we still can find the position in id's list
     if (!$iPageNr && $oIdList && $oArticle) {
         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
         $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
         $sParentIdField = 'oxarticles__oxparentid';
         $sArticleId = $oArticle->{$sParentIdField}->value ? $oArticle->{$sParentIdField}->value : $oArticle->getId();
         $iPos = oxRegistry::getUtils()->arrayStringSearch($sArticleId, $oIdList->arrayKeys());
         $iPageNr = floor($iPos / $iNrofCatArticles);
     }
     return $iPageNr;
 }
Example #4
0
 public function testaListCollectMetaKeyword()
 {
     $sValue = 'agentū Литовfür test best nest fest';
     $sResult = 'agentū литовfür test best nest fest';
     $oArt = oxNew('oxArticle');
     $oArt->setArticleLongDesc($sValue);
     $oArtList = new oxlist();
     $oArtList->offsetSet(0, $oArt);
     $oView = $this->getMock('alist', array('getArticleList', '_prepareMetaDescription', '_getCatPathString'));
     $oView->expects($this->once())->method('getArticleList')->will($this->returnValue($oArtList));
     $oView->expects($this->once())->method('_getCatPathString')->will($this->returnValue(''));
     $oView->expects($this->once())->method('_prepareMetaDescription')->with($this->equalTo($sResult), $this->equalTo(-1), $this->equalTo(false))->will($this->returnValue($sResult));
     $this->assertEquals('agentū, литовfür, test, best, nest, fest', $oView->UNITcollectMetaKeyword(array()));
 }
Example #5
0
 public function testSelectStringIfLimitIsSet()
 {
     $oAction = oxNew("oxBase");
     $oAction->init('oxactions');
     $oAction->setId('_test1');
     $oAction->oxactions__oxtitle = new oxField('action1', oxField::T_RAW);
     $oAction->save();
     $oAction = oxNew("oxBase");
     $oAction->init('oxactions');
     $oAction->setId('_test2');
     $oAction->oxactions__oxtitle = new oxField('action2', oxField::T_RAW);
     $oAction->save();
     $oList = new oxlist('oxactions');
     $oList->setSqlLimit(1, 1);
     $oList->selectString('select * from oxactions where oxid like "\\_%"');
     $this->assertEquals('1', count($oList));
 }
Example #6
0
 /**
  * #0006220 test case
  */
 public function testGetProductPosMixTypeKeys()
 {
     $article = $this->insertArticle('1234567');
     $otherArticle = $this->insertArticle('1234567A');
     $locatorTarget = $this->getMock('oxubase', array('getLinkType'));
     $locatorTarget->expects($this->any())->method('getLinkType')->will($this->returnValue(OXARTICLE_LINKTYPE_CATEGORY));
     $array = array();
     $array['943ed656e21971fb2f1827facbba9bec'] = '943ed656e21971fb2f1827facbba9bec';
     $array['1234567'] = '1234567';
     $array['1234567A'] = '1234567A';
     $array['6b6e718666bc8867719ab25a8020a978'] = '6b6e718666bc8867719ab25a8020a978';
     $list = new oxlist();
     $list->assign($array);
     $locator = new testOxLocator();
     $this->assertSame(2, $locator->UNITgetProductPos($article, $list, $locatorTarget));
     $this->assertNotNull($locator->_oBackProduct);
     $this->assertNotNull($locator->_oNextProduct);
     $this->assertSame('943ed656e21971fb2f1827facbba9bec', $locator->_oBackProduct->getId());
     $this->assertSame('1234567A', $locator->_oNextProduct->getId());
     $locator = new testOxLocator();
     $this->assertSame(3, $locator->UNITgetProductPos($otherArticle, $list, $locatorTarget));
     $this->assertNotNull($locator->_oBackProduct);
     $this->assertNotNull($locator->_oNextProduct);
     $this->assertSame('1234567', $locator->_oBackProduct->getId());
     $this->assertSame('6b6e718666bc8867719ab25a8020a978', $locator->_oNextProduct->getId());
 }