haren2005 Posted February 12, 2012 Share Posted February 12, 2012 Hello! I wonder how to resize the address of the delivery slip. And delete the title. I use integreated labels. So I can deselect the address and paste it directly onto the package. I want to delete the title in red and enlarge the blue address. Link to comment Share on other sites More sharing options...
Rhapsody Posted February 12, 2012 Share Posted February 12, 2012 To delete the title in Red - Back Office, Tools, Translate, PDF Translations, then select your language and type spaces in the field that has the existing title To enlarge the address get the PDF.php file from classes, then edit the section below with desired font size and create an override file to put in override\classes\PDF.php that starts with: <?php class PDF extends PDFCore { /* *code below taken from PDF.php version 1.4.7.0 */ public static function orderReturn($orderReturn, $mode = 'D', $multiple = false, &$pdf = NULL) { $pdf = new PDF('P', 'mm', 'A4'); self::$orderReturn = $orderReturn; $order = new Order($orderReturn->id_order); self::$order = $order; $pdf->SetAutoPageBreak(true, 35); $pdf->StartPageGroup(); $pdf->AliasNbPages(); $pdf->AddPage(); /* Display address information */ $arrayConf = array('PS_SHOP_NAME', 'PS_SHOP_ADDR1', 'PS_SHOP_ADDR2', 'PS_SHOP_CODE', 'PS_SHOP_CITY', 'PS_SHOP_COUNTRY', 'PS_SHOP_DETAILS', 'PS_SHOP_PHONE', 'PS_SHOP_STATE'); $conf = Configuration::getMultiple($arrayConf); foreach ($conf as $key => $value) $conf[$key] = Tools::iconv('utf-8', self::encoding(), $value); foreach ($arrayConf as $key) if (!isset($conf[$key])) $conf[$key] = ''; $width = 100; $pdf->SetX(10); $pdf->SetY(25); $pdf->SetFont(self::fontname(), '', 9); $addressType = array( 'invoice' => array(), 'delivery' => array()); $patternRules = array( 'avoid' => array( 'address2', 'company', 'phone', 'phone_mobile')); $addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width); /* * display order information */ $pdf->Ln(12); $pdf->SetFillColor(240, 240, 240); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('RETURN #').sprintf('%06d', self::$orderReturn->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderReturn->date_upd, self::$order->id_lang), 1, 2, 'L'); $pdf->Cell(0, 6, self::l('We have logged your return request.'), 'TRL', 2, 'L'); $pdf->Cell(0, 6, self::l('Your package must be returned to us within').' '.Configuration::get('PS_ORDER_RETURN_NB_DAYS').' '.self::l('days of receiving your order.'), 'BRL', 2, 'L'); $pdf->Ln(5); $pdf->Cell(0, 6, self::l('List of items marked as returned :'), 0, 2, 'L'); $pdf->Ln(5); $pdf->ProdReturnTab(); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 6, self::l('Return reference:').' '.self::l('RET').sprintf('%06d', self::$order->id), 0, 2, 'C'); $pdf->Cell(0, 6, self::l('Please include this number on your return package.'), 0, 2, 'C'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 9); $pdf->Cell(0, 6, self::l('REMINDER:'), 0, 2, 'L'); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('- All products must be returned in their original packaging without damage or wear.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('- Please print out this document and slip it into your package.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('- The package should be sent to the following address:'), 0, 2, 'L'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 5, Tools::strtoupper($conf['PS_SHOP_NAME']), 0, 1, 'C', 1); $pdf->Cell(0, 5, (!empty($conf['PS_SHOP_ADDR1']) ? self::l('Headquarters:').' '.$conf['PS_SHOP_ADDR1'].(!empty($conf['PS_SHOP_ADDR2']) ? ' '.$conf['PS_SHOP_ADDR2'] : '').' '.$conf['PS_SHOP_CODE'].' '.$conf['PS_SHOP_CITY'].' '.$conf['PS_SHOP_COUNTRY'].((isset($conf['PS_SHOP_STATE']) AND !empty($conf['PS_SHOP_STATE'])) ? (', '.$conf['PS_SHOP_STATE']) : '') : ''), 0, 1, 'C', 1); $pdf->Ln(5); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('Upon receiving your package, we will notify you by e-mail. We will then begin processing the reimbursement of your order total.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('Let us know if you have any questions.'), 0, 2, 'L'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 6, self::l('If the conditions of return listed above are not respected,'), 'TRL', 2, 'C'); $pdf->Cell(0, 6, self::l('we reserve the right to refuse your package and/or reimbursement.'), 'BRL', 2, 'C'); return $pdf->Output(sprintf('%06d', self::$order->id).'.pdf', $mode); } } Link to comment Share on other sites More sharing options...
haren2005 Posted February 13, 2012 Author Share Posted February 13, 2012 To delete the title in Red - Back Office, Tools, Translate, PDF Translations, then select your language and type spaces in the field that has the existing title To enlarge the address get the PDF.php file from classes, then edit the section below with desired font size and create an override file to put in override\classes\PDF.php that starts with: <?php class PDF extends PDFCore { /* *code below taken from PDF.php version 1.4.7.0 */ public static function orderReturn($orderReturn, $mode = 'D', $multiple = false, &$pdf = NULL) { $pdf = new PDF('P', 'mm', 'A4'); self::$orderReturn = $orderReturn; $order = new Order($orderReturn->id_order); self::$order = $order; $pdf->SetAutoPageBreak(true, 35); $pdf->StartPageGroup(); $pdf->AliasNbPages(); $pdf->AddPage(); /* Display address information */ $arrayConf = array('PS_SHOP_NAME', 'PS_SHOP_ADDR1', 'PS_SHOP_ADDR2', 'PS_SHOP_CODE', 'PS_SHOP_CITY', 'PS_SHOP_COUNTRY', 'PS_SHOP_DETAILS', 'PS_SHOP_PHONE', 'PS_SHOP_STATE'); $conf = Configuration::getMultiple($arrayConf); foreach ($conf as $key => $value) $conf[$key] = Tools::iconv('utf-8', self::encoding(), $value); foreach ($arrayConf as $key) if (!isset($conf[$key])) $conf[$key] = ''; $width = 100; $pdf->SetX(10); $pdf->SetY(25); $pdf->SetFont(self::fontname(), '', 9); $addressType = array( 'invoice' => array(), 'delivery' => array()); $patternRules = array( 'avoid' => array( 'address2', 'company', 'phone', 'phone_mobile')); $addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width); /* * display order information */ $pdf->Ln(12); $pdf->SetFillColor(240, 240, 240); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('RETURN #').sprintf('%06d', self::$orderReturn->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderReturn->date_upd, self::$order->id_lang), 1, 2, 'L'); $pdf->Cell(0, 6, self::l('We have logged your return request.'), 'TRL', 2, 'L'); $pdf->Cell(0, 6, self::l('Your package must be returned to us within').' '.Configuration::get('PS_ORDER_RETURN_NB_DAYS').' '.self::l('days of receiving your order.'), 'BRL', 2, 'L'); $pdf->Ln(5); $pdf->Cell(0, 6, self::l('List of items marked as returned :'), 0, 2, 'L'); $pdf->Ln(5); $pdf->ProdReturnTab(); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 6, self::l('Return reference:').' '.self::l('RET').sprintf('%06d', self::$order->id), 0, 2, 'C'); $pdf->Cell(0, 6, self::l('Please include this number on your return package.'), 0, 2, 'C'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 9); $pdf->Cell(0, 6, self::l('REMINDER:'), 0, 2, 'L'); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('- All products must be returned in their original packaging without damage or wear.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('- Please print out this document and slip it into your package.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('- The package should be sent to the following address:'), 0, 2, 'L'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 5, Tools::strtoupper($conf['PS_SHOP_NAME']), 0, 1, 'C', 1); $pdf->Cell(0, 5, (!empty($conf['PS_SHOP_ADDR1']) ? self::l('Headquarters:').' '.$conf['PS_SHOP_ADDR1'].(!empty($conf['PS_SHOP_ADDR2']) ? ' '.$conf['PS_SHOP_ADDR2'] : '').' '.$conf['PS_SHOP_CODE'].' '.$conf['PS_SHOP_CITY'].' '.$conf['PS_SHOP_COUNTRY'].((isset($conf['PS_SHOP_STATE']) AND !empty($conf['PS_SHOP_STATE'])) ? (', '.$conf['PS_SHOP_STATE']) : '') : ''), 0, 1, 'C', 1); $pdf->Ln(5); $pdf->SetFont(self::fontname(), '', 9); $pdf->Cell(0, 6, self::l('Upon receiving your package, we will notify you by e-mail. We will then begin processing the reimbursement of your order total.'), 0, 2, 'L'); $pdf->Cell(0, 6, self::l('Let us know if you have any questions.'), 0, 2, 'L'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 10); $pdf->Cell(0, 6, self::l('If the conditions of return listed above are not respected,'), 'TRL', 2, 'C'); $pdf->Cell(0, 6, self::l('we reserve the right to refuse your package and/or reimbursement.'), 'BRL', 2, 'C'); return $pdf->Output(sprintf('%06d', self::$order->id).'.pdf', $mode); } } Problem one is solved! I still do not understand how I can change the size. My file is located in the \ classes \ PDF.php. If I change $ pdf-> SetX (10); $ pdf-> SetY (25); $ pdf-> setFont (self :: fontname (),'', 9); <------------ font it is still no difference. I feel like I'm doing wrong. Link to comment Share on other sites More sharing options...
Rhapsody Posted February 14, 2012 Share Posted February 14, 2012 Problem one is solved! I still do not understand how I can change the size. My file is located in the \ classes \ PDF.php. If I change $ pdf-> SetX (10); $ pdf-> SetY (25); $ pdf-> setFont (self :: fontname (),'', 9); <------------ font it is still no difference. I feel like I'm doing wrong. Try this instead - look at where I changed the font from 9 to 12 points. Save the file as PDF.php and store it under override\classes\ <?php class PDF extends PDFCore { /* *code below taken from PDF.php version 1.4.7.0 */ /** * Main * * @param object $order Order * @param string $mode Download or display (optional) */ public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false) { global $cookie; if (!Validate::isLoadedObject($order) OR (!$cookie->id_employee AND (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number))) die('Invalid order or invalid order state'); self::$order = $order; self::$orderSlip = $slip; self::$delivery = $delivery; self::$_iso = strtoupper(Language::getIsoById((int)(self::$order->id_lang))); if ((self::$_priceDisplayMethod = $order->getTaxCalculationMethod()) === false) die(self::l('No price display method defined for the customer group')); if (!$multiple) $pdf = new PDF('P', 'mm', 'A4'); $pdf->SetAutoPageBreak(true, 35); $pdf->StartPageGroup(); self::$currency = Currency::getCurrencyInstance((int)(self::$order->id_currency)); $pdf->AliasNbPages(); $pdf->AddPage(); $width = 100; $pdf->SetX(10); $pdf->SetY(25); $pdf->SetFont(self::fontname(), '', 12); $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L'); $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L'); $pdf->Ln(5); $pdf->SetFont(self::fontname(), '', 12); // Font size chaged from 9 $addressType = array( 'delivery' => array(), 'invoice' => array(), ); $patternRules = array( 'optional' => array( 'address2', 'company'), 'avoid' => array( 'State:iso_code')); $addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width); if (Configuration::get('VATNUMBER_MANAGEMENT') AND !empty($addressType['invoice']['addressObject']->vat_number)) { $vat_delivery = ''; if ($addressType['invoice']['addressObject']->id != $addressType['delivery']['addressObject']->id) $vat_delivery = $addressType['delivery']['addressObject']->vat_number; $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $vat_delivery), 0, 'L'); $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->vat_number), 0, 'L'); $pdf->Ln(5); } if ($addressType['invoice']['addressObject']->dni != NULL) $pdf->Cell($width, 10, self::l('Tax ID number:').' '.Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->dni), 0, 'L'); /* * display order information */ $carrier = new Carrier(self::$order->id_carrier); if ($carrier->name == '0') $carrier->name = Configuration::get('PS_SHOP_NAME'); $history = self::$order->getHistory(self::$order->id_lang); foreach($history as $h) if ($h['id_order_state'] == Configuration::get('PS_OS_SHIPPING')) $shipping_date = $h['date_add']; $pdf->Ln(12); $pdf->SetFillColor(240, 240, 240); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont(self::fontname(), '', 9); if (self::$orderSlip) $pdf->Cell(0, 6, self::l('SLIP #').' '.sprintf('%06d', self::$orderSlip->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1); elseif (self::$delivery) $pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1); elseif ((int)self::$order->invoice_date) $pdf->Cell(0, 6, self::l('INVOICE #').' '.Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1); else $pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1); $pdf->Cell(55, 6, self::l('Order #').' '.sprintf('%06d', self::$order->id), 'L', 0); $pdf->Cell(70, 6, self::l('Carrier:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L'); $pdf->Cell(0, 6, self::l('Payment method:'), 'LR'); $pdf->Ln(5); $pdf->Cell(55, 6, (isset($shipping_date) ? self::l('Shipping date:').' '.Tools::displayDate($shipping_date, self::$order->id_lang) : ' '), 'LB', 0); $pdf->Cell(70, 6, ($order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name)), 'LRB'); $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB'); $pdf->Ln(15); $pdf->ProdTab((self::$delivery ? true : '')); /* Canada */ $taxable_address = new Address((int)self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); if (!self::$delivery && strtoupper(Country::getIsoById((int)$taxable_address->id_country)) == 'CA') { $pdf->Ln(15); $taxToDisplay = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'order_tax WHERE id_order = '.(int)self::$order->id); foreach ($taxToDisplay AS $t) { $pdf->Cell(0, 6, utf8_decode($t['tax_name']).' ('.number_format($t['tax_rate'], 2, '.', '').'%) '.self::convertSign(Tools::displayPrice($t['amount'], self::$currency, true)), 0, 0, 'R'); $pdf->Ln(5); } } /* End */ /* Exit if delivery */ if (!self::$delivery) { if (!self::$orderSlip) $pdf->DiscTab(); $priceBreakDown = array(); $pdf->priceBreakDownCalculation($priceBreakDown); if (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost)) { $priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2); $priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping; } if (!self::$orderSlip) { $taxDiscount = self::$order->getTaxesAverageUsed(); if ($taxDiscount != 0) $priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2); else $priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts; $priceBreakDown['totalWithTax'] -= self::$order->total_discounts; } /* * Display price summation */ if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products) { $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 8); $width = 165; $pdf->Cell($width, 0, self::l('Total products (tax excl.)').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); $pdf->SetFont(self::fontname(), 'B', 8); $width = 165; $pdf->Cell($width, 0, self::l('Total products (tax incl.)').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } else { $pdf->Ln(5); $pdf->SetFont(self::fontname(), 'B', 8); $width = 165; $pdf->Cell($width, 0, self::l('Total products ').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } if (!self::$orderSlip AND self::$order->total_discounts != '0.00') { $pdf->Cell($width, 0, self::l('Total discounts (tax incl.)').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } if (isset(self::$order->total_wrapping) and ((float)(self::$order->total_wrapping) > 0)) { $pdf->Cell($width, 0, self::l('Total gift-wrapping').' : ', 0, 0, 'R'); if (self::$_priceDisplayMethod == PS_TAX_EXC) $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true)), 0, 0, 'R'); else $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } if (self::$order->total_shipping != '0.00' AND (!self::$orderSlip OR (self::$orderSlip AND self::$orderSlip->shipping_cost))) { if (self::$_priceDisplayMethod == PS_TAX_EXC) { $pdf->Cell($width, 0, self::l('Total shipping (tax excl.)').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true)), 0, 0, 'R'); } else { $pdf->Cell($width, 0, self::l('Total shipping (tax incl.)').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R'); } $pdf->Ln(4); } if (Configuration::get('PS_TAX') OR $order->total_products_wt != $order->total_products) { $pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax incl.)') : self::l(' (tax excl.)')).' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithTax'] : $priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); $pdf->Cell($width, 0, self::l('Total').' '.(self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')).' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice((self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax']), self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } else { $pdf->Cell($width, 0, self::l('Total').' : ', 0, 0, 'R'); $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(($priceBreakDown['totalWithoutTax']), self::$currency, true)), 0, 0, 'R'); $pdf->Ln(4); } $pdf->TaxTab($priceBreakDown); } Hook::PDFInvoice($pdf, self::$order->id); if (!$multiple) return $pdf->Output(sprintf('%06d', self::$order->id).'.pdf', $mode); } } Link to comment Share on other sites More sharing options...
haren2005 Posted February 15, 2012 Author Share Posted February 15, 2012 THX! Problem solved Link to comment Share on other sites More sharing options...
cvikenzi Posted September 17, 2015 Share Posted September 17, 2015 if you want professional tool for generating delivery slips numbers you can use "Custom number-orders,invoices,delivery and credit slips" module from prestashop addons market work from 1.5.1 version till newest version. Link to comment Share on other sites More sharing options...
Recommended Posts