고객 그룹을 pdf 포장 전표에 추가하려고합니다. 나는 이것이 Sales/Model/Order/Pdf/Abstract.php에서 이루어져야한다고 가정하지만, 어디에 넣어야합니까?Magento : 고객 그룹을 PDF 포장 명세서에 추가하십시오.
감사합니다.
고객 그룹을 pdf 포장 전표에 추가하려고합니다. 나는 이것이 Sales/Model/Order/Pdf/Abstract.php에서 이루어져야한다고 가정하지만, 어디에 넣어야합니까?Magento : 고객 그룹을 PDF 포장 명세서에 추가하십시오.
감사합니다.
좋아, 내가 한 일은 여기에 있습니다. 나는 다음과 같은 코드를 삽입 - 내가 쓴 :
/* Add head */
$this->insertOrder($page, $order, Mage::getStoreConfigFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId()));
$page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
$this->_setFontRegular($page);
$page->drawText(Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId(), 35, 780, 'UTF-8');
을 응용 프로그램의 \ 코드에서 \ 로컬 \ 마법사 \ 판매 \ 모델 \ 주문 \ : 이미 존재하는 코드 블록 직후
/* Add Customer Type to Invoice */
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$readresult=$write->query("select customer_id from `sales_order` where increment_id = ".$order->getIncrementId()." limit 0,1;");
$row = $readresult->fetch();
$customerId = $row['customer_id'];
$myRoleId = 1;
if (!empty($customerId)) {
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$readresult=$write->query("select group_id from `customer_entity` where entity_id = ".$customerId." limit 0,1;");
$row = $readresult->fetch();
$myRoleId = $row['group_id'];
}
switch ($myRoleId){
case 2: $groupTitle = 'Wholesaler Invoice';
break;
case 3: $groupTitle = 'Retailer Invoice';
break;
case 4: $groupTitle = 'Dealer Invoice';
break;
default: $groupTitle = 'Customer Invoice';
break;
}
$page->drawText($groupTitle, 480, 780, 'UTF-8');
/* End add Customer Type */
Pdf \ Invoice.php 파일
Abstract.php 에서처럼 $order
을 사용할 수있는 경우 다음 코드를 사용하여 고객 그룹 ID 및 이름을 가져올 수 있습니다.
$customerGroupId = $order->getCustomerGroupId();
$groupname = Mage::getModel('customer/group')->load($customerGroupId)->getCustomerGroupCode();
Magento의 PDF 생성이 잘못되었습니다. 행운을 빈다 :) – Nick
나는 몇 주 전에이 정확한 일을했다. 내 코드를 찾아 보자. 나는 그것을 게시 할 것이다. – RThomas