24 $this->_aViewData[
"edit"] = $oArticle =
oxNew(
"oxarticle");
27 if ($soxId !=
"-1" && isset($soxId)) {
30 $oArticle->loadInLang($this->_iEditLang, $soxId);
33 $oOtherLang = $oArticle->getAvailableInLangs();
34 if (!isset($oOtherLang[$this->_iEditLang])) {
36 $oArticle->loadInLang(key($oOtherLang), $soxId);
39 foreach ($oOtherLang as $id => $language) {
40 $oLang =
new stdClass();
41 $oLang->sLangDesc = $language;
43 $this->_aViewData[
"otherlang"][$id] = clone $oLang;
48 if ($oArticle->oxarticles__oxparentid->value) {
49 $oParentArticle =
oxNew(
"oxarticle");
50 $oParentArticle->load($oArticle->oxarticles__oxparentid->value);
51 $this->_aViewData[
"parentarticle"] = $oParentArticle;
52 $this->_aViewData[
"oxparentid"] = $oArticle->oxarticles__oxparentid->value;
55 if (
$myConfig->getConfigParam(
'blMallInterchangeArticles')) {
59 $sShopSelect =
" oxshopid = '$sShopID' ";
62 $oPriceList =
oxNew(
"oxlist");
63 $oPriceList->init(
'oxbase',
"oxprice2article");
64 $sQ =
"select * from oxprice2article where oxartid = '{$soxId}' " .
65 "and {$sShopSelect} and (oxamount > 0 or oxamountto > 0) order by oxamount ";
66 $oPriceList->selectstring($sQ);
68 $this->_aViewData[
"amountprices"] = $oPriceList;
72 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)
132 if (!is_array($aParams)) {
136 if (isset($aUpdateParams) && is_array($aUpdateParams)) {
137 $aParams = array_merge($aParams, $aUpdateParams);
141 foreach ($aParams as $key => $sParam) {
142 $aParams[$key] = str_replace(
",",
".", $sParam);
145 $aParams[
'oxprice2article__oxshopid'] =
$myConfig->getShopID();
148 $aParams[
'oxprice2article__oxid'] = $sOXID;
151 $aParams[
'oxprice2article__oxartid'] = $sOxArtId;
152 if (!isset($aParams[
'oxprice2article__oxamount']) || !$aParams[
'oxprice2article__oxamount']) {
153 $aParams[
'oxprice2article__oxamount'] =
"1";
156 if (!
$myConfig->getConfigParam(
'blAllowUnevenAmounts')) {
157 $aParams[
'oxprice2article__oxamount'] = round((
string ) $aParams[
'oxprice2article__oxamount']);
158 $aParams[
'oxprice2article__oxamountto'] = round((
string ) $aParams[
'oxprice2article__oxamountto']);
161 $dPrice = $aParams[
'price'];
162 $sType = $aParams[
'pricetype'];
164 $oArticlePrice =
oxNew(
"oxbase");
165 $oArticlePrice->init(
"oxprice2article");
166 $oArticlePrice->assign($aParams);
168 $oArticlePrice->$sType =
new oxField($dPrice);
171 if ($oArticlePrice->$sType->value &&
172 $oArticlePrice->oxprice2article__oxamount->value &&
173 $oArticlePrice->oxprice2article__oxamountto->value &&
174 is_numeric($oArticlePrice->$sType->value) &&
175 is_numeric($oArticlePrice->oxprice2article__oxamount->value) &&
176 is_numeric($oArticlePrice->oxprice2article__oxamountto->value) &&
177 $oArticlePrice->oxprice2article__oxamount->value <= $oArticlePrice->oxprice2article__oxamountto->value
179 $oArticlePrice->save();
183 $oArticle =
oxNew(
"oxArticle");
184 $oArticle->loadInLang($this->_iEditLang, $sOxArtId);
185 $sPriceField =
'oxarticles__oxprice';
186 if (($aParams[
'price'] >= $oArticle->$sPriceField->value) &&
187 ($aParams[
'pricetype'] ==
'oxprice2article__oxaddabs')) {
188 if (is_null($sOXID)) {
189 $sOXID = $oArticlePrice->getId();
191 $this->_aViewData[
"errorscaleprice"][] = $sOXID;
203 if (is_array($aParams)) {
204 foreach ($aParams as $soxId => $aStockParams) {
205 $this->
addprice($soxId, $aStockParams);
221 $oDb->execute(
"delete from oxprice2article where oxid = {$sPriceId} and oxartid = {$sId}");