Go to the documentation of this file.00001 <?php
00002
00006 class article_bundle_ajax extends ajaxListComponent
00007 {
00013 protected $_blAllowExtColumns = true;
00014
00020 protected $_aColumns = array( 'container1' => array(
00021 array( 'oxartnum', 'oxarticles', 1, 0, 0 ),
00022 array( 'oxtitle', 'oxarticles', 1, 1, 0 ),
00023 array( 'oxean', 'oxarticles', 1, 0, 0 ),
00024 array( 'oxmpn', 'oxarticles', 0, 0, 0 ),
00025 array( 'oxprice', 'oxarticles', 0, 0, 0 ),
00026 array( 'oxstock', 'oxarticles', 0, 0, 0 ),
00027 array( 'oxid', 'oxarticles', 0, 0, 1 )
00028 )
00029 );
00030
00036 protected function _getQuery()
00037 {
00038 $myConfig = $this->getConfig();
00039 $oDb = oxDb::getDb();
00040 $sArticleTable = $this->_getViewName( 'oxarticles' );
00041 $sO2CView = $this->_getViewName( 'oxobject2category' );
00042
00043 $sSelId = oxConfig::getParameter( 'oxid' );
00044 $sSynchSelId = oxConfig::getParameter( 'synchoxid' );
00045
00046
00047 if ( !$sSelId ) {
00048 $sQAdd = " from $sArticleTable where 1 ";
00049 $sQAdd .= $myConfig->getConfigParam( 'blVariantsSelection' )?'':" and $sArticleTable.oxparentid = '' ";
00050 } else {
00051
00052 if ( $sSynchSelId ) {
00053 $sQAdd = " from $sO2CView as oxobject2category left join $sArticleTable on ";
00054 $sQAdd .= $myConfig->getConfigParam( 'blVariantsSelection' )?" ($sArticleTable.oxid=oxobject2category.oxobjectid or $sArticleTable.oxparentid=oxobject2category.oxobjectid)":" $sArticleTable.oxid=oxobject2category.oxobjectid ";
00055 $sQAdd .= " where oxobject2category.oxcatnid = " . $oDb->quote( $sSelId ) . " ";
00056 }
00057 }
00058
00059 $sQAdd .= " and $sArticleTable.oxid IS NOT NULL ";
00060
00061
00062 $sQAdd .= " and $sArticleTable.oxid != " . $oDb->quote( $sSynchSelId ) . " ";
00063
00064 return $sQAdd;
00065 }
00066
00074 protected function _addFilter( $sQ )
00075 {
00076 $sArtTable = $this->_getViewName('oxarticles');
00077 $sQ = parent::_addFilter( $sQ );
00078
00079
00080 $sQ .= $this->getConfig()->getConfigParam( 'blVariantsSelection' ) ? ' group by '.$sArtTable.'.oxid ' : '';
00081 return $sQ;
00082 }
00083
00089 public function removeArticleBundle()
00090 {
00091 $aChosenArt = oxConfig::getParameter( 'oxid');
00092 $oDb = oxDb::getDb();
00093
00094 $sQ = "update oxarticles set oxarticles.oxbundleid = '' where oxarticles.oxid = " . $oDb->quote( $aChosenArt ) . " ";
00095 $oDb->Execute( $sQ );
00096 }
00097
00103 public function addArticleBundle()
00104 {
00105 $sChosenArt = oxConfig::getParameter( 'oxbundleid' );
00106 $soxId = oxConfig::getParameter( 'oxid' );
00107 $oDb = oxDb::getDb();
00108
00109 $sQ = "update oxarticles set oxarticles.oxbundleid = " . $oDb->quote( $sChosenArt ) . " where oxarticles.oxid = " . $oDb->quote( $soxId ) . " ";
00110 $oDb->Execute( $sQ );
00111 }
00112 }