update for OXID 6.2
This commit is contained in:
parent
11d4227874
commit
d1c1ba90b8
@ -4,6 +4,7 @@ namespace D3\Devhelper\Application\Controller;
|
||||
|
||||
use D3\Devhelper\Modules\Application\Controller as ModuleController;
|
||||
use D3\Devhelper\Modules\Core as ModuleCore;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
use OxidEsales\Eshop\Application\Controller\ThankYouController;
|
||||
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\UserException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
@ -41,8 +41,8 @@ class d3dev extends FrontendController
|
||||
protected function _authenticate ()
|
||||
{
|
||||
try {
|
||||
$sUser = Registry::get(Request::class)->getRequestEscapedParameter('usr');
|
||||
$sPassword = Registry::get(Request::class)->getRequestEscapedParameter('pwd');
|
||||
$sUser = Registry::getRequest()->getRequestEscapedParameter('usr');
|
||||
$sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
|
||||
|
||||
if ( !$sUser || !$sPassword ) {
|
||||
$sUser = $_SERVER[ 'PHP_AUTH_USER' ];
|
||||
@ -67,13 +67,10 @@ class d3dev extends FrontendController
|
||||
}
|
||||
$oUser = oxNew( User::class );
|
||||
if ( !$sUser || !$sPassword || !$oUser->login( $sUser, $sPassword ) ) {
|
||||
/** @var UserException $oEx */
|
||||
$oEx = oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
|
||||
|
||||
throw $oEx;
|
||||
throw oxNew( UserException::class, 'EXCEPTION_USER_NOVALIDLOGIN' );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $oEx ) {
|
||||
catch ( Exception $oEx ) {
|
||||
$oShop = Registry::getConfig()->getActiveShop();
|
||||
header( 'WWW-Authenticate: Basic realm="' . $oShop->getFieldData('oxname') . '"' );
|
||||
header( 'HTTP/1.0 401 Unauthorized' );
|
||||
@ -90,12 +87,12 @@ class d3dev extends FrontendController
|
||||
header('Content-type: text/html; charset='.Registry::getLang()->translateString('charset'));
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
$sTpl = Registry::get(Request::class)->getRequestEscapedParameter('type');
|
||||
$sTpl = Registry::getRequest()->getRequestEscapedParameter('type');
|
||||
|
||||
/** @var ModuleController\d3_dev_thankyou $oThankyou */
|
||||
$oThankyou = oxNew(ThankYouController::class);
|
||||
@ -113,12 +110,12 @@ class d3dev extends FrontendController
|
||||
public function showInquiryMailContent()
|
||||
{
|
||||
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');
|
||||
}
|
||||
|
||||
$sTpl = Registry::get(Request::class)->getRequestEscapedParameter('type');
|
||||
$sTpl = Registry::getRequest()->getRequestEscapedParameter('type');
|
||||
|
||||
/** @var ModuleController\d3_dev_thankyou $oThankyou */
|
||||
$oThankyou = oxNew(ThankYouController::class);
|
||||
|
@ -16,27 +16,40 @@
|
||||
|
||||
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
|
||||
{
|
||||
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_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
|
||||
{
|
||||
class d3_dev_oxemail_parent extends \OxidEsales\Eshop\Core\Email {}
|
||||
|
||||
use OxidEsales\Eshop\Core\Email;
|
||||
|
||||
class d3_dev_oxemail_parent extends Email {}
|
||||
}
|
@ -5,13 +5,15 @@ namespace D3\Devhelper\Modules\Application\Controller;
|
||||
// .../?cl=thankyou[&d3orderid=23]
|
||||
use D3\Devhelper\Modules\Application\Model\d3_dev_d3inquiry;
|
||||
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\User;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\UserException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use oxOrder;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||
if (Registry::getRequest()->getRequestEscapedParameter("d3dev")
|
||||
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||
&& Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket')
|
||||
&& Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_PREVENTDELBASKET)
|
||||
) {
|
||||
Registry::getSession()->setVariable( 'sess_challenge', $sSessChallenge );
|
||||
}
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||
&& Registry::getConfig()->getConfigParam('blD3DevShowThankyou')
|
||||
) {
|
||||
if ($this->d3DevCanShowThankyou()) {
|
||||
$this->_d3authenticate();
|
||||
$oOrder = $this->d3GetLastOrder();
|
||||
$oBasket = $oOrder->d3DevGetOrderBasket();
|
||||
$this->_oBasket = $oBasket;
|
||||
$this->_oBasket = $oOrder->d3DevGetOrderBasket();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ()
|
||||
{
|
||||
try {
|
||||
$sUser = Registry::get(Request::class)->getRequestEscapedParameter( 'usr');
|
||||
$sPassword = Registry::get(Request::class)->getRequestEscapedParameter('pwd');
|
||||
$sUser = Registry::getRequest()->getRequestEscapedParameter( 'usr');
|
||||
$sPassword = Registry::getRequest()->getRequestEscapedParameter('pwd');
|
||||
|
||||
if ( !$sUser || !$sPassword ) {
|
||||
$sUser = $_SERVER[ 'PHP_AUTH_USER' ];
|
||||
@ -93,7 +119,7 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
|
||||
throw $oEx;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $oEx ) {
|
||||
catch ( Exception $oEx ) {
|
||||
$oShop = Registry::getConfig()->getActiveShop();
|
||||
header( 'WWW-Authenticate: Basic realm="{' . $oShop->getFieldData('oxname') . '"' );
|
||||
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 DatabaseErrorException
|
||||
*/
|
||||
@ -111,12 +137,18 @@ class d3_dev_thankyou extends d3_dev_thankyou_parent
|
||||
$oOrder = parent::getOrder();
|
||||
|
||||
if ((false == $oOrder || !$oOrder->getFieldData('oxordernr'))
|
||||
&& Registry::get(Request::class)->getRequestEscapedParameter("d3dev")
|
||||
&& false == (bool) Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||
&& Registry::getConfig()->getConfigParam('blD3DevShowThankyou')
|
||||
&& $this->d3DevCanShowThankyou()
|
||||
) {
|
||||
$this->_oOrder = $this->d3GetLastOrder();
|
||||
$oOrder = $this->_oOrder;
|
||||
try {
|
||||
$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;
|
||||
|
@ -7,7 +7,6 @@ use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
$inquiryNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3inquirynr');
|
||||
$inquiryNr = (int) Registry::getRequest()->getRequestEscapedParameter('d3inquirynr');
|
||||
$sWhere = 1;
|
||||
if ($inquiryNr) {
|
||||
$sWhere = ' oxinquirynr = ' . $inquiryNr;
|
||||
|
@ -17,16 +17,19 @@
|
||||
|
||||
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\OrderArticle;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use oxNoArticleException;
|
||||
|
||||
class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
||||
{
|
||||
public function deleteBasket()
|
||||
{
|
||||
if (Registry::getConfig()->getActiveShop()->isProductiveMode()
|
||||
|| false == Registry::getConfig()->getConfigParam('blD3DevAvoidDelBasket')
|
||||
|| false == Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_PREVENTDELBASKET)
|
||||
) {
|
||||
parent::deleteBasket();
|
||||
}
|
||||
@ -67,14 +70,14 @@ class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
||||
/**
|
||||
* @param OrderArticle $oOrderArticle
|
||||
*
|
||||
* @return |null
|
||||
* @throws \oxArticleInputException
|
||||
* @throws \oxNoArticleException
|
||||
* @return null
|
||||
* @throws oxArticleInputException
|
||||
* @throws oxNoArticleException
|
||||
*/
|
||||
public function d3addOrderArticleToBasket($oOrderArticle)
|
||||
{
|
||||
// adding only if amount > 0
|
||||
if ($oOrderArticle->oxorderarticles__oxamount->value > 0) {
|
||||
if ($oOrderArticle->getFieldData('oxamount') > 0) {
|
||||
$this->_isForOrderRecalculation = true;
|
||||
$sItemId = $oOrderArticle->getId();
|
||||
|
||||
@ -83,7 +86,7 @@ class d3_dev_oxbasket extends d3_dev_oxbasket_parent
|
||||
$oBasketItem = oxNew( BasketItem::class);
|
||||
$oBasketItem->initFromOrderArticle($oOrderArticle);
|
||||
$oBasketItem->d3ConvertToArticleObject();
|
||||
$oBasketItem->setWrapping($oOrderArticle->oxorderarticles__oxwrapid->value);
|
||||
$oBasketItem->setWrapping($oOrderArticle->getFieldData('oxwrapid'));
|
||||
$oBasketItem->setBundle($oOrderArticle->isBundle());
|
||||
|
||||
$this->_aBasketContents[$sItemId] = $oBasketItem;
|
||||
|
@ -16,11 +16,13 @@
|
||||
|
||||
namespace D3\Devhelper\Modules\Application\Model;
|
||||
|
||||
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;
|
||||
use oxNoArticleException;
|
||||
|
||||
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 \oxNoArticleException
|
||||
* @throws oxArticleInputException
|
||||
* @throws oxNoArticleException
|
||||
*/
|
||||
public function d3ConvertToArticleObject()
|
||||
{
|
||||
|
@ -17,13 +17,16 @@
|
||||
|
||||
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\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Model\ListModel;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use oxnoarticleexception;
|
||||
|
||||
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()
|
||||
{
|
||||
$orderNr = (int) Registry::get(Request::class)->getRequestEscapedParameter('d3ordernr');
|
||||
$orderNr = (int) Registry::getRequest()->getRequestEscapedParameter('d3ordernr');
|
||||
$sWhere = 1;
|
||||
if ($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);
|
||||
}
|
||||
@ -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()
|
||||
{
|
||||
@ -94,9 +97,12 @@ class d3_dev_oxorder extends d3_dev_oxorder_parent
|
||||
*/
|
||||
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) {
|
||||
$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 ListModel $aOrderArticles order articles
|
||||
* @throws oxArticleInputException
|
||||
* @throws oxNoArticleException
|
||||
*/
|
||||
protected function _d3AddOrderArticlesToBasket($oBasket, $aOrderArticles)
|
||||
{
|
||||
|
@ -27,6 +27,9 @@ class d3_dev_oxorderarticle extends d3_dev_oxorderarticle_parent
|
||||
{
|
||||
$oArticle = $this->getArticle();
|
||||
|
||||
return $oArticle->getCustomerAlsoBoughtThisProducts();
|
||||
/** @var ArticleList $artList */
|
||||
$artList = $oArticle->getCustomerAlsoBoughtThisProducts();
|
||||
|
||||
return $artList;
|
||||
}
|
||||
}
|
||||
|
29
src/Modules/Core/d3_dev_conf.php
Normal file
29
src/Modules/Core/d3_dev_conf.php
Normal 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 © D³ Data Development, Thomas Dartsch
|
||||
* @author D³ 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';
|
||||
}
|
@ -20,6 +20,10 @@ namespace D3\Devhelper\Modules\Core;
|
||||
use D3\Devhelper\Modules\Application\Model as ModuleModel;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
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
|
||||
{
|
||||
@ -49,7 +53,7 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||
$sTpl = $this->_sOrderUserTemplate;
|
||||
}
|
||||
|
||||
$myConfig = $this->getConfig();
|
||||
$myConfig = Registry::getConfig();
|
||||
|
||||
$oShop = $this->_getShop();
|
||||
|
||||
@ -78,14 +82,36 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||
$this->setSmtp($oShop);
|
||||
|
||||
// create messages
|
||||
/** @var \Smarty $oSmarty */
|
||||
$oSmarty = $this->_getSmarty();
|
||||
$this->setViewData("order", $oOrder);
|
||||
|
||||
// Process view data array through oxoutput processor
|
||||
$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;
|
||||
}
|
||||
|
||||
$myConfig = $this->getConfig();
|
||||
$myConfig = Registry::getConfig();
|
||||
|
||||
$oShop = $this->_getShop();
|
||||
|
||||
@ -145,14 +171,21 @@ class d3_dev_oxemail extends d3_dev_oxemail_parent
|
||||
$this->setSmtp($oShop);
|
||||
|
||||
// create messages
|
||||
/** @var \Smarty $oSmarty */
|
||||
$oSmarty = $this->_getSmarty();
|
||||
$this->setViewData("inquiry", $oInquiry);
|
||||
|
||||
// Process view data array through oxoutput processor
|
||||
$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)
|
||||
{
|
||||
if (Registry::getConfig()->getConfigParam('blD3DevBlockMails')) {
|
||||
if (Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_BLOCKMAIL)) {
|
||||
return false;
|
||||
} elseif (Registry::getConfig()->getConfigParam('sD3DevRedirectMail')) {
|
||||
return trim(Registry::getConfig()->getConfigParam('sD3DevRedirectMail'));
|
||||
} elseif (Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_REDIRECTMAIL)) {
|
||||
return trim(Registry::getConfig()->getConfigParam(d3_dev_conf::OPTION_REDIRECTMAIL));
|
||||
}
|
||||
|
||||
return $sMailAddress;
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use D3\Devhelper\Application\Controller\d3dev;
|
||||
use D3\Devhelper\Modules\Core as ModuleCore;
|
||||
use D3\Devhelper\Modules\Application\Controller as ModuleController;
|
||||
use D3\Devhelper\Modules\Application\Model as ModuleModel;
|
||||
@ -12,19 +13,21 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '2.0';
|
||||
$sLogo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em"> ';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = array(
|
||||
'id' => 'd3dev',
|
||||
'title' =>
|
||||
'<svg style="height:1em;width:1em"><image xlink:href="https://logos.oxidmodule.com/d3logo.svg" style="height:1em;width:1em" /></svg> '.
|
||||
'TPL Development Tool',
|
||||
'description' => array(
|
||||
'title' => [
|
||||
'de' => $sLogo . 'TPL Entwicklerwerkzeug',
|
||||
'en' => $sLogo . 'TPL Development Tool'
|
||||
],
|
||||
'description' => [
|
||||
'de' => '<script type="text/javascript"><!--
|
||||
function showNote() {
|
||||
var _oElem = document.getElementById("secnote");
|
||||
let _oElem = document.getElementById("secnote");
|
||||
if (_oElem.style.display === "block") {
|
||||
_oElem.style.display = "none";
|
||||
} else {
|
||||
@ -50,60 +53,57 @@ $aModule = array(
|
||||
'<li>blockiert übers Framework versendete Mails oder leitet diese um</li>'.
|
||||
'</ul><br>Jede dieser Optionen muss aus Sicherheitsgründen unter "Einstell." aktiviert werden. Weiterhin darf der Shop nicht im Produktivmodus betrieben werden.<br><br>'.
|
||||
'* Ordernummer an URL ergänzen, wenn bestimmte Bestellungen angezeigt werden sollen',
|
||||
'en' => ''),
|
||||
'version' => '2.0.1.0',
|
||||
'en' => ''],
|
||||
'version' => '2.1.0.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'http://www.oxidmodule.com/',
|
||||
'extend' => array(
|
||||
'extend' => [
|
||||
OxidController\ThankYouController::class => ModuleController\d3_dev_thankyou::class,
|
||||
OxidModel\Order::class => ModuleModel\d3_dev_oxorder::class,
|
||||
OxidModel\OrderArticle::class => ModuleModel\d3_dev_oxorderarticle::class,
|
||||
OxidCore\Email::class => ModuleCore\d3_dev_oxemail::class,
|
||||
OxidModel\Basket::class => ModuleModel\d3_dev_oxbasket::class,
|
||||
OxidModel\BasketItem::class => ModuleModel\d3_dev_oxbasketitem::class,
|
||||
),
|
||||
'controllers' => array(
|
||||
'd3dev' => \D3\Devhelper\Application\Controller\d3dev::class,
|
||||
),
|
||||
'templates' => array(
|
||||
),
|
||||
'events' => array(
|
||||
),
|
||||
'blocks' => array(
|
||||
),
|
||||
'settings' => array(
|
||||
array(
|
||||
],
|
||||
'controllers' => [
|
||||
'd3dev' => d3dev::class,
|
||||
],
|
||||
'templates' => [],
|
||||
'events' => [],
|
||||
'blocks' => [],
|
||||
'settings' => [
|
||||
[
|
||||
'group' => 'd3dev_order',
|
||||
'name' => 'blD3DevAvoidDelBasket',
|
||||
'name' => ModuleCore\d3_dev_conf::OPTION_PREVENTDELBASKET,
|
||||
'type' => 'bool',
|
||||
'value' => 'false'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'group' => 'd3dev_order',
|
||||
'name' => 'blD3DevShowThankyou',
|
||||
'name' => ModuleCore\d3_dev_conf::OPTION_SHOWTHANKYOU,
|
||||
'type' => 'bool',
|
||||
'value' => 'false'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'group' => 'd3dev_mail',
|
||||
'name' => 'blD3DevShowOrderMailsInBrowser',
|
||||
'name' => ModuleCore\d3_dev_conf::OPTION_SHOWMAILSINBROWSER,
|
||||
'type' => 'bool',
|
||||
'value' => 'false'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'group' => 'd3dev_mailblock',
|
||||
'name' => 'blD3DevBlockMails',
|
||||
'name' => ModuleCore\d3_dev_conf::OPTION_BLOCKMAIL,
|
||||
'type' => 'bool',
|
||||
'value' => 'false'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'group' => 'd3dev_mailblock',
|
||||
'name' => 'sD3DevRedirectMail',
|
||||
'name' => ModuleCore\d3_dev_conf::OPTION_REDIRECTMAIL,
|
||||
'type' => 'str',
|
||||
'value' => 'd3test1@shopmodule.com'
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user