OXID eShop CE  4.10.8
 All Classes Namespaces 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 
18 {
19 
28  public function __set($sName, $sValue)
29  {
30  if (strpos($sName, 'oxarticles__oxlongdesc') === 0) {
31  if ($this->_blEmployMultilanguage) {
32  return parent::__set($sName, $sValue);
33  }
34  $this->$sName = $sValue;
35  } else {
36  parent::__set($sName, $sValue);
37  }
38  }
39 
45  protected function _saveArtLongDesc()
46  {
47  if ($this->_blEmployMultilanguage) {
48  return parent::_saveArtLongDesc();
49  }
50 
51 
52  $oArtExt = oxNew('oxi18n');
53  $oArtExt->setEnableMultilang(false);
54  $oArtExt->init('oxartextends');
55  $aObjFields = $oArtExt->_getAllFields(true);
56  if (!$oArtExt->load($this->getId())) {
57  $oArtExt->setId($this->getId());
58  }
59 
60  foreach ($aObjFields as $sKey => $sValue) {
61  if (preg_match('/^oxlongdesc(_(\d{1,2}))?$/', $sKey)) {
62  $sField = $this->_getFieldLongName($sKey);
63  if (isset($this->$sField)) {
64  $sLongDesc = null;
65  if ($this->$sField instanceof oxField) {
66  $sLongDesc = $this->$sField->getRawValue();
67  } elseif (is_object($this->$sField)) {
68  $sLongDesc = $this->$sField->value;
69  }
70  if (isset($sLongDesc)) {
71  $sAEField = $oArtExt->_getFieldLongName($sKey);
72  $oArtExt->$sAEField = new oxField($sLongDesc, oxField::T_RAW);
73  }
74  }
75  }
76  }
77 
78  $oArtExt->save();
79  }
80 }
81 
82 $sArticleClass = 'oxErpArticle450';
83 
84 eval("class oxErpArticle_parent extends $sArticleClass {};");
85 
86 
92 {
93 
99  protected $_blLoadVariants = false;
100 }
101 
102 
107 {
108 
114  public function __construct()
115  {
117 
118  $this->_sTableName = 'oxarticles';
119  $this->_sShopObjectName = 'oxErpArticle';
120  }
121 
131  protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
132  {
133  if (!isset($aData['OXSTOCKFLAG'])) {
134  if (!$aData['OXID'] || !$oShopObject->exists($aData['OXID'])) {
135  // default value is 1 according to eShop admin functionality
136  $aData['OXSTOCKFLAG'] = 1;
137  }
138  }
139 
140  $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
141 
142  return $aData;
143  }
144 
153  protected function _postSaveObject($oShopObject, $aData)
154  {
155  $sOXID = $oShopObject->getId();
156 
157  $oShopObject->onChange(null, $sOXID, $sOXID);
158 
159  // returning ID on success
160  return $sOXID;
161  }
162 
174  public function checkWriteAccess($oObj, $aData = null)
175  {
176  return;
177 
178  }
179 }