diff --git a/.gitattributes b/.gitattributes index 7b4adc6..8fab323 100644 --- a/.gitattributes +++ b/.gitattributes @@ -153,6 +153,7 @@ Sources/doku/12_gaTrackingOverview-Dateien/local_extensions.css -text Sources/doku/12_gaTrackingOverview-Dateien/semantic_headers.css -text Sources/doku/12_gaTrackingOverview-Dateien/star_off.gif -text Sources/doku/12_gaTrackingOverview.html -text +Sources/trustedShops.jpg -text changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleadwordscode.tpl -text changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleanalytics.tpl -text changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_optout.tpl -text @@ -164,6 +165,7 @@ changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_univer changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_custom.tpl -text changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_ecommerce.tpl -text changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_remarketing.tpl -text +changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl -text copy_this/.noencode -text copy_this/modules/d3/d3_googleanalytics/IntelliSenseHelper.php -text copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics.php -text @@ -172,11 +174,14 @@ copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_licence.php -text copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_list.php -text copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_main.php -text +copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_trustedstore.php -text copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalyticslog.php -text copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalyticslog_list.php -text copy_this/modules/d3/d3_googleanalytics/core/smarty/plugins/function.d3getArticleFromOrderArticle.php -text copy_this/modules/d3/d3_googleanalytics/menu.xml -text copy_this/modules/d3/d3_googleanalytics/metadata.php -text +copy_this/modules/d3/d3_googleanalytics/models/d3_google_remarketing_articlelister.php -text +copy_this/modules/d3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php -text copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php -text copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_order_googleanalytics.php -text copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_thankyou_googleanalytics.php -text @@ -194,6 +199,7 @@ copy_this/modules/d3/d3_googleanalytics/views/admin/en/d3_googleanalytics_lang.p copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_adwords.tpl -text copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_campaigns.tpl -text copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_main.tpl -text +copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_trustedstore.tpl -text setup+doku/Google[!!-~]AdWords-Einrichtung.pdf -text svneol=unset#unset setup+doku/Google[!!-~]Analytics-Einrichtung.pdf -text svneol=unset#unset setup+doku/Google[!!-~]Analytics-Installation.pdf -text diff --git a/Sources/trustedShops.jpg b/Sources/trustedShops.jpg new file mode 100644 index 0000000..bd6188f Binary files /dev/null and b/Sources/trustedShops.jpg differ diff --git a/changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleadwordscode.tpl b/changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleadwordscode.tpl index 626c837..cf930f4 100644 --- a/changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleadwordscode.tpl +++ b/changed_full/470-/modules/d3/d3_googleanalytics/views/blocks/layout/d3_base_googleadwordscode.tpl @@ -6,6 +6,21 @@ [{if $mod_d3_googleanalytics}] [{* Content shouldn't rendered in disabled module! Because of this reason, it can't included in d3modcfgcheck block. *}] + + [{if $oD3GASettings->getValue('sD3GATSActive') && $oD3GASettings->getValue('sD3GATSId')}] + [{capture name="d3GATrustedStoreCode"}] + [{strip}] + [{include file="d3ga_universal_trustedstore.tpl"}] + [{/strip}] + [{/capture}] + + [{if $oViewConf->getActiveClassName() == 'thankyou'}] + [{$oView->logCode($smarty.capture.d3GATrustedStoreCode)}] + [{/if}] + + [{$smarty.capture.d3GATrustedStoreCode}] + [{/if}] + [{include file="d3ga_universal_adwordscode.tpl"}] [{include file="d3ga_universal_remarketing.tpl"}] diff --git a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl new file mode 100644 index 0000000..e19732e --- /dev/null +++ b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl @@ -0,0 +1,84 @@ +[{* https://support.google.com/trustedstoresmerchant/answer/6063080?hl=de&ref_topic=6063044 *}] + + + + +[{if $oViewConf->getActiveClassName() == 'thankyou'}] + [{* https://support.google.com/trustedstoresmerchant/answer/6063087?hl=de&ref_topic=6063044 *}] + + [{assign var="oOrder" value=$oView->getOrder()}] + [{assign var="oOrderCurrency" value=$oOrder->getOrderCurrency()}] + [{assign var="oUser" value=$oOrder->getOrderUser()}] + [{assign var="oUserCountry" value=$oView->d3GAGetUserCountry()}] + [{if $oD3GASettings->getValue('blD3GAUseNetto')}] + [{assign var="sTotal" value=$oOrder->getOrderNetSum()}] [{* // total - required - has to be gross sum *}] + [{else}] + [{assign var="sTotal" value=$oOrder->getTotalOrderSum()}] [{* // total - required *}] + [{/if}] + + + + +[{/if}] \ No newline at end of file diff --git a/copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_trustedstore.php b/copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_trustedstore.php new file mode 100644 index 0000000..d1282bf --- /dev/null +++ b/copy_this/modules/d3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_trustedstore.php @@ -0,0 +1,25 @@ +. + * + * @link http://www.oxidmodule.com + * @link http://www.shopmodule.com + * @copyright (C) D3 Data Development (Inh. Thomas Dartsch) + */ + +class d3_cfg_googleanalytics_trustedstore extends d3_cfg_mod_main +{ + protected $_sThisTemplate = 'd3_cfg_googleanalytics_trustedstore.tpl'; + protected $_sModId = 'd3_googleanalytics'; +} diff --git a/copy_this/modules/d3/d3_googleanalytics/menu.xml b/copy_this/modules/d3/d3_googleanalytics/menu.xml index 63beba9..fee3f55 100644 --- a/copy_this/modules/d3/d3_googleanalytics/menu.xml +++ b/copy_this/modules/d3/d3_googleanalytics/menu.xml @@ -6,6 +6,7 @@ + diff --git a/copy_this/modules/d3/d3_googleanalytics/metadata.php b/copy_this/modules/d3/d3_googleanalytics/metadata.php index d5b4378..999948a 100644 --- a/copy_this/modules/d3/d3_googleanalytics/metadata.php +++ b/copy_this/modules/d3/d3_googleanalytics/metadata.php @@ -61,10 +61,16 @@ $aModule = array( 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_licence.php', 'd3_cfg_googleanalytics_list' => 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_list.php', 'd3_cfg_googleanalytics_main' => 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_main.php', + 'd3_cfg_googleanalytics_trustedstore' => + 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalytics_trustedstore.php', 'd3_cfg_googleanalyticslog' => 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalyticslog.php', 'd3_cfg_googleanalyticslog_list' => 'd3/d3_googleanalytics/controllers/admin/d3_cfg_googleanalyticslog_list.php', 'd3_googleanalytics_update' => 'd3/d3_googleanalytics/setup/d3_googleanalytics_update.php', + 'd3_google_remarketing_articlelister' => + 'd3/d3_googleanalytics/models/d3_google_remarketing_articlelister.php', + 'd3_google_trustedstore_articlelister' => + 'd3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php', ), 'templates' => array( 'd3_googleanalytics.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl', @@ -81,6 +87,8 @@ $aModule = array( 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_remarketing.tpl', 'd3ga_universal_campaigncode.tpl' => 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_campaigncode.tpl', + 'd3ga_universal_trustedstore.tpl' => + 'd3/d3_googleanalytics/views/tpl/widget/inc/d3ga_universal_trustedstore.tpl', 'd3_cfg_googleanalytics_main.tpl' => 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_main.tpl', @@ -88,6 +96,8 @@ $aModule = array( 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_adwords.tpl', 'd3_cfg_googleanalytics_campaigns.tpl' => 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_campaigns.tpl', + 'd3_cfg_googleanalytics_trustedstore.tpl' => + 'd3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_trustedstore.tpl', ), 'events' => array( 'onActivate' => 'd3install::checkUpdateStart', diff --git a/copy_this/modules/d3/d3_googleanalytics/models/d3_google_remarketing_articlelister.php b/copy_this/modules/d3/d3_googleanalytics/models/d3_google_remarketing_articlelister.php new file mode 100644 index 0000000..09ad536 --- /dev/null +++ b/copy_this/modules/d3/d3_googleanalytics/models/d3_google_remarketing_articlelister.php @@ -0,0 +1,160 @@ + + * @link http://www.oxidmodule.com + */ + +class d3_google_remarketing_articlelister +{ + public $sD3GARemarketingSKUField = 'oxartnum'; + + public $blD3GARemarketingUseBrutto = true; + + /** + * @param details $oView + * + * @return array + */ + public function getDetailsProdList($oView) + { + $aArticleList = array(); + $aArticleList[] = $oView->getProduct(); + return $this->_getProductList($aArticleList); + } + + /** + * @param alist $oView + * + * @return array + */ + public function getAlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param search $oView + * + * @return array + */ + public function getSearchProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param vendorlist $oView + * + * @return array + */ + public function getVendorlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param manufacturerlist $oView + * + * @return array + */ + public function getManufacturerlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param basket $oView + * + * @return array + */ + public function getBasketProdList($oView) + { + $aArticleList = $oView->getBasketArticles(); + return $this->_getProductList($aArticleList); + } + + /** + * @param order $oView + * + * @return array + */ + public function getOrderProdList($oView) + { + $aArticleList = $oView->getBasketArticles(); + return $this->_getProductList($aArticleList); + } + + /** + * @param compare $oView + * + * @return array + */ + public function getCompareProdList($oView) + { + $aArticleList = $oView->getCompArtList(); + return $this->_getProductList($aArticleList); + } + + /** + * don't change method name, it was dynamically generated + * @param account_noticelist $oView + * + * @return array + */ + public function getAccount_noticelistProdList($oView) + { + $aArticleList = $oView->getNoticeProductList(); + return $this->_getProductList($aArticleList); + } + + /** + * don't change method name, it was dynamically generated + * @param account_wishlist $oView + * + * @return array + */ + public function getAccount_wishlistProdList($oView) + { + $aArticleList = $oView->getWishProductList(); + return $this->_getProductList($aArticleList); + } + + /** + * @param $aArticleList + * + * @return array + */ + protected function _getProductList($aArticleList) + { + $aArticleIds = array(); + $dPrice = 0; + + /** @var oxarticle $oArticle */ + if (isset($aArticleList)) { + foreach ($aArticleList as $oArticle) { + $aArticleIds[] = $oArticle->getFieldData($this->sD3GARemarketingSKUField); + if ($this->blD3GARemarketingUseBrutto) { + $dPrice += $oArticle->getPrice()->getBruttoPrice(); + } else { + $dPrice += $oArticle->getPrice()->getNettoPrice(); + } + } + } + + return array('aArtIdList' => $aArticleIds, 'dPrice' => $dPrice); + } +} diff --git a/copy_this/modules/d3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php b/copy_this/modules/d3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php new file mode 100644 index 0000000..65b8b62 --- /dev/null +++ b/copy_this/modules/d3/d3_googleanalytics/models/d3_google_trustedstore_articlelister.php @@ -0,0 +1,132 @@ + + * @link http://www.oxidmodule.com + */ + +class d3_google_trustedstore_articlelister +{ + private $_sModId = 'd3_googleanalytics'; + + /** + * @param details $oView + * + * @return array + */ + public function getDetailsProdList($oView) + { + $aArticleList = array(); + $aArticleList[] = $oView->getProduct(); + return $this->_getProductList($aArticleList); + } + + /** + * @param alist $oView + * + * @return array + */ + public function getAlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param search $oView + * + * @return array + */ + public function getSearchProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param vendorlist $oView + * + * @return array + */ + public function getVendorlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param manufacturerlist $oView + * + * @return array + */ + public function getManufacturerlistProdList($oView) + { + $oArticleList = $oView->getArticleList(); + return $this->_getProductList($oArticleList); + } + + /** + * @param compare $oView + * + * @return array + */ + public function getCompareProdList($oView) + { + $aArticleList = $oView->getCompArtList(); + return $this->_getProductList($aArticleList); + } + + /** + * don't change method name, it was dynamically generated + * @param account_noticelist $oView + * + * @return array + */ + public function getAccount_noticelistProdList($oView) + { + $aArticleList = $oView->getNoticeProductList(); + return $this->_getProductList($aArticleList); + } + + /** + * don't change method name, it was dynamically generated + * @param account_wishlist $oView + * + * @return array + */ + public function getAccount_wishlistProdList($oView) + { + $aArticleList = $oView->getWishProductList(); + return $this->_getProductList($aArticleList); + } + + /** + * @param $aArticleList + * + * @return array + */ + protected function _getProductList($aArticleList) + { + $aArticleIds = array(); + + /** @var oxarticle $oArticle */ + if (isset($aArticleList)) { + foreach ($aArticleList as $oArticle) { + $aArticleIds[] = $oArticle->getFieldData( + d3_cfg_mod::get($this->_sModId)->getValue('sD3GATSShoppingArtId') + ); + } + } + + return array('aArtIdList' => $aArticleIds); + } +} diff --git a/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php b/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php index 24d0dc5..9f431e3 100644 --- a/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php +++ b/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php @@ -33,9 +33,6 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare 'order' => 'purchase', ); - public $sD3GARemarketingSKUField = 'oxartnum'; - public $blD3GARemarketingUseBrutto = true; - /** * @return null */ @@ -56,6 +53,12 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare $oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters()); $oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl()); + if ($oSet->getValue('sD3GATSActive') && $oSet->getValue('sD3GATSShoppingActive')) { + $aInfos = $this->d3GATSGetProdInfos(); + $oParentView->addTplParam('sD3CurrentGTSLang', $this->d3GetGTSLang()); + $oParentView->addTplParam('sD3GATSProdId', $this->d3GATSGetProdIdList($aInfos['aArtIdList'])); + } + if ($oSet->getValue('blD3GASetRemarketing')) { $aInfos = $this->d3GetGAProdInfos(); $oParentView->addTplParam('sD3GARemarketingProdId', $this->d3GetGAProdIdList($aInfos['aArtIdList'])); @@ -99,6 +102,14 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare return 'auto'; } + return $this->d3GetCurrentShopUrl(); + } + + /** + * @return string + */ + public function d3GetCurrentShopUrl() + { return oxRegistry::getConfig()->getActiveShop()->getFieldData('oxurl'); } @@ -275,6 +286,60 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare return 'Siteview'; } + /** + * @return string + */ + public function d3GetGTSLang() + { + $aHomeCountries = oxRegistry::getConfig()->getConfigParam('aHomeCountry'); + $sHomeCountryId = $aHomeCountries[array_keys($aHomeCountries)[0]]; + /** @var oxcountry $oCountry */ + $oCountry = oxNew('oxcountry'); + $oCountry->load($sHomeCountryId); + + return strtolower(oxRegistry::getLang()->getLanguageAbbr()).'_'. + strtoupper($oCountry->getFieldData('OXISOALPHA2')); + } + + /** + * @return array + */ + public function d3GATSGetProdInfos() + { + startProfile(__METHOD__); + + $oCurrentView = oxRegistry::getConfig()->getActiveView(); + + $aArticleIds = array(); + + $sMethodName = 'get'.ucfirst($oCurrentView->getClassName())."ProdList"; + $oArticleLister = oxNew('d3_google_trustedstore_articlelister'); + + if (method_exists($oArticleLister, $sMethodName)) { + stopProfile(__METHOD__); + return call_user_func(array($oArticleLister, $sMethodName), $oCurrentView); + } + + stopProfile(__METHOD__); + + return array('aArtIdList' => $aArticleIds); + } + + + /** + * @param array $aArticleIds + * + * @return string + */ + public function d3GATSGetProdIdList($aArticleIds) + { + if (count($aArticleIds)) { + return $aArticleIds[array_keys($aArticleIds)[0]]; + } else { + return "not_set"; + } + } + /** * @return string */ @@ -287,11 +352,12 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare $aArticleIds = array(); $dPrice = 0; - $sMethodName = '_d3GetGA'.$oCurrentView->getClassName()."ProdList"; + $sMethodName = 'get'.ucfirst($oCurrentView->getClassName())."ProdList"; + $oArticleLister = oxNew('d3_google_remarketing_articlelister'); - if (method_exists($this, $sMethodName)) { + if (method_exists($oArticleLister, $sMethodName)) { stopProfile(__METHOD__); - return call_user_func(array($this, $sMethodName), $oCurrentView); + return call_user_func(array($oArticleLister, $sMethodName), $oCurrentView); } stopProfile(__METHOD__); @@ -313,144 +379,6 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare } } - /** - * @param details $oView - * - * @return array - */ - protected function _d3GetGAdetailsProdList($oView) - { - $aArticleList = array(); - $aArticleList[] = $oView->getProduct(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * @param alist $oView - * - * @return array - */ - protected function _d3GetGAalistProdList($oView) - { - $oArticleList = $oView->getArticleList(); - return $this->_d3GetGAProductList($oArticleList); - } - - /** - * @param search $oView - * - * @return array - */ - protected function _d3GetGAsearchProdList($oView) - { - $oArticleList = $oView->getArticleList(); - return $this->_d3GetGAProductList($oArticleList); - } - - /** - * @param vendorlist $oView - * - * @return array - */ - protected function _d3GetGAvendorlistProdList($oView) - { - $oArticleList = $oView->getArticleList(); - return $this->_d3GetGAProductList($oArticleList); - } - - /** - * @param manufacturerlist $oView - * - * @return array - */ - protected function _d3GetGAmanufacturerlistProdList($oView) - { - $oArticleList = $oView->getArticleList(); - return $this->_d3GetGAProductList($oArticleList); - } - - /** - * @param basket $oView - * - * @return array - */ - protected function _d3GetGAbasketProdList($oView) - { - $aArticleList = $oView->getBasketArticles(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * @param order $oView - * - * @return array - */ - protected function _d3GetGAorderProdList($oView) - { - $aArticleList = $oView->getBasketArticles(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * @param compare $oView - * - * @return array - */ - protected function _d3GetGAcompareProdList($oView) - { - $aArticleList = $oView->getCompArtList(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * don't change method name, it was dynamically generated - * @param account_noticelist $oView - * - * @return array - */ - protected function _d3GetGAaccount_noticelistProdList($oView) - { - $aArticleList = $oView->getNoticeProductList(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * don't change method name, it was dynamically generated - * @param account_wishlist $oView - * - * @return array - */ - protected function _d3GetGAaccount_wishlistProdList($oView) - { - $aArticleList = $oView->getWishProductList(); - return $this->_d3GetGAProductList($aArticleList); - } - - /** - * @param $aArticleList - * - * @return array - */ - protected function _d3GetGAProductList($aArticleList) - { - $aArticleIds = array(); - $dPrice = 0; - - /** @var oxarticle $oArticle */ - if (isset($aArticleList)) { - foreach ($aArticleList as $oArticle) { - $aArticleIds[] = $oArticle->getFieldData($this->sD3GARemarketingSKUField); - if ($this->blD3GARemarketingUseBrutto) { - $dPrice += $oArticle->getPrice()->getBruttoPrice(); - } else { - $dPrice += $oArticle->getPrice()->getNettoPrice(); - } - } - } - - return array('aArtIdList' => $aArticleIds, 'dPrice' => $dPrice); - } - /** * @param $aParameter * diff --git a/copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_thankyou_googleanalytics.php b/copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_thankyou_googleanalytics.php index 1a7751f..8f9d4e5 100644 --- a/copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_thankyou_googleanalytics.php +++ b/copy_this/modules/d3/d3_googleanalytics/modules/controllers/d3_thankyou_googleanalytics.php @@ -23,6 +23,25 @@ class d3_thankyou_googleanalytics extends d3_thankyou_googleanalytics_parent { private $_sModCfgId = 'd3_googleanalytics'; + public $aD3GAWeekendDays = array( + 6, // Samstag + 7, // Sonntag + ); + + /** + * Format Tag-Monat (jeweils mit führenden Nullen) + * @var array + */ + public $aD3GAfixFeastDays = array( + '01-01', // Neujahr + '01-05', // Tag der Arbeit + '03-10', // Tag der deutschen Einheit + '25-12', // 1. Weihnachtsfeiertag + '26-12', // 2. Weihnachtsfeiertag + ); + + protected $_blD3GADateChanged = false; + /** * @return int */ @@ -48,4 +67,214 @@ class d3_thankyou_googleanalytics extends d3_thankyou_googleanalytics_parent $sGACode ); } + + /** + * @return oxcountry + */ + public function d3GAGetUserCountry() + { + $sCountryId = $this->getOrder()->getFieldData('oxbillcountryid'); + /** @var oxcountry $oCountry */ + $oCountry = oxNew('oxcountry'); + $oCountry->load($sCountryId); + + return $oCountry; + } + + /** + * @return string + */ + public function d3GAgetEstimatedShippingDate() + { + startProfile(__METHOD__); + $iTimeStamp = $this->_d3GAgetEstimatedDate('iEstShippingTimeValue', time()); + stopProfile(__METHOD__); + + return $iTimeStamp; + } + + /** + * @return string + */ + public function d3GAgetEstimatedDeliveryDate() + { + startProfile(__METHOD__); + $iShippingDate = $this->d3GAgetEstimatedShippingDate(); + $iTimeStamp = $this->_d3GAgetEstimatedDate('iEstDeliveryTimeValue', $iShippingDate); + stopProfile(__METHOD__); + + return $iTimeStamp; + } + + /** + * @param string $sModCfgVarName + * @param int $iTimestamp + * + * @return int + */ + protected function _d3GAgetEstimatedDate($sModCfgVarName, $iTimestamp) + { + $iTimeValue = d3_cfg_mod::get($this->_sModCfgId)->getValue($sModCfgVarName); + + for ($i = 0; $i < $iTimeValue; $i++) { + $iTimestamp += 86400; + + // check, if transportation day is a working day, else transportation has a break + do { + $this->_blD3GADateChanged = false; + $iTimestamp = $this->_d3GAskipIdlePeriod($iTimestamp); + } while ($this->_blD3GADateChanged === true); + } + + return $iTimestamp; + } + + /** + * @param $iTimestamp + * + * @return int + */ + protected function _d3GAskipIdlePeriod($iTimestamp) + { + startProfile(__METHOD__); + $iWeekday = date('N', $iTimestamp); + + if (in_array($iWeekday, $this->aD3GAWeekendDays)) { + $iOffset = 8 - $iWeekday; + $iTimestamp += $iOffset * 86400; + $this->_blD3GADateChanged = true; + } + + stopProfile(__METHOD__); + + return $this->_d3GAskipFeastDays($iTimestamp); + } + + /** + * @param $iTimestamp + * + * @return int + */ + protected function _d3GAskipFeastDays($iTimestamp) + { + startProfile(__METHOD__); + + while (in_array(date('d-m', $iTimestamp), $this->aD3GAfixFeastDays)) { + $iTimestamp += 86400; + $this->_blD3GADateChanged = true; + } + + stopProfile(__METHOD__); + + return $iTimestamp; + } + + /** + * @return string + */ + public function d3GAhasBackorderPreorder() + { + if (oxRegistry::getConfig()->getConfigParam('blUseStock')) { + /** @var oxorderarticle $oOrderArticle */ + foreach ($this->getOrder()->getOrderArticles() as $oOrderArticle) { + if ($this->_d3GAhasArticleBackorderPreorder($oOrderArticle)) { + return 'Y'; + } + }; + } + + return 'N'; + } + + /** + * @param oxorderarticle $oOrderArticle + * + * @return bool + */ + protected function _d3GAhasArticleBackorderPreorder(oxorderarticle $oOrderArticle) + { + /** @var oxarticle $oArticle */ + $oArticle = $oOrderArticle->getArticle(); + + if ($oArticle->getFieldData('oxstockflag') != 4 // Fremdlager + && $oOrderArticle->getFieldData('oxamount') > $oOrderArticle->getFieldData('oxstock') + ) { + return true; + } + + return false; + } + + /** + * @return string + */ + public function d3GAhasDigitalGoods() + { + if (oxRegistry::getConfig()->getConfigParam('blUseStock')) { + /** @var oxorderarticle $oOrderArticle */ + foreach ($this->getOrder()->getOrderArticles() as $oOrderArticle) { + if ($this->_d3GAhasArticleDigitalGoods($oOrderArticle)) { + return 'Y'; + } + }; + } + + return 'N'; + } + + /** + * @param oxorderarticle $oOrderArticle + * + * @return bool + */ + protected function _d3GAhasArticleDigitalGoods(oxorderarticle $oOrderArticle) + { + /** @var oxarticle $oArticle */ + $oArticle = $oOrderArticle->getArticle(); + $oArticleFileList = $oArticle->getArticleFiles(); + + if ($oArticle->getFieldData('oxisdownloadable') + && $oArticleFileList->count() + ) { + if ($this->_d3GAhasArticlePurchasedDownload($oArticleFileList)) { + return true; + } + } + + return false; + } + + /** + * @param oxList $oArticleFileList + * + * @return bool + */ + protected function _d3GAhasArticlePurchasedDownload(oxList $oArticleFileList) + { + /** @var oxfile $oArticleFile */ + foreach ($oArticleFileList->getArray() as $oArticleFile) { + if ($oArticleFile->getFieldData('oxpurchasedonly')) { + return true; + } + } + + return false; + } + + /** + * @param oxorderarticle $oOrderArticle + * + * @return string + */ + public function d3GAgetProductId($oOrderArticle) + { + switch (d3_cfg_mod::get($this->_sModCfgId)->getValue('sD3GATSShoppingArtId')) { + case 'oxartnum': + return $oOrderArticle->getFieldData('oxartnum'); + case 'oxid': + return $oOrderArticle->getFieldData('oxartid'); + }; + + return $oOrderArticle->getFieldData(d3_cfg_mod::get($this->_sModCfgId)->getValue('sD3GATSShoppingArtId')); + } } diff --git a/copy_this/modules/d3/d3_googleanalytics/views/admin/de/d3_googleanalytics_lang.php b/copy_this/modules/d3/d3_googleanalytics/views/admin/de/d3_googleanalytics_lang.php index 1ca3d5d..38aca61 100644 --- a/copy_this/modules/d3/d3_googleanalytics/views/admin/de/d3_googleanalytics_lang.php +++ b/copy_this/modules/d3/d3_googleanalytics/views/admin/de/d3_googleanalytics_lang.php @@ -31,6 +31,7 @@ $aLang = array( 'd3mxgoogleanalytics_settings' => 'Einstellungen', 'd3tbclgoogleanalytics_main' => 'Analytics', 'd3tbclgoogleanalytics_adwords' => 'AdWords', + 'd3tbclgoogleanalytics_trustedstore' => 'Google zertifizierter Shop', 'D3_GOOGLEANALYTICS_CFG_TITLE' => 'Google Analytics Schnittstelle - Einstellungen', @@ -275,6 +276,49 @@ $aLang = array( 'ein, den Sie vom Anbieter erhalten haben. Kopieren Sie auch ein eventuell vorhandenes "script"-Tag mit. '. 'Dieser Code wird 1:1 in den Seitenquelltext eingefügt und nicht geparst.', + 'D3_GOOGLEANALYTICS_TS_ACTIVE' => 'Trusted Store aktivieren', + 'D3_GOOGLEANALYTICS_TS_ID' => 'Trusted Store-ID', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER' => 'Zeitraum vom Bestelleingang bis zum Versand', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DAYS' => 'Werktag(e)', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DESC' => '

Google teilt Ihrem Kunden per Mail mit, '. + 'nach welchem Zeitraum ausgehend vom Bestelleingang die bestellten Artikel versendet werden. Geben Sie hier '. + 'den für Normalfälle größten Zeitraum bis zum Versand in Tagen an (z.B. 3 bei "1 bis 3 Tage"). Nach dem '. + 'voraussichtlichen Versanddatum erhält der Kunde eine Umfrage zum abgeschlossenen Kauf.

Fällt der '. + 'errechnete Termin auf ein Wochenende oder einen festen Feiertag, wird der nächstmögliche Termin verwendet. '. + 'Bewegliche und regionale Feiertage werden nicht berücksichtigt. Um die Liste der Ausnahmen anzupassen, '. + 'erweitern Sie die Überladung der thankyou-Klasse entsprechend.

', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER' => 'Zeitraum vom Versand bis zur Lieferung beim '. + 'Empfänger', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DAYS' => 'Werktag(e)', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DESC' => '

Google teilt Ihrem Kunden per Mail mit, '. + 'nach welchem Zeitraum die bestellten Artikel in der Regel beim Kunden eintreffen. Geben Sie hier den für '. + 'Normalfälle größten Zeitraum für die Lieferung in Tagen an (z.B. 4 bei "1 bis 4 Tage"). Der errechnete '. + 'Termin wird dem Kunden per Mail mitgeteilt.

Fällt der errechnete Termin auf ein Wochenende oder einen '. + 'festen Feiertag, wird der nächstmögliche Termin verwendet. Bewegliche und regionale Feiertage werden nicht '. + 'berücksichtigt. Um die Liste der Ausnahmen anzupassen, erweitern Sie die Überladung der thankyou-Klasse '. + 'entsprechend.

', + 'D3_GOOGLEANALYTICS_TS_SHOPPING' => 'Verbindung zu Google Shopping', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACTIVE' => 'zusätzliche Daten aus Google Shopping '. + 'übertragen', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACTIVE_DESC' => 'Verwenden Sie Google Shopping und möchten '. + 'zusätzliche Daten zur Identifizierung übertragen, setzen Sie diesen Haken. Die folgenden Angaben sind dann '. + 'ebenfalls erforderlich.', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACCOUNTID' => 'Google Shopping Kontonummer', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACCOUNTID_DESC' => 'Tragen Sie hier die Kontonummer (Account ID) '. + 'aus Google Shopping ein.', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGCOUNTRY' => 'Kürzel des Landes Ihres Google Shopping-Kontos', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGCOUNTRY_DESC' => 'Geben Sie hier das Land Ihres Google Shopping '. + 'Kontos an. Erwartet wird der ISO-3166-Ländercode (z.B.: DE, CH, AT, FR).', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGLANGUAGE' => 'Kürzel der Sprache Ihres Google Shopping-Kontos', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGLANGUAGE_DESC' => 'Geben Sie hier die Sprache Ihres Google '. + 'Shopping Kontos an. Erwartet wird der ISO-639-1-Sprachcode (z.B.: de, en, fr).', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID' => 'Identifikation Ihrer Artikel bei Google '. + 'Shopping', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_ARTNUM' => 'Artikelnummer (oxartnum)', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_OXID' => 'interne Ident-Nummer (oxid)', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_DESC' => 'Über welches Feld kann Google Shopping die '. + 'dort hinterlegten Artikel identfizieren?', + 'D3_GOOGLEANALYTICS_METADATA_TITLE' => 'Google Analytics Schnittstelle', 'D3_GOOGLEANALYTICS_METADATA_DESC' => 'Dieses Modul stellt Ihnen die schnelle und '. 'unkomplizierte Einbindung Ihres Google-Analytics-Kontos in Ihren Shop zur Verfügung. Hierbei werden '. diff --git a/copy_this/modules/d3/d3_googleanalytics/views/admin/en/d3_googleanalytics_lang.php b/copy_this/modules/d3/d3_googleanalytics/views/admin/en/d3_googleanalytics_lang.php index 251bf44..9e3db68 100644 --- a/copy_this/modules/d3/d3_googleanalytics/views/admin/en/d3_googleanalytics_lang.php +++ b/copy_this/modules/d3/d3_googleanalytics/views/admin/en/d3_googleanalytics_lang.php @@ -31,6 +31,7 @@ $aLang = array( 'd3mxgoogleanalytics_settings' => 'Settings', 'd3tbclgoogleanalytics_main' => 'Analytics', 'd3tbclgoogleanalytics_adwords' => 'AdWords', + 'd3tbclgoogleanalytics_trustedstore' => 'Google Trusted Shop', 'D3_GOOGLEANALYTICS_CFG_TITLE' => 'Google Analytics Connector - Settings', @@ -274,6 +275,49 @@ $aLang = array( 'ein, den Sie vom Anbieter erhalten haben. Kopieren Sie auch ein eventuell vorhandenes "script"-Tag mit. '. 'Dieser Code wird 1:1 in den Seitenquelltext eingefügt und nicht geparst.', + 'D3_GOOGLEANALYTICS_TS_ACTIVE' => 'Trusted Store aktivieren', + 'D3_GOOGLEANALYTICS_TS_ID' => 'Trusted Store-ID', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER' => 'Zeitraum vom Bestelleingang bis zum Versand', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DAYS' => 'Werktag(e)', + 'D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DESC' => '

Google teilt Ihrem Kunden per Mail mit, '. + 'nach welchem Zeitraum ausgehend vom Bestelleingang die bestellten Artikel versendet werden. Geben Sie hier '. + 'den für Normalfälle größten Zeitraum bis zum Versand in Tagen an (z.B. 3 bei "1 bis 3 Tage"). Nach dem '. + 'voraussichtlichen Versanddatum erhält der Kunde eine Umfrage zum abgeschlossenen Kauf.

Fällt der '. + 'errechnete Termin auf ein Wochenende oder einen festen Feiertag, wird der nächstmögliche Termin verwendet. '. + 'Bewegliche und regionale Feiertage werden nicht berücksichtigt. Um die Liste der Ausnahmen anzupassen, '. + 'erweitern Sie die Überladung der thankyou-Klasse entsprechend.

', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER' => 'Zeitraum vom Versand bis zur Lieferung beim '. + 'Empfänger', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DAYS' => 'Werktag(e)', + 'D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DESC' => '

Google teilt Ihrem Kunden per Mail mit, '. + 'nach welchem Zeitraum die bestellten Artikel in der Regel beim Kunden eintreffen. Geben Sie hier den für '. + 'Normalfälle größten Zeitraum für die Lieferung in Tagen an (z.B. 4 bei "1 bis 4 Tage"). Der errechnete '. + 'Termin wird dem Kunden per Mail mitgeteilt.

Fällt der errechnete Termin auf ein Wochenende oder einen '. + 'festen Feiertag, wird der nächstmögliche Termin verwendet. Bewegliche und regionale Feiertage werden nicht '. + 'berücksichtigt. Um die Liste der Ausnahmen anzupassen, erweitern Sie die Überladung der thankyou-Klasse '. + 'entsprechend.

', + 'D3_GOOGLEANALYTICS_TS_SHOPPING' => 'Verbindung zu Google Shopping', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACTIVE' => 'zusätzliche Daten aus Google Shopping '. + 'übertragen', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACTIVE_DESC' => 'Verwenden Sie Google Shopping und möchten '. + 'zusätzliche Daten zur Identifizierung übertragen, setzen Sie diesen Haken. Die folgenden Angaben sind dann '. + 'ebenfalls erforderlich.', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACCOUNTID' => 'Google Shopping Kontonummer', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGACCOUNTID_DESC' => 'Tragen Sie hier die Kontonummer (Account ID) '. + 'aus Google Shopping ein.', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGCOUNTRY' => 'Kürzel des Landes Ihres Google Shopping-Kontos', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGCOUNTRY_DESC' => 'Geben Sie hier das Land Ihres Google Shopping '. + 'Kontos an. Erwartet wird der ISO-3166-Ländercode (z.B.: DE, CH, AT, FR).', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGLANGUAGE' => 'Kürzel der Sprache Ihres Google Shopping-Kontos', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGLANGUAGE_DESC' => 'Geben Sie hier die Sprache Ihres Google '. + 'Shopping Kontos an. Erwartet wird der ISO-639-1-Sprachcode (z.B.: de, en, fr).', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID' => 'Identifikation Ihrer Artikel bei Google '. + 'Shopping', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_ARTNUM' => 'Artikelnummer (oxartnum)', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_OXID' => 'interne Ident-Nummer (oxid)', + 'D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_DESC' => 'Über welches Feld kann Google Shopping die '. + 'dort hinterlegten Artikel identfizieren?', + 'D3_GOOGLEANALYTICS_METADATA_TITLE' => 'Google Analytics Schnittstelle', 'D3_GOOGLEANALYTICS_METADATA_DESC' => 'Dieses Modul stellt Ihnen die schnelle und '. 'unkomplizierte Einbindung Ihres Google-Analytics-Kontos in Ihren Shop zur Verfügung. Hierbei werden '. diff --git a/copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_trustedstore.tpl b/copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_trustedstore.tpl new file mode 100644 index 0000000..458814a --- /dev/null +++ b/copy_this/modules/d3/d3_googleanalytics/views/admin/tpl/d3_cfg_googleanalytics_trustedstore.tpl @@ -0,0 +1,226 @@ +[{include file="headitem.tpl" title="D3_GOOGLEANALYTICS_CFG_TITLE"|oxmultilangassign}] + + + + + +[{if $readonly}] + [{assign var="readonly" value="readonly disabled"}] +[{else}] + [{assign var="readonly" value=""}] +[{/if}] + +
+ [{$oViewConf->getHiddenSid()}] + + + + +
+ +
+ [{$oViewConf->getHiddenSid()}] + + + + + + + + + +
+ +
+
+ + + [{oxmultilang ident="D3_GOOGLEANALYTICS_MAIN"}] + + +
+
+ +
+
+ + getValue('sD3GATSActive')}]checked[{/if}] name="value[sD3GATSActive]"> + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_ACTIVE_DESC"}] +
+
+
+
+ +
+
+ + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_ID_DESC"}] +
+
+
+
+ +
+
+ + [{oxmultilang ident="D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DAYS"}] + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_ESTSHIPDATEAFTER_DESC"}] +
+
+
+
+ +
+
+ + [{oxmultilang ident="D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DAYS"}] + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_ESTDELDATEAFTER_DESC"}] +
+
+
+
+ +
+
+ + + [{oxmultilang ident="D3_GOOGLEANALYTICS_TS_SHOPPING"}] + + +
+
+ +
+
+ + getValue('sD3GATSShoppingActive')}]checked[{/if}] name="value[sD3GATSShoppingActive]"> + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_SHOPPINGACTIVE_DESC"}] +
+
+
+
+ +
+
+ + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_SHOPPINGACCOUNTID_DESC"}] +
+
+
+
+ +
+
+ + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_SHOPPINGCOUNTRY_DESC"}] +
+
+
+
+ +
+
+ + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_SHOPPINGLANGUAGE_DESC"}] +
+
+
+
+ +
+
+ + [{oxinputhelp ident="D3_GOOGLEANALYTICS_TS_SHOPPINGARTID_DESC"}] +
+
+
+
+ + + + + +

+ + + + +
+ +
+
+ +[{assign var="incpath" value=$oViewConf->getModulePath('d3modcfg_lib')|cat:"views/admin/tpl/d3_cfg_mod_inc.tpl"}] +[{include file="d3_cfg_mod_inc.tpl"}] + + \ No newline at end of file diff --git a/setup+doku/changelog.txt b/setup+doku/changelog.txt index ca4bb55..4d53eca 100644 --- a/setup+doku/changelog.txt +++ b/setup+doku/changelog.txt @@ -1,3 +1,6 @@ +=> 3.3.0.0 +- Google Zertifierte Händler eingefügt + => 3.2.1.0 - neue Option "Opt Out anzeigen lassen"