23 $this->_aViewData[
"edit"] = $oArticle =
oxNew(
"oxarticle");
26 if ( $soxId !=
"-1" && isset( $soxId)) {
29 $oArticle->loadInLang( $this->_iEditLang, $soxId );
32 $oOtherLang = $oArticle->getAvailableInLangs();
33 if (!isset($oOtherLang[$this->_iEditLang])) {
35 $oArticle->loadInLang( key($oOtherLang), $soxId );
38 foreach ( $oOtherLang as $id => $language) {
39 $oLang=
new stdClass();
40 $oLang->sLangDesc = $language;
42 $this->_aViewData[
"otherlang"][$id] = clone $oLang;
47 if ( $oArticle->oxarticles__oxparentid->value) {
48 $oParentArticle =
oxNew(
"oxarticle");
49 $oParentArticle->load( $oArticle->oxarticles__oxparentid->value);
50 $this->_aViewData[
"parentarticle"] = $oParentArticle;
51 $this->_aViewData[
"oxparentid"] = $oArticle->oxarticles__oxparentid->value;
54 if (
$myConfig->getConfigParam(
'blMallInterchangeArticles' ) ) {
58 $sShopSelect =
" oxshopid = '$sShopID' ";
61 $oPriceList =
oxNew(
"oxlist");
62 $oPriceList->init(
'oxbase',
"oxprice2article" );
63 $sQ =
"select * from oxprice2article where oxartid = '$soxId' and {$sShopSelect} and (oxamount > 0 or oxamountto > 0) order by oxamount ";
64 $oPriceList->selectstring( $sQ );
66 $this->_aViewData[
"amountprices"] = $oPriceList;
70 return "article_stock.tpl";
87 $aParams[
'oxarticles__oxshopid'] = $sShopID;
89 $oArticle =
oxNew(
"oxarticle");
90 $oArticle->loadInLang( $this->_iEditLang, $soxId );
92 $oArticle->setLanguage( 0 );
95 if ( !$oArticle->oxarticles__oxparentid->value && !isset( $aParams[
'oxarticles__oxremindactive'])) {
96 $aParams[
'oxarticles__oxremindactive'] = 0;
99 $oArticle->assign( $aParams );
102 $oArticle->setLanguage( $this->_iEditLang );
105 $oArticle->resetRemindStatus();
107 $oArticle->updateVariantsRemind();
120 public function addprice( $sOXID = null, $aUpdateParams = null )
131 if ( !is_array($aParams) ) {
135 if ( isset( $aUpdateParams ) && is_array( $aUpdateParams ) ) {
136 $aParams = array_merge( $aParams, $aUpdateParams );
140 foreach ( $aParams as $key => $sParam ) {
141 $aParams[$key] = str_replace(
",",
".", $sParam );
144 $aParams[
'oxprice2article__oxshopid'] =
$myConfig->getShopID();
146 if ( isset( $sOXID ) ) {
147 $aParams[
'oxprice2article__oxid'] = $sOXID;
150 $aParams[
'oxprice2article__oxartid'] = $sOxArtId;
151 if ( !isset( $aParams[
'oxprice2article__oxamount'] ) || !$aParams[
'oxprice2article__oxamount'] ) {
152 $aParams[
'oxprice2article__oxamount'] =
"1";
155 if ( !
$myConfig->getConfigParam(
'blAllowUnevenAmounts' ) ) {
156 $aParams[
'oxprice2article__oxamount'] = round( (
string ) $aParams[
'oxprice2article__oxamount'] );
157 $aParams[
'oxprice2article__oxamountto'] = round( (
string ) $aParams[
'oxprice2article__oxamountto'] );
160 $dPrice = $aParams[
'price'];
161 $sType = $aParams[
'pricetype'];
163 $oArticlePrice =
oxNew(
"oxbase" );
164 $oArticlePrice->init(
"oxprice2article" );
165 $oArticlePrice->assign( $aParams );
167 $oArticlePrice->$sType =
new oxField( $dPrice );
170 if ($oArticlePrice->$sType->value &&
171 $oArticlePrice->oxprice2article__oxamount->value &&
172 $oArticlePrice->oxprice2article__oxamountto->value &&
173 is_numeric( $oArticlePrice->$sType->value ) &&
174 is_numeric( $oArticlePrice->oxprice2article__oxamount->value ) &&
175 is_numeric( $oArticlePrice->oxprice2article__oxamountto->value ) &&
176 $oArticlePrice->oxprice2article__oxamount->value <= $oArticlePrice->oxprice2article__oxamountto->value
178 $oArticlePrice->save();
182 $oArticle =
oxNew(
"oxArticle");
183 $oArticle->loadInLang( $this->_iEditLang, $sOxArtId );
185 if ( ( $aParams[
'price'] >= $oArticle->oxarticles__oxprice->value) && ($aParams[
'pricetype'] ==
'oxprice2article__oxaddabs' ) ) {
186 if ( is_null($sOXID) ) {
187 $sOXID = $oArticlePrice->getId();
189 $this->_aViewData[
"errorscaleprice"][] = $sOXID;
203 if ( is_array( $aParams ) ) {
204 foreach ( $aParams as $soxId => $aStockParams ) {
205 $this->
addprice( $soxId, $aStockParams );
223 $oDb->execute(
"delete from oxprice2article where oxid = {$sPriceId} and oxartid = {$sId}" );