update for OXID 6.2

This commit is contained in:
Daniel Seifert 2020-11-11 22:29:10 +01:00
parent 11d4227874
commit d1c1ba90b8
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
11 changed files with 219 additions and 100 deletions

View File

@ -4,6 +4,7 @@ namespace D3\Devhelper\Application\Controller;
use D3\Devhelper\Modules\Application\Controller as ModuleController; use D3\Devhelper\Modules\Application\Controller as ModuleController;
use D3\Devhelper\Modules\Core as ModuleCore; use D3\Devhelper\Modules\Core as ModuleCore;
use Exception;
use OxidEsales\Eshop\Application\Controller\FrontendController; use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Application\Controller\ThankYouController; use OxidEsales\Eshop\Application\Controller\ThankYouController;
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;
@ -12,7 +13,6 @@ use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\UserException; use OxidEsales\Eshop\Core\Exception\UserException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
/** /**
* This Software is the property of Data Development and is protected * This Software is the property of Data Development and is protected
@ -41,8 +41,8 @@ class d3dev extends FrontendController
protected function _authenticate () protected function _authenticate ()
{ {
try { try {
$sUser = Registry::get(Request::class)->getRequestEscapedParameter('usr'); $sUser = Registry::getRequest()->getRequestEscapedParameter('usr');
$sPassword = Registry::get(Request::class)->getRequestEscapedParameter('pwd'); $sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
if ( !$sUser || !$sPassword ) { if ( !$sUser || !$sPassword ) {
$sUser = $_SERVER[ 'PHP_AUTH_USER' ]; $sUser = $_SERVER[ 'PHP_AUTH_USER' ];
@ -67,13 +67,10 @@ class d3dev extends FrontendController
} }
$oUser = oxNew( User::class ); $oUser = oxNew( User::class );
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) { if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
/** @var UserException $oEx */ throw oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
$oEx = oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
throw $oEx;
} }
} }
catch ( \Exception $oEx ) { catch ( Exception $oEx ) {
$oShop = Registry::getConfig()->getActiveShop(); $oShop = Registry::getConfig()->getActiveShop();
header( 'WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"' ); header( 'WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"' );
header( 'HTTP/1.0 401 Unauthorized' ); header( 'HTTP/1.0 401 Unauthorized' );
@ -90,12 +87,12 @@ class d3dev extends FrontendController
header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset')); header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset'));
if (Registry::getConfig()->getActiveShop()->isProductiveMode() if (Registry::getConfig()->getActiveShop()->isProductiveMode()
|| false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') || false == Registry::getConfig()->getConfigParam(ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER)
) { ) {
Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start');
} }
$sTpl = Registry::get(Request::class)->getRequestEscapedParameter('type'); $sTpl = Registry::getRequest()->getRequestEscapedParameter('type');
/** @var ModuleController\d3_dev_thankyou $oThankyou */ /** @var ModuleController\d3_dev_thankyou $oThankyou */
$oThankyou = oxNew(ThankYouController::class); $oThankyou = oxNew(ThankYouController::class);
@ -113,12 +110,12 @@ class d3dev extends FrontendController
public function showInquiryMailContent() public function showInquiryMailContent()
{ {
if (Registry::getConfig()->getActiveShop()->isProductiveMode() if (Registry::getConfig()->getActiveShop()->isProductiveMode()
|| false == Registry::getConfig()->getConfigParam('blD3DevShowOrderMailsInBrowser') || false == Registry::getConfig()->getConfigParam(ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER)
) { ) {
Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start'); Registry::getUtils()->redirect(Registry::getConfig()->getShopUrl().'index.php?cl=start');
} }
$sTpl = Registry::get(Request::class)->getRequestEscapedParameter('type'); $sTpl = Registry::getRequest()->getRequestEscapedParameter('type');
/** @var ModuleController\d3_dev_thankyou $oThankyou */ /** @var ModuleController\d3_dev_thankyou $oThankyou */
$oThankyou = oxNew(ThankYouController::class); $oThankyou = oxNew(ThankYouController::class);

View File

@ -16,27 +16,40 @@
namespace D3\Devhelper\Modules\Application\Controller namespace D3\Devhelper\Modules\Application\Controller
{ {
class d3_dev_thankyou_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {}
use OxidEsales\Eshop\Application\Controller\ThankYouController;
class d3_dev_thankyou_parent extends ThankYouController {}
} }
namespace D3\Devhelper\Modules\Application\Model namespace D3\Devhelper\Modules\Application\Model
{ {
class d3_dev_oxorder_parent extends \OxidEsales\Eshop\Application\Model\Order {}
use OxidEsales\Eshop\Application\Controller\OrderController;
use OxidEsales\Eshop\Application\Model\Basket;
use OxidEsales\Eshop\Application\Model\BasketItem;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\OrderArticle;
class d3_dev_oxorder_parent extends Order {}
class d3_dev_d3inquiry_parent extends d3inquiry {} class d3_dev_d3inquiry_parent extends d3inquiry {}
class d3_dev_d3inquiryarticle_parent extends d3inquiryarticle {} class d3_dev_d3inquiryarticle_parent extends d3inquiryarticle {}
class d3_dev_oxorderarticle_parent extends \OxidEsales\Eshop\Application\Model\OrderArticle {} class d3_dev_oxorderarticle_parent extends OrderArticle {}
class d3_dev_oxbasket_parent extends \OxidEsales\Eshop\Application\Model\Basket {} class d3_dev_oxbasket_parent extends Basket {}
class d3_dev_oxbasketitem_parent extends \OxidEsales\Eshop\Application\Model\BasketItem {} class d3_dev_oxbasketitem_parent extends BasketItem {}
class d3_dev_order_parent extends \OxidEsales\Eshop\Application\Controller\OrderController {} class d3_dev_order_parent extends OrderController {}
} }
namespace D3\Devhelper\Modules\Core namespace D3\Devhelper\Modules\Core
{ {
class d3_dev_oxemail_parent extends \OxidEsales\Eshop\Core\Email {}
use OxidEsales\Eshop\Core\Email;
class d3_dev_oxemail_parent extends Email {}
} }

View File

@ -5,13 +5,15 @@ namespace D3\Devhelper\Modules\Application\Controller;
// .../?cl=thankyou[&d3orderid=23] // .../?cl=thankyou[&d3orderid=23]
use D3\Devhelper\Modules\Application\Model\d3_dev_d3inquiry; use D3\Devhelper\Modules\Application\Model\d3_dev_d3inquiry;
use D3\Devhelper\Modules\Application\Model\d3_dev_oxorder; use D3\Devhelper\Modules\Application\Model\d3_dev_oxorder;
use D3\Devhelper\Modules\Core\d3_dev_conf;
use Exception;
use OxidEsales\Eshop\Application\Model\Order; use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Exception\UserException; use OxidEsales\Eshop\Core\Exception\UserException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request; use oxOrder;
/** /**
* This Software is the property of Data Development and is protected * This Software is the property of Data Development and is protected
@ -40,29 +42,53 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
parent::init(); parent::init();
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev") if (Registry::getRequest()->getRequestEscapedParameter("d3dev")
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode() && false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
&& Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket') && Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_PREVENTDELBASKET)
) { ) {
Registry::getSession()->setVariable( 'sess_challenge', $sSessChallenge ); Registry::getSession()->setVariable( 'sess_challenge', $sSessChallenge );
} }
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev") if ($this->d3DevCanShowThankyou()) {
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
&& Registry::getConfig()->getConfigParam('blD3DevShowThankyou')
) {
$this->_d3authenticate(); $this->_d3authenticate();
$oOrder = $this->d3GetLastOrder(); $oOrder = $this->d3GetLastOrder();
$oBasket = $oOrder->d3DevGetOrderBasket(); $this->_oBasket = $oOrder->d3DevGetOrderBasket();
$this->_oBasket = $oBasket;
} }
} }
/**
* @return bool
*/
public function d3DevCanShowThankyou()
{
return Registry::getRequest()->getRequestEscapedParameter("d3dev")
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
&& Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_SHOWTHANKYOU);
}
/**
* @return string
*/
public function render()
{
if ($this->d3DevCanShowThankyou()) {
$currentClass = $this->getViewConfig()->getViewConfigParam('cl');
}
$ret = parent::render();
if ($this->d3DevCanShowThankyou()) {
$this->getViewConfig()->setViewConfigParam('cl', $currentClass);
}
return $ret;
}
protected function _d3authenticate () protected function _d3authenticate ()
{ {
try { try {
$sUser = Registry::get(Request::class)->getRequestEscapedParameter( 'usr'); $sUser = Registry::getRequest()->getRequestEscapedParameter( 'usr');
$sPassword = Registry::get(Request::class)->getRequestEscapedParameter('pwd'); $sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
if ( !$sUser || !$sPassword ) { if ( !$sUser || !$sPassword ) {
$sUser = $_SERVER[ 'PHP_AUTH_USER' ]; $sUser = $_SERVER[ 'PHP_AUTH_USER' ];
@ -93,7 +119,7 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
throw $oEx; throw $oEx;
} }
} }
catch ( \Exception $oEx ) { catch ( Exception $oEx ) {
$oShop = Registry::getConfig()->getActiveShop(); $oShop = Registry::getConfig()->getActiveShop();
header( 'WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"' ); header( 'WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"' );
header( 'HTTP/1.0 401 Unauthorized' ); header( 'HTTP/1.0 401 Unauthorized' );
@ -102,7 +128,7 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
} }
/** /**
* @return bool|d3_dev_oxorder|\oxOrder * @return bool|d3_dev_oxorder|oxOrder
* @throws DatabaseConnectionException * @throws DatabaseConnectionException
* @throws DatabaseErrorException * @throws DatabaseErrorException
*/ */
@ -111,12 +137,18 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
$oOrder = parent::getOrder(); $oOrder = parent::getOrder();
if ((false == $oOrder || !$oOrder->getFieldData('oxordernr')) if ((false == $oOrder || !$oOrder->getFieldData('oxordernr'))
&& Registry::get(Request::class)->getRequestEscapedParameter("d3dev") && $this->d3DevCanShowThankyou()
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
&& Registry::getConfig()->getConfigParam('blD3DevShowThankyou')
) { ) {
$this->_oOrder = $this->d3GetLastOrder(); try {
$oOrder = $this->_oOrder; $this->_oOrder = $this->d3GetLastOrder();
$oOrder = $this->_oOrder;
if (!$oOrder || !$oOrder->getFieldData('oxordernr')) {
throw oxNew(\RuntimeException::class, 'unknown order');
}
} catch (Exception $e) {
die($e->getMessage());
}
} }
return $oOrder; return $oOrder;

View File

@ -7,7 +7,6 @@ use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
/** /**
* This Software is the property of Data Development and is protected * This Software is the property of Data Development and is protected
@ -61,7 +60,7 @@ class d3_dev_d3inquiry extends d3_dev_d3inquiry_parent
*/ */
public function d3getLastInquiryId() public function d3getLastInquiryId()
{ {
$inquiryNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3inquirynr'); $inquiryNr = (int) Registry::getRequest()->getRequestEscapedParameter('d3inquirynr');
$sWhere = 1; $sWhere = 1;
if ($inquiryNr) { if ($inquiryNr) {
$sWhere = ' oxinquirynr = ' . $inquiryNr; $sWhere = ' oxinquirynr = ' . $inquiryNr;

View File

@ -17,16 +17,19 @@
namespace D3\Devhelper\Modules\Application\Model; namespace D3\Devhelper\Modules\Application\Model;
use D3\Devhelper\Modules\Core\d3_dev_conf;
use oxArticleInputException;
use OxidEsales\Eshop\Application\Model\BasketItem; use OxidEsales\Eshop\Application\Model\BasketItem;
use OxidEsales\Eshop\Application\Model\OrderArticle; use OxidEsales\Eshop\Application\Model\OrderArticle;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use oxNoArticleException;
class d3_dev_oxbasket extends d3_dev_oxbasket_parent class d3_dev_oxbasket extends d3_dev_oxbasket_parent
{ {
public function deleteBasket() public function deleteBasket()
{ {
if (Registry::getConfig()->getActiveShop()->isProductiveMode() if (Registry::getConfig()->getActiveShop()->isProductiveMode()
|| false == Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket') || false == Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_PREVENTDELBASKET)
) { ) {
parent::deleteBasket(); parent::deleteBasket();
} }
@ -67,14 +70,14 @@ class d3_dev_oxbasket extends d3_dev_oxbasket_parent
/** /**
* @param OrderArticle $oOrderArticle * @param OrderArticle $oOrderArticle
* *
* @return |null * @return null
* @throws \oxArticleInputException * @throws oxArticleInputException
* @throws \oxNoArticleException * @throws oxNoArticleException
*/ */
public function d3addOrderArticleToBasket($oOrderArticle) public function d3addOrderArticleToBasket($oOrderArticle)
{ {
// adding only if amount > 0 // adding only if amount > 0
if ($oOrderArticle->oxorderarticles__oxamount->value > 0) { if ($oOrderArticle->getFieldData('oxamount') > 0) {
$this->_isForOrderRecalculation = true; $this->_isForOrderRecalculation = true;
$sItemId = $oOrderArticle->getId(); $sItemId = $oOrderArticle->getId();
@ -83,7 +86,7 @@ class d3_dev_oxbasket extends d3_dev_oxbasket_parent
$oBasketItem = oxNew( BasketItem::class); $oBasketItem = oxNew( BasketItem::class);
$oBasketItem->initFromOrderArticle($oOrderArticle); $oBasketItem->initFromOrderArticle($oOrderArticle);
$oBasketItem->d3ConvertToArticleObject(); $oBasketItem->d3ConvertToArticleObject();
$oBasketItem->setWrapping($oOrderArticle->oxorderarticles__oxwrapid->value); $oBasketItem->setWrapping($oOrderArticle->getFieldData('oxwrapid'));
$oBasketItem->setBundle($oOrderArticle->isBundle()); $oBasketItem->setBundle($oOrderArticle->isBundle());
$this->_aBasketContents[$sItemId] = $oBasketItem; $this->_aBasketContents[$sItemId] = $oBasketItem;

View File

@ -16,11 +16,13 @@
namespace D3\Devhelper\Modules\Application\Model; namespace D3\Devhelper\Modules\Application\Model;
use oxArticleInputException;
use OxidEsales\Eshop\Application\Model\Article; use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\OrderArticle; use OxidEsales\Eshop\Application\Model\OrderArticle;
use OxidEsales\Eshop\Core\Exception\ArticleException; use OxidEsales\Eshop\Core\Exception\ArticleException;
use OxidEsales\Eshop\Core\Exception\ArticleInputException; use OxidEsales\Eshop\Core\Exception\ArticleInputException;
use OxidEsales\Eshop\Core\Exception\NoArticleException; use OxidEsales\Eshop\Core\Exception\NoArticleException;
use oxNoArticleException;
class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
{ {
@ -48,8 +50,8 @@ class d3_dev_oxbasketitem extends d3_dev_oxbasketitem_parent
} }
/** /**
* @throws \oxArticleInputException * @throws oxArticleInputException
* @throws \oxNoArticleException * @throws oxNoArticleException
*/ */
public function d3ConvertToArticleObject() public function d3ConvertToArticleObject()
{ {

View File

@ -17,13 +17,16 @@
namespace D3\Devhelper\Modules\Application\Model; namespace D3\Devhelper\Modules\Application\Model;
use oxarticleinputexception;
use OxidEsales\Eshop\Application\Model\Basket;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Voucher; use OxidEsales\Eshop\Application\Model\Voucher;
use OxidEsales\Eshop\Core\DatabaseProvider; use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Model\ListModel; use OxidEsales\Eshop\Core\Model\ListModel;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request; use oxnoarticleexception;
class d3_dev_oxorder extends d3_dev_oxorder_parent class d3_dev_oxorder extends d3_dev_oxorder_parent
{ {
@ -53,13 +56,13 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
*/ */
public function d3getLastOrderId() public function d3getLastOrderId()
{ {
$orderNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3ordernr'); $orderNr = (int) Registry::getRequest()->getRequestEscapedParameter('d3ordernr');
$sWhere = 1; $sWhere = 1;
if ($orderNr) { if ($orderNr) {
$sWhere = ' oxordernr = ' . DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($orderNr); $sWhere = ' oxordernr = ' . DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($orderNr);
} }
$sSelect = "SELECT oxid FROM ".getViewName('oxorder')." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1"; $sSelect = "SELECT oxid FROM ".oxNew(Order::class)->getViewName()." WHERE ".$sWhere." ORDER BY oxorderdate DESC LIMIT 1";
return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect); return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getOne($sSelect);
} }
@ -75,7 +78,7 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
} }
/** /**
* @return d3_dev_oxbasket|\OxidEsales\Eshop\Application\Model\Basket * @return d3_dev_oxbasket|Basket
*/ */
public function getBasket() public function getBasket()
{ {
@ -94,9 +97,12 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
*/ */
protected function _d3AddVouchers() protected function _d3AddVouchers()
{ {
$sSelect = "SELECT oxid FROM oxvouchers WHERE oxorderid = ".DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->quote($this->getId()).";"; $sSelect = "SELECT oxid FROM ".oxNew(Voucher::class)->getViewName()." WHERE oxorderid = ?";
$aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll($sSelect); $aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->getAll(
$sSelect,
[$this->getId()]
);
foreach ($aResult as $aFields) { foreach ($aResult as $aFields) {
$oVoucher = oxNew(Voucher::class); $oVoucher = oxNew(Voucher::class);
@ -110,6 +116,8 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
* *
* @param d3_dev_oxbasket $oBasket basket object * @param d3_dev_oxbasket $oBasket basket object
* @param ListModel $aOrderArticles order articles * @param ListModel $aOrderArticles order articles
* @throws oxArticleInputException
* @throws oxNoArticleException
*/ */
protected function _d3AddOrderArticlesToBasket($oBasket, $aOrderArticles) protected function _d3AddOrderArticlesToBasket($oBasket, $aOrderArticles)
{ {

View File

@ -27,6 +27,9 @@ class d3_dev_oxorderarticle extends d3_dev_oxorderarticle_parent
{ {
$oArticle = $this->getArticle(); $oArticle = $this->getArticle();
return $oArticle->getCustomerAlsoBoughtThisProducts(); /** @var ArticleList $artList */
$artList = $oArticle->getCustomerAlsoBoughtThisProducts();
return $artList;
} }
} }

View File

@ -0,0 +1,29 @@
<?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
* @author Data Development - Daniel Seifert <info@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\Devhelper\Modules\Core;
class d3_dev_conf
{
const OPTION_PREVENTDELBASKET = 'blD3DevAvoidDelBasket';
const OPTION_SHOWTHANKYOU = 'blD3DevShowThankyou';
const OPTION_SHOWMAILSINBROWSER = 'blD3DevShowOrderMailsInBrowser';
const OPTION_BLOCKMAIL = 'blD3DevBlockMails';
const OPTION_REDIRECTMAIL = 'sD3DevRedirectMail';
}

View File

@ -20,6 +20,10 @@ namespace D3\Devhelper\Modules\Core;
use D3\Devhelper\Modules\Application\Model as ModuleModel; use D3\Devhelper\Modules\Application\Model as ModuleModel;
use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Framework\Smarty\Bridge\SmartyTemplateRendererBridge;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
use Smarty;
class d3_dev_oxemail extends d3_dev_oxemail_parent class d3_dev_oxemail extends d3_dev_oxemail_parent
{ {
@ -49,7 +53,7 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
$sTpl = $this->_sOrderUserTemplate; $sTpl = $this->_sOrderUserTemplate;
} }
$myConfig = $this->getConfig(); $myConfig = Registry::getConfig();
$oShop = $this->_getShop(); $oShop = $this->_getShop();
@ -78,14 +82,36 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
$this->setSmtp($oShop); $this->setSmtp($oShop);
// create messages // create messages
/** @var \Smarty $oSmarty */
$oSmarty = $this->_getSmarty();
$this->setViewData("order", $oOrder); $this->setViewData("order", $oOrder);
// Process view data array through oxoutput processor // Process view data array through oxoutput processor
$this->_processViewArray(); $this->_processViewArray();
return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); if (class_exists(SmartyTemplateRendererBridge::class)) {
$renderer = $this->getRenderer();
$ret = $renderer->renderTemplate($myConfig->getTemplatePath($sTpl, false), $this->getViewData());
} else {
/** @var Smarty $oSmarty */
$oSmarty = $this->_getSmarty();
$ret = $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false));
}
return $ret;
}
/**
* from OXID 6.2, required because private in Email class
* Templating instance getter
*
* @return TemplateRendererInterface
*/
protected function getRenderer()
{
$bridge = \OxidEsales\EshopCommunity\Internal\Container\ContainerFactory::getInstance()->getContainer()
->get(TemplateRendererBridgeInterface::class);
$bridge->setEngine($this->_getSmarty());
return $bridge->getTemplateRenderer();
} }
/** /**
@ -116,7 +142,7 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
$sTpl = $this->_sInquiryUserTemplate; $sTpl = $this->_sInquiryUserTemplate;
} }
$myConfig = $this->getConfig(); $myConfig = Registry::getConfig();
$oShop = $this->_getShop(); $oShop = $this->_getShop();
@ -145,14 +171,21 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
$this->setSmtp($oShop); $this->setSmtp($oShop);
// create messages // create messages
/** @var \Smarty $oSmarty */
$oSmarty = $this->_getSmarty();
$this->setViewData("inquiry", $oInquiry); $this->setViewData("inquiry", $oInquiry);
// Process view data array through oxoutput processor // Process view data array through oxoutput processor
$this->_processViewArray(); $this->_processViewArray();
return $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false)); if (class_exists(SmartyTemplateRendererBridge::class)) {
$renderer = $this->getRenderer();
$ret = $renderer->renderTemplate($myConfig->getTemplatePath($sTpl, false), $this->getViewData());
} else {
/** @var Smarty $oSmarty */
$oSmarty = $this->_getSmarty();
$ret = $oSmarty->fetch($myConfig->getTemplatePath($sTpl, false));
}
return $ret;
} }
/** /**
@ -282,10 +315,10 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
*/ */
public function getNewRecipient($sMailAddress) public function getNewRecipient($sMailAddress)
{ {
if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) { if (Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_BLOCKMAIL)) {
return false; return false;
} elseif (Registry::getConfig()->getConfigParam('sD3DevRedirectMail')) { } elseif (Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_REDIRECTMAIL)) {
return trim(Registry::getConfig()->getConfigParam('sD3DevRedirectMail')); return trim(Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_REDIRECTMAIL));
} }
return $sMailAddress; return $sMailAddress;

View File

@ -1,5 +1,6 @@
<?php <?php
use D3\Devhelper\Application\Controller\d3dev;
use D3\Devhelper\Modules\Core as ModuleCore; use D3\Devhelper\Modules\Core as ModuleCore;
use D3\Devhelper\Modules\Application\Controller as ModuleController; use D3\Devhelper\Modules\Application\Controller as ModuleController;
use D3\Devhelper\Modules\Application\Model as ModuleModel; use D3\Devhelper\Modules\Application\Model as ModuleModel;
@ -12,19 +13,21 @@ use OxidEsales\Eshop\Core\Registry;
* Metadata version * Metadata version
*/ */
$sMetadataVersion = '2.0'; $sMetadataVersion = '2.0';
$sLogo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em"> ';
/** /**
* Module information * Module information
*/ */
$aModule = array( $aModule = array(
'id' => 'd3dev', 'id' => 'd3dev',
'title' => 'title' => [
'<svg style="height:1em;width:1em"><image xlink:href="https://logos.oxidmodule.com/d3logo.svg" style="height:1em;width:1em" /></svg> '. 'de' => $sLogo . 'TPL Entwicklerwerkzeug',
'TPL Development Tool', 'en' => $sLogo . 'TPL Development Tool'
'description' => array( ],
'description' => [
'de' => '<script type="text/javascript"><!-- 'de' => '<script type="text/javascript"><!--
function showNote() { function showNote() {
var _oElem = document.getElementById("secnote"); let _oElem = document.getElementById("secnote");
if (_oElem.style.display === "block") { if (_oElem.style.display === "block") {
_oElem.style.display = "none"; _oElem.style.display = "none";
} else { } else {
@ -50,60 +53,57 @@ $aModule = array(
'<li>blockiert &uuml;bers Framework versendete Mails oder leitet diese um</li>'. '<li>blockiert &uuml;bers Framework versendete Mails oder leitet diese um</li>'.
'</ul><br>Jede dieser Optionen muss aus Sicherheitsgr&uuml;nden unter "Einstell." aktiviert werden. Weiterhin darf der Shop nicht im Produktivmodus betrieben werden.<br><br>'. '</ul><br>Jede dieser Optionen muss aus Sicherheitsgr&uuml;nden unter "Einstell." aktiviert werden. Weiterhin darf der Shop nicht im Produktivmodus betrieben werden.<br><br>'.
'* Ordernummer an URL erg&auml;nzen, wenn bestimmte Bestellungen angezeigt werden sollen', '* Ordernummer an URL erg&auml;nzen, wenn bestimmte Bestellungen angezeigt werden sollen',
'en' => ''), 'en' => ''],
'version' => '2.0.1.0', 'version' => '2.1.0.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)', 'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/', 'url' => 'http://www.oxidmodule.com/',
'extend' => array( 'extend' => [
OxidController\ThankYouController::class => ModuleController\d3_dev_thankyou::class, OxidController\ThankYouController::class => ModuleController\d3_dev_thankyou::class,
OxidModel\Order::class => ModuleModel\d3_dev_oxorder::class, OxidModel\Order::class => ModuleModel\d3_dev_oxorder::class,
OxidModel\OrderArticle::class => ModuleModel\d3_dev_oxorderarticle::class, OxidModel\OrderArticle::class => ModuleModel\d3_dev_oxorderarticle::class,
OxidCore\Email::class => ModuleCore\d3_dev_oxemail::class, OxidCore\Email::class => ModuleCore\d3_dev_oxemail::class,
OxidModel\Basket::class => ModuleModel\d3_dev_oxbasket::class, OxidModel\Basket::class => ModuleModel\d3_dev_oxbasket::class,
OxidModel\BasketItem::class => ModuleModel\d3_dev_oxbasketitem::class, OxidModel\BasketItem::class => ModuleModel\d3_dev_oxbasketitem::class,
), ],
'controllers' => array( 'controllers' => [
'd3dev' => \D3\Devhelper\Application\Controller\d3dev::class, 'd3dev' => d3dev::class,
), ],
'templates' => array( 'templates' => [],
), 'events' => [],
'events' => array( 'blocks' => [],
), 'settings' => [
'blocks' => array( [
),
'settings' => array(
array(
'group' => 'd3dev_order', 'group' => 'd3dev_order',
'name' => 'blD3DevAvoidDelBasket', 'name' => ModuleCore\d3_dev_conf::OPTION_PREVENTDELBASKET,
'type' => 'bool', 'type' => 'bool',
'value' => 'false' 'value' => 'false'
), ],
array( [
'group' => 'd3dev_order', 'group' => 'd3dev_order',
'name' => 'blD3DevShowThankyou', 'name' => ModuleCore\d3_dev_conf::OPTION_SHOWTHANKYOU,
'type' => 'bool', 'type' => 'bool',
'value' => 'false' 'value' => 'false'
), ],
array( [
'group' => 'd3dev_mail', 'group' => 'd3dev_mail',
'name' => 'blD3DevShowOrderMailsInBrowser', 'name' => ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER,
'type' => 'bool', 'type' => 'bool',
'value' => 'false' 'value' => 'false'
), ],
array( [
'group' => 'd3dev_mailblock', 'group' => 'd3dev_mailblock',
'name' => 'blD3DevBlockMails', 'name' => ModuleCore\d3_dev_conf::OPTION_BLOCKMAIL,
'type' => 'bool', 'type' => 'bool',
'value' => 'false' 'value' => 'false'
), ],
array( [
'group' => 'd3dev_mailblock', 'group' => 'd3dev_mailblock',
'name' => 'sD3DevRedirectMail', 'name' => ModuleCore\d3_dev_conf::OPTION_REDIRECTMAIL,
'type' => 'str', 'type' => 'str',
'value' => 'd3test1@shopmodule.com' 'value' => 'd3test1@shopmodule.com'
), ],
), ],
); );