devhelper/src/Modules/Application/Model/d3_dev_oxbasketitem.php

67 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright © Data Development, Thomas Dartsch
2018-02-23 12:30:57 +01:00
* @author Data Development - Daniel Seifert <info@shopmodule.com>
* @link http://www.oxidmodule.com
*/
2018-02-23 11:06:24 +01:00
namespace D3\Devhelper\Modules\Application\Model;
2020-11-11 22:29:10 +01:00
use oxArticleInputException;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\OrderArticle;
use OxidEsales\Eshop\Core\Exception\ArticleException;
use OxidEsales\Eshop\Core\Exception\ArticleInputException;
use OxidEsales\Eshop\Core\Exception\NoArticleException;
2020-11-11 22:29:10 +01:00
use oxNoArticleException;
class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
{
public function d3ClearArticle()
{
$this->_oArticle = null;
}
/**
* @return string
* @throws ArticleException
* @throws ArticleInputException
* @throws NoArticleException
*/
public function getTitle()
{
$oArticle = $this->getArticle();
2018-02-23 12:30:57 +01:00
$this->_sTitle = $oArticle->getFieldData('oxtitle');
2018-02-23 12:30:57 +01:00
if ($oArticle->getFieldData('oxvarselect')) {
$this->_sTitle = $this->_sTitle . ', ' . $this->getVarSelect();
}
return $this->_sTitle;
}
/**
2020-11-11 22:29:10 +01:00
* @throws oxArticleInputException
* @throws oxNoArticleException
*/
public function d3ConvertToArticleObject()
{
$oEmbeddedArticle = $this->getArticle();
if ($oEmbeddedArticle instanceof OrderArticle) {
$oArticle = oxNew(Article::class);
$oArticle->load($oEmbeddedArticle->getFieldData('oxartid'));
$this->_oArticle = $oArticle;
}
}
}