oxamountpricelist.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxAmountPriceList extends oxList
00008 {
00014     protected $_sObjectsInListName = 'oxprice2article';
00015 
00021     protected $_oArticle = null;
00022 
00028     public function getArticle()
00029     {
00030         return $this->_oArticle;
00031     }
00032 
00040     public function setArticle( $oArticle )
00041     {
00042         $this->_oArticle = $oArticle;
00043     }
00044 
00050     public function __construct()
00051     {
00052         parent::__construct( 'oxbase' );
00053         $this->init( 'oxbase', 'oxprice2article' );
00054     }
00055 
00061     protected function _loadFromDb()
00062     {
00063         $sArticleId = $this->getArticle()->getId();
00064 
00065         if ( !$this->isAdmin() && $this->getConfig()->getConfigParam( 'blVariantInheritAmountPrice' ) && $this->getArticle()->getParentId() ) {
00066             $sArticleId = $this->getArticle()->getParentId();
00067         }
00068 
00069         if ( $this->getConfig()->getConfigParam( 'blMallInterchangeArticles' ) ) {
00070             $sShopSelect = '1';
00071         } else {
00072             $sShopSelect = " `oxshopid` = " . oxDb::getDb()->quote( $this->getConfig()->getShopId() ) . " ";
00073         }
00074 
00075         $sSql =  "SELECT * FROM `oxprice2article` WHERE `oxartid` = " . oxDb::getDb()->quote( $sArticleId ) . " AND $sShopSelect ORDER BY `oxamount` ";
00076 
00077         $aData = oxDb::getDb( oxDb::FETCH_MODE_ASSOC )->getAll( $sSql );
00078 
00079         return $aData;
00080     }
00081 
00082 
00090     public function load( $oArticle )
00091     {
00092         $this->setArticle( $oArticle );
00093 
00094 
00095            $aData = $this->_loadFromDb();
00096 
00097         $this->assignArray( $aData );
00098     }
00099 
00100 }