OXID eShop CE  4.9.10
 All Classes Files Functions Variables Pages
oxerptype_article.php
Go to the documentation of this file.
1 <?php
2 
3 
4 require_once 'oxerptype.php';
5 
6 $sArticleClass = oxUtilsObject::getInstance()->getClassName('oxarticle');
7 
8 
9 eval("class oxErpArticle450_parent extends $sArticleClass {};");
10 
16 {
17 
26  public function __set($sName, $sValue)
27  {
28  if (strpos($sName, 'oxarticles__oxlongdesc') === 0) {
29  if ($this->_blEmployMultilanguage) {
30  return parent::__set($sName, $sValue);
31  }
32  $this->$sName = $sValue;
33  } else {
34  parent::__set($sName, $sValue);
35  }
36  }
37 
43  protected function _saveArtLongDesc()
44  {
45  if ($this->_blEmployMultilanguage) {
46  return parent::_saveArtLongDesc();
47  }
48 
49 
50  $oArtExt = oxNew('oxi18n');
51  $oArtExt->setEnableMultilang(false);
52  $oArtExt->init('oxartextends');
53  $aObjFields = $oArtExt->_getAllFields(true);
54  if (!$oArtExt->load($this->getId())) {
55  $oArtExt->setId($this->getId());
56  }
57 
58  foreach ($aObjFields as $sKey => $sValue) {
59  if (preg_match('/^oxlongdesc(_(\d{1,2}))?$/', $sKey)) {
60  $sField = $this->_getFieldLongName($sKey);
61  if (isset($this->$sField)) {
62  $sLongDesc = null;
63  if ($this->$sField instanceof oxField) {
64  $sLongDesc = $this->$sField->getRawValue();
65  } elseif (is_object($this->$sField)) {
66  $sLongDesc = $this->$sField->value;
67  }
68  if (isset($sLongDesc)) {
69  $sAEField = $oArtExt->_getFieldLongName($sKey);
70  $oArtExt->$sAEField = new oxField($sLongDesc, oxField::T_RAW);
71  }
72  }
73  }
74  }
75 
76  $oArtExt->save();
77  }
78 }
79 
80 $sArticleClass = 'oxErpArticle450';
81 
82 eval("class oxErpArticle_parent extends $sArticleClass {};");
83 
84 
90 {
91 
97  protected $_blLoadVariants = false;
98 }
99 
100 
105 {
106 
112  public function __construct()
113  {
115 
116  $this->_sTableName = 'oxarticles';
117  $this->_sShopObjectName = 'oxErpArticle';
118  }
119 
129  protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
130  {
131  if (!isset($aData['OXSTOCKFLAG'])) {
132  if (!$aData['OXID'] || !$oShopObject->exists($aData['OXID'])) {
133  // default value is 1 according to eShop admin functionality
134  $aData['OXSTOCKFLAG'] = 1;
135  }
136  }
137 
138  $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
139 
140  return $aData;
141  }
142 
151  protected function _postSaveObject($oShopObject, $aData)
152  {
153  $sOXID = $oShopObject->getId();
154 
155  $oShopObject->onChange(null, $sOXID, $sOXID);
156 
157  // returning ID on success
158  return $sOXID;
159  }
160 
172  public function checkWriteAccess($oObj, $aData = null)
173  {
174  return;
175 
176  }
177 }