バージョン選択

フォーラム

メニュー

オンライン状況

50 人のユーザが現在オンラインです。 (34 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 50
もっと...

サイト内検索

プラグイン > 開発について > プラグインから納品書の住所を非表示にしたい

開発について

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
hashida
投稿日時: 2021/11/8 10:27
対応状況: 開発中
半人前
登録日: 2021/6/25
居住地:
投稿: 28
プラグインから納品書の住所を非表示にしたい
お世話になっております。
納品書の購入者住所を非表示にしたいです。
src\Eccube\Service\OrderPdfService.phpを継承しrenderOrderDataメソッドをオーバーライドし、住所設定の部分コメントアウトしたのですが住所が表示されてしまします。
子クラス住所の変数に別の値()を入れてみたのですが、住所の上にそのデータが重なって表示されてしまいます。

納品書PDFのをプラグインから非表示にすることは可能でしょうか。
ご存じでしたらご教授いただければ幸いです。
何卒宜しくお願い致します。


以下のサイトを参考にしました。
https://qiita.com/chihiro-adachi/items/b3bb70e6abbc0f824965

プラグインのservices.yamlは以下の通りです。
services:
  Plugin\sample\Service\OrderPdfServiceCustomizer:
      public: false
      autowire: true
      decorates: Eccube\Service\OrderPdfService


<?php

namespace Plugin\sample\Service;

use Eccube\Common\EccubeConfig;
use Eccube\Entity\BaseInfo;
use Eccube\Entity\OrderItem;
use Eccube\Entity\Shipping;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\OrderPdfRepository;
use Eccube\Repository\OrderRepository;
use Eccube\Repository\ShippingRepository;
use Eccube\Twig\Extension\EccubeExtension;
use Eccube\Twig\Extension\TaxExtension;
use Eccube\Service\TaxRuleService;
use setasign\Fpdi\TcpdfFpdi;

class OrderPdfServiceCustomizer extends \Eccube\Service\OrderPdfService
{
    /** @var OrderRepository */
    protected $orderRepository;

    /** @var ShippingRepository */
    protected $shippingRepository;

    /** @var OrderPdfRepository */
    protected $orderPdfRepository;

    /** @var TaxRuleService */
    protected $taxRuleService;

    /**
     * @var EccubeConfig
     */
    private $eccubeConfig;

    /**
     * @var EccubeExtension
     */
    private $eccubeExtension;

    /**
     * @var TaxExtension
     */
    private $taxExtension;

  
    /**
     * OrderPdfService constructor.
     * @param EccubeConfig $eccubeConfig
     * @param OrderRepository $orderRepository
     * @param ShippingRepository $shippingRepository
     * @param TaxRuleService $taxRuleService
     * @param BaseInfoRepository $baseInfoRepository
     * @param EccubeExtension $eccubeExtension
     * @param TaxExtension $taxExtension
     * @throws \Exception
     */
    function __construct(EccubeConfig $eccubeConfig, OrderRepository $orderRepository, ShippingRepository $shippingRepository, TaxRuleService $taxRuleService, BaseInfoRepository $baseInfoRepository, EccubeExtension $eccubeExtension, TaxExtension $taxExtension) {
        
        $this->eccubeConfig = $eccubeConfig;
        $this->baseInfoRepository = $baseInfoRepository->get();
        $this->orderRepository = $orderRepository;
        $this->shippingRepository = $shippingRepository;
        $this->taxRuleService = $taxRuleService;
        $this->eccubeExtension = $eccubeExtension;
        $this->taxExtension = $taxExtension;

        parent::__construct($eccubeConfig, $orderRepository, $shippingRepository, $taxRuleService, $baseInfoRepository, $eccubeExtension, $taxExtension);
    }

    /**
     * 購入者情報を設定する.
     *
     * @param Shipping $Shipping
     */
    protected function renderOrderData(Shipping $Shipping)
    {

        // 基準座標を設定する
        $this->setBasePosition();

        // フォント情報のバックアップ
        $this->backupFont();

        // =========================================
        // 購入者情報部
        // =========================================

        $Order = $Shipping->getOrder();

        // 購入者都道府県+住所1
        // $text = $Order->getPref().$Order->getAddr01();
        // $text = $Shipping->getPref().$Shipping->getAddr01();
        $text = "000000"; <-ダミーデータを入れるも重なって表示
        $this->lfText(27, 47, $text, 10);
        $this->lfText(27, 51, $Shipping->getAddr02(), 10); //購入者住所2

        // 購入者氏名
        if (null !== $Shipping->getCompanyName()) {
            // 会社名
            $text = $Shipping->getCompanyName();
            $this->lfText(27, 57, $text, 11);
            // 氏名
            $text = $Shipping->getName01().' '.$Shipping->getName02().' 様';
            $this->lfText(27, 63, $text, 11);
        } else {
            $text = $Shipping->getName01().' '.$Shipping->getName02().' 様';
            $this->lfText(27, 59, $text, 11);
        }

        // =========================================
        // お買い上げ明細部
        // =========================================
        $this->SetFont(self::FONT_SJIS, '', 10);

        //ご注文日
        $orderDate = $Order->getCreateDate()->format('Y/m/d H:i');
        if ($Order->getOrderDate()) {
            $orderDate = $Order->getOrderDate()->format('Y/m/d H:i');
        }

        $this->lfText(25, 125, $orderDate, 10);
        //注文番号
        $this->lfText(25, 135, $Order->getOrderNo(), 10);

        // 総合計金額
        if (!$Order->isMultiple()) {
            $this->SetFont(self::FONT_SJIS, 'B', 15);
            $paymentTotalText = $this->eccubeExtension->getPriceFilter($Order->getPaymentTotal());

            $this->setBasePosition(120, 95.5);
            $this->Cell(5, 7, '', 0, 0, '', 0, '');
            $this->Cell(67, 8, $paymentTotalText, 0, 2, 'R', 0, '');
            $this->Cell(0, 45, '', 0, 2, '', 0, '');
        }

        // フォント情報の復元
        $this->restoreFont();

        return parent::renderOrderData($Shipping);
    }
}
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » プラグインから納品書の住所を非表示にしたい hashida 2021/11/8 10:27
     Re: プラグインから納品書の住所を非表示にしたい 468 2021/11/8 10:35
       Re: プラグインから納品書の住所を非表示にしたい hashida 2021/11/8 14:43

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は89,236名です
総投稿数は110,053件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1651
8
red
1570
9
mcontact
1299
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.