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