2025年4月16日カテゴリー:

EC-CUBE4.2-4.3系 帳票PDFプラグイン:帳票に「熨斗(のし)を配送別で指定するプラグイン」を反映する

EC-CUBE4.2系 または 4.3系 をご利用の場合

 

pdf001

pdf002

■app/Plugin/ReportPdf2Ft/Service/ReportPdf2Service.php

 

(1)「お買上げ明細」の「受注詳細表」の開始位置を下に移動し、スペースを確保する。

① protected function setFancyTable($header, $data, $w){ }内、
142」を「152」へ変更する。
——————————-
// 開始座標の設定
$this->setBasePosition(0, 142);
——————————-
↓【変更】
——————————-
// 開始座標の設定
$this->setBasePosition(0, 152);
——————————-

 

② protected function FancyTable2($header, $data, $w){ }内、
70」を「80」へ変更する。
——————————-
// 開始座標の設定
$this->setBasePosition(0, 70);
——————————-
↓【変更】
——————————-
// 開始座標の設定
$this->setBasePosition(0, 80);
——————————-

 

 

(2)のしの希望を追加する。

 

① protected function renderOrderData(Shipping $Shipping, array $formData){ }内、

// ▼のしプラグイン ~ // ▲のしプラグイン を追加します。
——————————-

        // =========================================
        // ▼お買上げ明細のお届け先・お支払い方法等
        // =========================================
 
        // お支払い方法
        $text = ‘お支払い方法:’ . $Order->getPayment();
        $this->lfText(124, 114, $text, 10);
 
$y = 116; // 開始y軸位置
 
// 配送業者
if($formData[‘haiso_show’] != 2 and $Shipping->getShippingDeliveryName()) {
$y += 4;
$text = ‘配送業者:’.$Shipping->getShippingDeliveryName();
$this->lfText(124, $y, $text, 10);
}
// お届け日
if($Shipping->getShippingDeliveryDate()) {
$y += 4;
$text = ‘お届け日:’.$Shipping->getShippingDeliveryDate()->format(‘Y/m/d’);
$this->lfText(124, $y, $text, 10);
}
// お届け時間
if($Shipping->getShippingDeliveryTime()) {
$y += 4;
$text = ‘お届け時間:’.$Shipping->getShippingDeliveryTime();
$this->lfText(124, $y, $text, 10);
}
// お問い合わせ番号
if($formData[‘number_show’] != 2 and $Shipping->getTrackingNumber()) {
$y += 4;
$text = ‘お問い合わせ番号:’.$Shipping->getTrackingNumber();
$this->lfText(124, $y, $text, 10);
}

 // ▼のしプラグイン
if($Shipping->getNoshideliveryCheck() == ‘希望する’) {
$y += 6;
$text = ‘のしの種類:’.$Shipping->getNoshideliveryKind();
$this->lfText(124, $y, $text, 10);
$y += 4;
$text = ‘表書き(上段):’.$Shipping->getNoshideliveryTie();
$this->lfText(124, $y, $text, 10);
if($Shipping->getNoshideliveryTie() == ‘その他’) {
$y += 4;
$text = ‘┗ 表書き[その他]:’.$Shipping->getGpTitle();
$this->lfText(124, $y, $text, 10);
}
$y += 4;
$text = ‘お名前(下段):’.$Shipping->getGpName();
$this->lfText(124, $y, $text, 10);
} else {
$y += 6;
$text = ‘のし希望なし’;
$this->lfText(124, $y, $text, 10);
}
// ▲のしプラグイン

——————————-

 

② protected function renderShippingData(Shipping $Shipping, array $formData) { }内、

// ▼のしプラグイン ~ // ▲のしプラグイン を追加します。
——————————-

// TEL
$y += 5;
$tel = $Shippings->getPhoneNumber();
$text = ‘TEL: ‘.$tel;
$this->lfText(18, $y, $text, 10);
 
$y += 1;
if($formData[‘haiso_show’] != 2 and $Shippings->getShippingDeliveryName()) {
$y += 4;
$text = “配送業者:” . $Shippings->getShippingDeliveryName();
$this->lfText(24, $y, $text, 9);
}
if($Shippings->getShippingDeliveryDate()) {
$y += 4;
$text = “お届け日:” . $Shippings->getShippingDeliveryDate()->format(‘Y/m/d’) ;
$this->lfText(24, $y, $text, 9);
}
if($Shippings->getShippingDeliveryTime()) {
$y += 4;
$text = “お届け時間:” . $Shippings->getShippingDeliveryTime();
$this->lfText(24, $y, $text, 9);
}
 
// お問い合わせ番号
if($formData[‘number_show’] != 2 and $Shippings->getTrackingNumber()) {
$y += 4;
$text = ‘お問い合わせ番号:’.$Shippings->getTrackingNumber();
$this->lfText(24, $y, $text, 9);
}

 // ▼のしプラグイン
if($Shippings->getNoshideliveryCheck() == ‘希望する’) {
$y += 6;
$text = ‘のしの種類:’.$Shippings->getNoshideliveryKind();
$this->lfText(24, $y, $text, 10);
$y += 4;
$text = ‘表書き(上段):’.$Shippings->getNoshideliveryTie();
$this->lfText(24, $y, $text, 10);
if($Shippings->getNoshideliveryTie() == ‘その他’) {
$y += 4;
$text = ‘┗ 表書き[その他]:’.$Shippings->getGpTitle();
$this->lfText(24, $y, $text, 10);
}
$y += 4;
$text = ‘お名前(下段):’.$Shippings->getGpName();
$this->lfText(24, $y, $text, 10);
} else {
$y += 6;
$text = ‘のし希望なし’;
$this->lfText(24, $y, $text, 10);
}
// ▲のしプラグイン

——————————-