From ac07512c5dcfe7a2c38b0455deb1f2361241fa99 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 12:29:07 +0900 Subject: [PATCH 01/16] =?UTF-8?q?Form=E3=81=BE=E3=81=A7=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/eccube/packages/eccube_nav.yaml | 3 + .../Setting/System/EnhancementController.php | 55 ++++++++++++++ .../Form/Type/Admin/EnhancementType.php | 73 ++++++++++++++++++ .../admin/Setting/System/enhancement.twig | 76 +++++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 src/Eccube/Controller/Admin/Setting/System/EnhancementController.php create mode 100644 src/Eccube/Form/Type/Admin/EnhancementType.php create mode 100644 src/Eccube/Resource/template/admin/Setting/System/enhancement.twig diff --git a/app/config/eccube/packages/eccube_nav.yaml b/app/config/eccube/packages/eccube_nav.yaml index ebd6a83a66f..659f0755e0d 100644 --- a/app/config/eccube/packages/eccube_nav.yaml +++ b/app/config/eccube/packages/eccube_nav.yaml @@ -136,6 +136,9 @@ parameters: system_index: name: admin.setting.system.system_info url: admin_setting_system_system + enhancement: + name: admin.setting.system.enhancement + url: admin_setting_system_enhancement store: name: admin.store icon: fa-plug diff --git a/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php b/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php new file mode 100644 index 00000000000..3c1d61cf003 --- /dev/null +++ b/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php @@ -0,0 +1,55 @@ +systemService = $systemService; + } + + /** + * @Route("/%eccube_admin_route%/setting/system/enhancement", name="admin_setting_system_enhancement") + * @Template("@admin/Setting/System/enhancement.twig") + */ + public function index(Request $request) + { + $builder = $this->formFactory->createBuilder(EnhancementType::class); + $form = $builder->getForm(); + $form->handleRequest($request); + + + return [ + 'form' => $form->createView(), + ]; + } +} diff --git a/src/Eccube/Form/Type/Admin/EnhancementType.php b/src/Eccube/Form/Type/Admin/EnhancementType.php new file mode 100644 index 00000000000..f04ca44ee5b --- /dev/null +++ b/src/Eccube/Form/Type/Admin/EnhancementType.php @@ -0,0 +1,73 @@ +eccubeConfig = $eccubeConfig; + $this->validator = $validator; + $this->requestStack = $requestStack; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('admin_ga_id', TextType::class, [ + 'constraints' => [], + 'data' => '', + ]) + ; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'admin_enhancement'; + } +} diff --git a/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig b/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig new file mode 100644 index 00000000000..3cd6b994192 --- /dev/null +++ b/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig @@ -0,0 +1,76 @@ +{# +This file is part of EC-CUBE + +Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. + +http://www.ec-cube.co.jp/ + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +#} + +{% extends '@admin/default_frame.twig' %} + +{% set menus = ['setting', 'system', 'enhancement'] %} + +{% block title %}{{ 'admin.setting.system.enhancement'|trans }}{% endblock %} +{% block sub_title %}{{ 'admin.setting.system'|trans }}{% endblock %} + +{% block main %} +
+ {{ form_widget(form._token) }} +
+
+
+
+
+
+
+ {{ 'admin.setting.system.security__card_title'|trans }} +
+
+ +
+
+
+
+
+ +
+
+
+ {{ 'admin.setting.system.security.admin_url'|trans }} +
+
+
+ {{ form_widget(form.admin_ga_id) }} + {{ form_errors(form.admin_ga_id) }} +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +{% endblock %} From 103f6e2d7068b4ad176da143c3e720d1f7fef423 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 15:35:58 +0900 Subject: [PATCH 02/16] =?UTF-8?q?=E5=BA=97=E8=88=97=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E6=83=85=E5=A0=B1Entity=E3=81=AB=E3=82=AB=E3=83=A9=E3=83=A0?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Entity/BaseInfo.php | 31 +++++++++++++++++++ src/Eccube/Form/Type/Admin/ShopMasterType.php | 8 +++++ .../admin/Setting/Shop/shop_master.twig | 16 +++++++++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/Eccube/Entity/BaseInfo.php b/src/Eccube/Entity/BaseInfo.php index 879064692ff..dbe676699b0 100644 --- a/src/Eccube/Entity/BaseInfo.php +++ b/src/Eccube/Entity/BaseInfo.php @@ -277,6 +277,13 @@ class BaseInfo extends \Eccube\Entity\AbstractEntity */ private $Pref; + /** + * @var string|null + * + * @ORM\Column(name="ga_id", type="string", length=255, nullable=true) + */ + private $ga_id; + /** * Get id. * @@ -1076,5 +1083,29 @@ public function setPhpPath($php_path) return $this; } + + /** + * Set gaId. + * + * @param string|null $gaId + * + * @return BaseInfo + */ + public function setGaId($gaId = null) + { + $this->ga_id = $gaId; + + return $this; + } + + /** + * Get gaId. + * + * @return string|null + */ + public function getGaId() + { + return $this->ga_id; + } } } diff --git a/src/Eccube/Form/Type/Admin/ShopMasterType.php b/src/Eccube/Form/Type/Admin/ShopMasterType.php index 5ecc10d8a9e..53dd370f2f3 100644 --- a/src/Eccube/Form/Type/Admin/ShopMasterType.php +++ b/src/Eccube/Form/Type/Admin/ShopMasterType.php @@ -201,6 +201,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]), ], ]) + ->add('ga_id', TextType::class, [ + 'required' => false, + 'constraints' => [ + new Assert\Length([ + 'max' => $this->eccubeConfig['eccube_stext_len'], + ]), + ], + ]) ; $builder->add( diff --git a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig index 7181e390248..095c857d634 100644 --- a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig +++ b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig @@ -331,6 +331,20 @@ file that was distributed with this source code. +
+
{{ 'admin.setting.shop.shop.option_point'|trans }}
+
+
+
+
{{ 'admin.setting.shop.shop.email_from'|trans }}
+
+
+ {{ form_widget(form.ga_id) }} + {{ form_errors(form.ga_id) }} +
+
+
+
@@ -352,4 +366,4 @@ file that was distributed with this source code. -{% endblock %} \ No newline at end of file +{% endblock %} From 2be06e263ec3a91caf30eceb99f9b6b885e3bf16 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 16:01:13 +0900 Subject: [PATCH 03/16] =?UTF-8?q?=E3=83=95=E3=83=AD=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AB=E3=83=88=E3=83=A9=E3=83=83=E3=82=AD=E3=83=B3=E3=82=B0?= =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E5=9F=8B?= =?UTF-8?q?=E3=82=81=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resource/template/default/default_frame.twig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Eccube/Resource/template/default/default_frame.twig b/src/Eccube/Resource/template/default/default_frame.twig index 1c83277beab..88fab1bb808 100644 --- a/src/Eccube/Resource/template/default/default_frame.twig +++ b/src/Eccube/Resource/template/default/default_frame.twig @@ -46,6 +46,19 @@ file that was distributed with this source code. }); }); + + {% if BaseInfo.ga_id is not empty %} + + + + {% endif %} + {# Layout: HEAD #} {% if Layout.Head %} {{ include('block.twig', {'Blocks': Layout.Head}) }} From b907e7be35d47bc1711a7e7b3bd548fe37b25cf3 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 16:07:47 +0900 Subject: [PATCH 04/16] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/System/EnhancementController.php | 55 -------------- .../Form/Type/Admin/EnhancementType.php | 73 ------------------ .../admin/Setting/System/enhancement.twig | 76 ------------------- 3 files changed, 204 deletions(-) delete mode 100644 src/Eccube/Controller/Admin/Setting/System/EnhancementController.php delete mode 100644 src/Eccube/Form/Type/Admin/EnhancementType.php delete mode 100644 src/Eccube/Resource/template/admin/Setting/System/enhancement.twig diff --git a/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php b/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php deleted file mode 100644 index 3c1d61cf003..00000000000 --- a/src/Eccube/Controller/Admin/Setting/System/EnhancementController.php +++ /dev/null @@ -1,55 +0,0 @@ -systemService = $systemService; - } - - /** - * @Route("/%eccube_admin_route%/setting/system/enhancement", name="admin_setting_system_enhancement") - * @Template("@admin/Setting/System/enhancement.twig") - */ - public function index(Request $request) - { - $builder = $this->formFactory->createBuilder(EnhancementType::class); - $form = $builder->getForm(); - $form->handleRequest($request); - - - return [ - 'form' => $form->createView(), - ]; - } -} diff --git a/src/Eccube/Form/Type/Admin/EnhancementType.php b/src/Eccube/Form/Type/Admin/EnhancementType.php deleted file mode 100644 index f04ca44ee5b..00000000000 --- a/src/Eccube/Form/Type/Admin/EnhancementType.php +++ /dev/null @@ -1,73 +0,0 @@ -eccubeConfig = $eccubeConfig; - $this->validator = $validator; - $this->requestStack = $requestStack; - } - - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->add('admin_ga_id', TextType::class, [ - 'constraints' => [], - 'data' => '', - ]) - ; - } - - /** - * {@inheritdoc} - */ - public function getBlockPrefix() - { - return 'admin_enhancement'; - } -} diff --git a/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig b/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig deleted file mode 100644 index 3cd6b994192..00000000000 --- a/src/Eccube/Resource/template/admin/Setting/System/enhancement.twig +++ /dev/null @@ -1,76 +0,0 @@ -{# -This file is part of EC-CUBE - -Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. - -http://www.ec-cube.co.jp/ - -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. -#} - -{% extends '@admin/default_frame.twig' %} - -{% set menus = ['setting', 'system', 'enhancement'] %} - -{% block title %}{{ 'admin.setting.system.enhancement'|trans }}{% endblock %} -{% block sub_title %}{{ 'admin.setting.system'|trans }}{% endblock %} - -{% block main %} -
- {{ form_widget(form._token) }} -
-
-
-
-
-
-
- {{ 'admin.setting.system.security__card_title'|trans }} -
-
- -
-
-
-
-
- -
-
-
- {{ 'admin.setting.system.security.admin_url'|trans }} -
-
-
- {{ form_widget(form.admin_ga_id) }} - {{ form_errors(form.admin_ga_id) }} -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- -
-
- -{% endblock %} From e43290fb4c829c3cda8bb26e101966549d3e9dbd Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 16:10:07 +0900 Subject: [PATCH 05/16] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=83=A1=E3=83=8B?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/eccube/packages/eccube_nav.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/config/eccube/packages/eccube_nav.yaml b/app/config/eccube/packages/eccube_nav.yaml index 659f0755e0d..ebd6a83a66f 100644 --- a/app/config/eccube/packages/eccube_nav.yaml +++ b/app/config/eccube/packages/eccube_nav.yaml @@ -136,9 +136,6 @@ parameters: system_index: name: admin.setting.system.system_info url: admin_setting_system_system - enhancement: - name: admin.setting.system.enhancement - url: admin_setting_system_enhancement store: name: admin.store icon: fa-plug From 4e47a901f4963ae0e183f32e3d680194874235c7 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Wed, 10 Feb 2021 16:45:31 +0900 Subject: [PATCH 06/16] =?UTF-8?q?=E3=83=A9=E3=83=99=E3=83=AB=E3=82=84?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=BC=E3=82=B9=E3=83=9B=E3=83=AB=E3=83=80?= =?UTF-8?q?=E3=82=92=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Resource/locale/messages.ja.yaml | 4 ++++ .../template/admin/Setting/Shop/shop_master.twig | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Eccube/Resource/locale/messages.ja.yaml b/src/Eccube/Resource/locale/messages.ja.yaml index 2d6d3b38261..1d1c3a6741d 100644 --- a/src/Eccube/Resource/locale/messages.ja.yaml +++ b/src/Eccube/Resource/locale/messages.ja.yaml @@ -522,6 +522,7 @@ admin.common.device_type: 端末種別 admin.common.authority: 権限 admin.common.payment_method: 支払方法 admin.common.charge: 手数料 +admin.common.ga.tracking_id: 'UA-XXXXXXXX-1' #------------------------------------------------------------------------------------ # ホーム #------------------------------------------------------------------------------------ @@ -1115,6 +1116,8 @@ admin.setting.shop.shop.option_point: ポイント設定 admin.setting.shop.shop.option_point_enabled: ポイント機能 admin.setting.shop.shop.option_point_rate: ポイント付与率 admin.setting.shop.shop.option_point_conversion_rate: ポイント換算レート +admin.setting.shop.shop.ga: 'Googleアナリティクス設定' +admin.setting.shop.shop.ga.tracking_id: 'トラッキングID' #------------------------------------------------------------------------------------ # 設定:店舗設定:支払方法設定 @@ -1597,6 +1600,7 @@ tooltip.setting.shop.shop.option_product_tax: オンにすると、商品別に tooltip.setting.shop.shop.option_point_enabled: オンにすると、ポイント機能を有効化できます。 tooltip.setting.shop.shop.option_point_rate: 購入金額に対するポイント付与率を編集できます。 tooltip.setting.shop.shop.option_point_conversion_rate: 1ポイントあたりの換算レートです。例:「1」と設定すると1ポイント「1円」として利用可能になります。 +tooltip.setting.shop.shop.ga.tracking_id: 'Googleアナリティクスでのサイトのアクセス解析を行う場合に設定してください。' tooltip.setting.shop.payment.logo_image: 購入フローのお支払い方法に表示される画像を登録できます。登録がない場合は画像なしで表示されます。 tooltip.setting.shop.delivery.tracking_number_url: 配送業者のお問い合わせページURLを指定します。 tooltip.setting.shop.delivery.sale_type: この配送方法で取り扱える販売種別を指定します。 diff --git a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig index 095c857d634..3df723df2db 100644 --- a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig +++ b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig @@ -332,14 +332,17 @@ file that was distributed with this source code.
-
{{ 'admin.setting.shop.shop.option_point'|trans }}
+
{{ 'admin.setting.shop.shop.ga'|trans }}
-
{{ 'admin.setting.shop.shop.email_from'|trans }}
+
+ {{ 'admin.setting.shop.shop.ga.tracking_id'|trans }} + +
- {{ form_widget(form.ga_id) }} + {{ form_widget(form.ga_id, { attr : { placeholder : 'admin.common.ga.tracking_id' }} ) }} {{ form_errors(form.ga_id) }}
From 7cbce507f8698da043bd4dc3ec9222838161e665 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Fri, 12 Feb 2021 10:57:00 +0900 Subject: [PATCH 07/16] =?UTF-8?q?Web=E3=83=86=E3=82=B9=E3=83=88=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=20=E5=8B=95=E4=BD=9C=E7=A2=BA=E8=AA=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Eccube/Tests/Web/TopControllerTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Eccube/Tests/Web/TopControllerTest.php b/tests/Eccube/Tests/Web/TopControllerTest.php index fab25f00938..e504dff1de5 100644 --- a/tests/Eccube/Tests/Web/TopControllerTest.php +++ b/tests/Eccube/Tests/Web/TopControllerTest.php @@ -27,4 +27,18 @@ public function testCheckFavicon() $node = $crawler->filter('link[rel=icon]'); $this->assertEquals('/html/user_data/assets/img/common/favicon.ico', $node->attr('href')); } + + public function test_GAスクリプト表示確認() + { + // ある時 + // データ更新 + $crawler = $this->client->request('GET', $this->generateUrl('homepage')); + $node = $crawler->filterXPath('//script[contains(@src, "googletagmanager")]'); + $this->assertEquals('https://www.googletagmanager.com/gtag/js?id=ほげほげ', $node->attr('src')); + + // ない時 + // データ更新 + // Topコンテント取得 + // コンテント確認 + } } From c1bb2e808341ac1b3dc713dc967fcc1cfde2bd51 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Fri, 12 Feb 2021 11:25:22 +0900 Subject: [PATCH 08/16] =?UTF-8?q?GA=E3=83=88=E3=83=A9=E3=83=83=E3=82=AD?= =?UTF-8?q?=E3=83=B3=E3=82=B0=E3=81=AE=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97?= =?UTF-8?q?=E3=83=88=E8=A1=A8=E7=A4=BA=E3=83=86=E3=82=B9=E3=83=88=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Eccube/Tests/Web/TopControllerTest.php | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/Eccube/Tests/Web/TopControllerTest.php b/tests/Eccube/Tests/Web/TopControllerTest.php index e504dff1de5..dc5ee0f8381 100644 --- a/tests/Eccube/Tests/Web/TopControllerTest.php +++ b/tests/Eccube/Tests/Web/TopControllerTest.php @@ -13,6 +13,8 @@ namespace Eccube\Tests\Web; +use Eccube\Repository\BaseInfoRepository; + class TopControllerTest extends AbstractWebTestCase { public function testRoutingIndex() @@ -30,15 +32,21 @@ public function testCheckFavicon() public function test_GAスクリプト表示確認() { - // ある時 - // データ更新 + // GAスクリプト表示がある時 + $BaseInfo = $this->container->get(BaseInfoRepository::class)->get(); + $BaseInfo->setGaId('UA-12345678-1'); + $this->entityManager->flush(); + $crawler = $this->client->request('GET', $this->generateUrl('homepage')); $node = $crawler->filterXPath('//script[contains(@src, "googletagmanager")]'); - $this->assertEquals('https://www.googletagmanager.com/gtag/js?id=ほげほげ', $node->attr('src')); + $this->assertEquals('https://www.googletagmanager.com/gtag/js?id=UA-12345678-1', $node->attr('src')); + + // GAスクリプト表示がない時 + $BaseInfo->setGaId(''); + $this->entityManager->flush(); - // ない時 - // データ更新 - // Topコンテント取得 - // コンテント確認 + $crawler = $this->client->request('GET', $this->generateUrl('homepage')); + $node = $crawler->filterXPath('//script[contains(@src, "googletagmanager")]'); + $this->assertEmpty($node); } } From 06dec5902c8e4b0d77b25541c32797f1b4f4ac06 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Tue, 16 Feb 2021 11:01:51 +0900 Subject: [PATCH 09/16] =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=86=E3=82=A3=E5=A4=89=E6=95=B0=E5=90=8D=E3=81=A8=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Entity/BaseInfo.php | 6 +++--- tests/Eccube/Tests/Web/TopControllerTest.php | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Eccube/Entity/BaseInfo.php b/src/Eccube/Entity/BaseInfo.php index dbe676699b0..34df72c1bd2 100644 --- a/src/Eccube/Entity/BaseInfo.php +++ b/src/Eccube/Entity/BaseInfo.php @@ -282,7 +282,7 @@ class BaseInfo extends \Eccube\Entity\AbstractEntity * * @ORM\Column(name="ga_id", type="string", length=255, nullable=true) */ - private $ga_id; + private $gaId; /** * Get id. @@ -1093,7 +1093,7 @@ public function setPhpPath($php_path) */ public function setGaId($gaId = null) { - $this->ga_id = $gaId; + $this->gaId = $gaId; return $this; } @@ -1105,7 +1105,7 @@ public function setGaId($gaId = null) */ public function getGaId() { - return $this->ga_id; + return $this->gaId; } } } diff --git a/tests/Eccube/Tests/Web/TopControllerTest.php b/tests/Eccube/Tests/Web/TopControllerTest.php index dc5ee0f8381..5e012a9050c 100644 --- a/tests/Eccube/Tests/Web/TopControllerTest.php +++ b/tests/Eccube/Tests/Web/TopControllerTest.php @@ -13,7 +13,9 @@ namespace Eccube\Tests\Web; +use Eccube\Entity\BaseInfo; use Eccube\Repository\BaseInfoRepository; +use Eccube\Repository\Master\OrderStatusRepository; class TopControllerTest extends AbstractWebTestCase { @@ -33,7 +35,7 @@ public function testCheckFavicon() public function test_GAスクリプト表示確認() { // GAスクリプト表示がある時 - $BaseInfo = $this->container->get(BaseInfoRepository::class)->get(); + $BaseInfo = $this->entityManager->getRepository(BaseInfo::class)->get(); $BaseInfo->setGaId('UA-12345678-1'); $this->entityManager->flush(); From a4725f8ef41b0c2aaa825616a6346e8cbbb14c28 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Tue, 16 Feb 2021 11:55:08 +0900 Subject: [PATCH 10/16] =?UTF-8?q?GA=E3=81=AE=E3=83=96=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=82=AF=E5=8C=96=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../doctrine/import_csv/en/dtb_block.csv | 1 + .../import_csv/en/dtb_block_position.csv | 1 + .../doctrine/import_csv/ja/dtb_block.csv | 1 + .../import_csv/ja/dtb_block_position.csv | 1 + .../Resource/template/default/Block/ga.twig | 21 +++++++++++++++++++ .../template/default/default_frame.twig | 13 ------------ 6 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 src/Eccube/Resource/template/default/Block/ga.twig diff --git a/src/Eccube/Resource/doctrine/import_csv/en/dtb_block.csv b/src/Eccube/Resource/doctrine/import_csv/en/dtb_block.csv index 9badb35b3f6..d4a37f48f41 100644 --- a/src/Eccube/Resource/doctrine/import_csv/en/dtb_block.csv +++ b/src/Eccube/Resource/doctrine/import_csv/en/dtb_block.csv @@ -13,3 +13,4 @@ id,device_type_id,block_name,file_name,create_date,update_date,use_controller,de 12,10,News,news,2017-03-07 10:14:52,2017-03-07 10:14:52,0,0,block 13,10,Product Search,search_product,2017-03-07 10:14:52,2017-03-07 10:14:52,1,0,block 14,10,Featured,topic,2017-03-07 10:14:52,2017-03-07 10:14:52,0,0,block +16,10,Google Analytics,google_analytics,2021-02-16 12:00:00,2021-02-16 12:00:00,0,0,block \ No newline at end of file diff --git a/src/Eccube/Resource/doctrine/import_csv/en/dtb_block_position.csv b/src/Eccube/Resource/doctrine/import_csv/en/dtb_block_position.csv index ac0d57fda97..2971e591cad 100644 --- a/src/Eccube/Resource/doctrine/import_csv/en/dtb_block_position.csv +++ b/src/Eccube/Resource/doctrine/import_csv/en/dtb_block_position.csv @@ -18,3 +18,4 @@ "11","13","2","1","blockposition" "11","4","2","2","blockposition" "11","9","2","3","blockposition" +"1","16","1","0","blockposition" \ No newline at end of file diff --git a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block.csv b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block.csv index 3a6943624c0..2c26af919fa 100644 --- a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block.csv +++ b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block.csv @@ -13,3 +13,4 @@ "12","10","新着情報","news","2017-03-07 10:14:52","2017-03-07 10:14:52","0","0","block" "13","10","商品検索","search_product","2017-03-07 10:14:52","2017-03-07 10:14:52","1","0","block" "14","10","トピック","topic","2017-03-07 10:14:52","2017-03-07 10:14:52","0","0","block" +"16","10","Googleアナリティクス","google_analytics","2021-02-16 12:00:00","2021-02-16 12:00:00","0","0","block" \ No newline at end of file diff --git a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block_position.csv b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block_position.csv index ac0d57fda97..2971e591cad 100644 --- a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block_position.csv +++ b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_block_position.csv @@ -18,3 +18,4 @@ "11","13","2","1","blockposition" "11","4","2","2","blockposition" "11","9","2","3","blockposition" +"1","16","1","0","blockposition" \ No newline at end of file diff --git a/src/Eccube/Resource/template/default/Block/ga.twig b/src/Eccube/Resource/template/default/Block/ga.twig new file mode 100644 index 00000000000..decd59dc840 --- /dev/null +++ b/src/Eccube/Resource/template/default/Block/ga.twig @@ -0,0 +1,21 @@ +{# +This file is part of EC-CUBE + +Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. + +http://www.ec-cube.co.jp/ + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +#} +{% if BaseInfo.ga_id is not empty %} + + + +{% endif %} diff --git a/src/Eccube/Resource/template/default/default_frame.twig b/src/Eccube/Resource/template/default/default_frame.twig index 88fab1bb808..1c83277beab 100644 --- a/src/Eccube/Resource/template/default/default_frame.twig +++ b/src/Eccube/Resource/template/default/default_frame.twig @@ -46,19 +46,6 @@ file that was distributed with this source code. }); }); - - {% if BaseInfo.ga_id is not empty %} - - - - {% endif %} - {# Layout: HEAD #} {% if Layout.Head %} {{ include('block.twig', {'Blocks': Layout.Head}) }} From 05ed89f8e5e42495f7d4443549be9aab5f0842ab Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Tue, 16 Feb 2021 15:10:24 +0900 Subject: [PATCH 11/16] =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Version20210216120000.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/DoctrineMigrations/Version20210216120000.php diff --git a/app/DoctrineMigrations/Version20210216120000.php b/app/DoctrineMigrations/Version20210216120000.php new file mode 100644 index 00000000000..2a0bd7adaf1 --- /dev/null +++ b/app/DoctrineMigrations/Version20210216120000.php @@ -0,0 +1,32 @@ +connection->fetchColumn("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'Googleアナリティクス'"); + if ($count > 0) { + return; + } + $this->addSql("INSERT INTO dtb_block (block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ('Googleアナリティクス', 'ga', 0, 0, '2017-03-07 10:14:52', '2017-03-07 10:14:52', 10, 'block')"); + + // idを取得する + $id = $this->connection->fetchColumn("SELECT id FROM dtb_block WHERE block_name = 'Googleアナリティクス'"); + + $this->addSql("INSERT INTO dtb_block_position (section, block_id, layout_id, block_row, discriminator_type) VALUES (1, $id, 1, 0, 'blockposition')"); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + } +} From f4c2e1284d52f35f9c3fcaae65372735b95b502b Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Tue, 16 Feb 2021 17:02:28 +0900 Subject: [PATCH 12/16] =?UTF-8?q?Migration=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E4=BF=AE=E6=AD=A3=E3=81=A8twig=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E5=90=8D=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DoctrineMigrations/Version20210216120000.php | 5 +++-- .../default/Block/{ga.twig => google_analytics.twig} | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename src/Eccube/Resource/template/default/Block/{ga.twig => google_analytics.twig} (100%) diff --git a/app/DoctrineMigrations/Version20210216120000.php b/app/DoctrineMigrations/Version20210216120000.php index 2a0bd7adaf1..8ae4804603c 100644 --- a/app/DoctrineMigrations/Version20210216120000.php +++ b/app/DoctrineMigrations/Version20210216120000.php @@ -17,11 +17,12 @@ public function up(Schema $schema): void if ($count > 0) { return; } - $this->addSql("INSERT INTO dtb_block (block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ('Googleアナリティクス', 'ga', 0, 0, '2017-03-07 10:14:52', '2017-03-07 10:14:52', 10, 'block')"); // idを取得する - $id = $this->connection->fetchColumn("SELECT id FROM dtb_block WHERE block_name = 'Googleアナリティクス'"); + $id = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_block'); + $id++; + $this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'Googleアナリティクス', 'google_analytics', 0, 0, '2021-02-16 12:00:00', '2021-02-16 12:00:00', 10, 'block')"); $this->addSql("INSERT INTO dtb_block_position (section, block_id, layout_id, block_row, discriminator_type) VALUES (1, $id, 1, 0, 'blockposition')"); } diff --git a/src/Eccube/Resource/template/default/Block/ga.twig b/src/Eccube/Resource/template/default/Block/google_analytics.twig similarity index 100% rename from src/Eccube/Resource/template/default/Block/ga.twig rename to src/Eccube/Resource/template/default/Block/google_analytics.twig From c26e895033bee27f247fb4b03c9903ffc0f1fcb9 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Mon, 15 Mar 2021 13:19:31 +0900 Subject: [PATCH 13/16] =?UTF-8?q?Migration=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AEbool=E3=82=AB=E3=83=A9=E3=83=A0=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DoctrineMigrations/Version20210216120000.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/DoctrineMigrations/Version20210216120000.php b/app/DoctrineMigrations/Version20210216120000.php index 8ae4804603c..85e81cab8ac 100644 --- a/app/DoctrineMigrations/Version20210216120000.php +++ b/app/DoctrineMigrations/Version20210216120000.php @@ -22,7 +22,7 @@ public function up(Schema $schema): void $id = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_block'); $id++; - $this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'Googleアナリティクス', 'google_analytics', 0, 0, '2021-02-16 12:00:00', '2021-02-16 12:00:00', 10, 'block')"); + $this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'Googleアナリティクス', 'google_analytics', false, false, '2021-02-16 12:00:00', '2021-02-16 12:00:00', 10, 'block')"); $this->addSql("INSERT INTO dtb_block_position (section, block_id, layout_id, block_row, discriminator_type) VALUES (1, $id, 1, 0, 'blockposition')"); } From 33f13010a0483eb67f7855cbe8a6013906240c79 Mon Sep 17 00:00:00 2001 From: Yuko Kajihara Date: Tue, 16 Mar 2021 10:15:52 +0900 Subject: [PATCH 14/16] =?UTF-8?q?en=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AB=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=81twig=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AEID=E9=87=8D=E8=A4=87=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Resource/locale/messages.en.yaml | 4 ++++ .../Resource/template/admin/Setting/Shop/shop_master.twig | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Eccube/Resource/locale/messages.en.yaml b/src/Eccube/Resource/locale/messages.en.yaml index 34ab889016c..8f46248495f 100644 --- a/src/Eccube/Resource/locale/messages.en.yaml +++ b/src/Eccube/Resource/locale/messages.en.yaml @@ -522,6 +522,7 @@ admin.common.device_type: Type of Device admin.common.authority: Role admin.common.payment_method: Payment Method admin.common.charge: Charge +admin.common.ga.tracking_id: 'UA-XXXXXXXX-1' #------------------------------------------------------------------------------------ # Home #------------------------------------------------------------------------------------ @@ -1115,6 +1116,8 @@ admin.setting.shop.shop.option_point: Point Settings admin.setting.shop.shop.option_point_enabled: Points admin.setting.shop.shop.option_point_rate: Point Return Rate admin.setting.shop.shop.option_point_conversion_rate: Point Conversion Rate +admin.setting.shop.shop.ga: 'Google Analytics' +admin.setting.shop.shop.ga.tracking_id: 'Tracking ID' #------------------------------------------------------------------------------------ # Settings : Store Settings : Payment Methods @@ -1597,6 +1600,7 @@ tooltip.setting.shop.shop.option_product_tax: If turned on, you can set the tax tooltip.setting.shop.shop.option_point_enabled: If turned on, the point system is enabled. tooltip.setting.shop.shop.option_point_rate: You can change the point return rate by purchase amount. tooltip.setting.shop.shop.option_point_conversion_rate: Conversion rate per 1 point. E.g. If you set ''1'', the point becomes available to shoppers with the rate of 1 point = 1 yen. +tooltip.setting.shop.shop.ga.tracking_id: 'Set tracking id when you analyze your site access using Google Analytics.' tooltip.setting.shop.payment.logo_image: You can upload the payment option icons displayed in the payment methods during the checkout process. If not registered, the payment methods will be displayed w/o images. tooltip.setting.shop.delivery.tracking_number_url: Enter the URL of the shipping tracker of the delivery company. tooltip.setting.shop.delivery.sale_type: Specify the sales type(s) available for this delivery method. diff --git a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig index 3df723df2db..12d1680c3af 100644 --- a/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig +++ b/src/Eccube/Resource/template/admin/Setting/Shop/shop_master.twig @@ -333,7 +333,7 @@ file that was distributed with this source code.
{{ 'admin.setting.shop.shop.ga'|trans }}
-
+
From 86b3804490b829d587976501af37276f355e1b95 Mon Sep 17 00:00:00 2001 From: shinya Date: Mon, 26 Feb 2024 10:50:34 +0900 Subject: [PATCH 15/16] =?UTF-8?q?GA=E3=81=AE=E3=83=88=E3=83=A9=E3=83=83?= =?UTF-8?q?=E3=82=AD=E3=83=B3=E3=82=B0ID=E3=81=AE=E4=BE=8B=EF=BC=88placeho?= =?UTF-8?q?lder=EF=BC=89=E3=82=92GA4=E3=81=AE=E5=BD=A2=E5=BC=8F=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Resource/locale/messages.en.yaml | 2 +- src/Eccube/Resource/locale/messages.ja.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eccube/Resource/locale/messages.en.yaml b/src/Eccube/Resource/locale/messages.en.yaml index a2a6143da30..566de805076 100644 --- a/src/Eccube/Resource/locale/messages.en.yaml +++ b/src/Eccube/Resource/locale/messages.en.yaml @@ -544,7 +544,7 @@ admin.common.device_type: Type of Device admin.common.authority: Role admin.common.payment_method: Payment Method admin.common.charge: Charge -admin.common.ga.tracking_id: "UA-XXXXXXXX-1" +admin.common.ga.tracking_id: "G-XXXXXXXXXX" #------------------------------------------------------------------------------------ # Home #------------------------------------------------------------------------------------ diff --git a/src/Eccube/Resource/locale/messages.ja.yaml b/src/Eccube/Resource/locale/messages.ja.yaml index 5af8e3b9ad4..48bd6f1c7b2 100644 --- a/src/Eccube/Resource/locale/messages.ja.yaml +++ b/src/Eccube/Resource/locale/messages.ja.yaml @@ -544,7 +544,7 @@ admin.common.device_type: 端末種別 admin.common.authority: 権限 admin.common.payment_method: 支払方法 admin.common.charge: 手数料 -admin.common.ga.tracking_id: "UA-XXXXXXXX-1" +admin.common.ga.tracking_id: "G-XXXXXXXXXX" #------------------------------------------------------------------------------------ # ホーム #------------------------------------------------------------------------------------ From 781e0891e145ea884a4d08634031521fe6411e62 Mon Sep 17 00:00:00 2001 From: shinya Date: Mon, 11 Mar 2024 14:34:58 +0900 Subject: [PATCH 16/16] =?UTF-8?q?=E8=A6=8F=E7=B4=84=E3=82=92=E7=A2=BA?= =?UTF-8?q?=E8=AA=8D=E3=81=99=E3=82=8B=E6=97=A8=E3=82=92tooltip=E3=81=AB?= =?UTF-8?q?=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Eccube/Resource/locale/messages.en.yaml | 2 +- src/Eccube/Resource/locale/messages.ja.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eccube/Resource/locale/messages.en.yaml b/src/Eccube/Resource/locale/messages.en.yaml index 566de805076..bef2f6406c2 100644 --- a/src/Eccube/Resource/locale/messages.en.yaml +++ b/src/Eccube/Resource/locale/messages.en.yaml @@ -1707,7 +1707,7 @@ tooltip.setting.shop.shop.option_invoice_registration_number: Invoice registrati tooltip.setting.shop.shop.option_point_enabled: If turned on, the point system is enabled. tooltip.setting.shop.shop.option_point_rate: You can change the point return rate by purchase amount. tooltip.setting.shop.shop.option_point_conversion_rate: Conversion rate per 1 point. E.g. If you set ''1'', the point becomes available to shoppers with the rate of 1 point = 1 yen. -tooltip.setting.shop.shop.ga.tracking_id: "Set tracking id when you analyze your site access using Google Analytics." +tooltip.setting.shop.shop.ga.tracking_id: "Set tracking id when you analyze your site access using Google Analytics.(Please refer to Google Analytics terms and conditions)" tooltip.setting.shop.payment.rule: You can set the terms of use for the payment method. If the total payment amount (tax included) including your own fee matches the conditions, it will be displayed in the payment method options of the purchase flow. tooltip.setting.shop.payment.logo_image: You can upload the payment option icons displayed in the payment methods during the checkout process. If not registered, the payment methods will be displayed w/o images. tooltip.setting.shop.delivery.tracking_number_url: Enter the URL of the shipping tracker of the delivery company. diff --git a/src/Eccube/Resource/locale/messages.ja.yaml b/src/Eccube/Resource/locale/messages.ja.yaml index 48bd6f1c7b2..2f5ac5fb0c1 100644 --- a/src/Eccube/Resource/locale/messages.ja.yaml +++ b/src/Eccube/Resource/locale/messages.ja.yaml @@ -1708,7 +1708,7 @@ tooltip.setting.shop.shop.option_invoice_registration_number: 納品書に適格 tooltip.setting.shop.shop.option_point_enabled: オンにすると、ポイント機能を有効化できます。 tooltip.setting.shop.shop.option_point_rate: 購入金額に対するポイント付与率を編集できます。 tooltip.setting.shop.shop.option_point_conversion_rate: 1ポイントあたりの換算レートです。例:「1」と設定すると1ポイント「1円」として利用可能になります。 -tooltip.setting.shop.shop.ga.tracking_id: "Googleアナリティクスでのサイトのアクセス解析を行う場合に設定してください。" +tooltip.setting.shop.shop.ga.tracking_id: "Googleアナリティクスでアクセス解析を行う場合に設定してください(Googleアナリティクスの規約も参照ください)" tooltip.setting.shop.payment.rule: お支払い方法の利用条件を設定できます。自身の手数料を含む支払総額(税込)が条件に一致する場合、購入フローのお支払い方法の選択肢に表示されまます。 tooltip.setting.shop.payment.logo_image: 購入フローのお支払い方法に表示される画像を登録できます。登録がない場合は画像なしで表示されます。 tooltip.setting.shop.delivery.tracking_number_url: 配送業者のお問い合わせページURLを指定します。