4 plugins/jshoppingproducts/generate_pdf_product/assets/pdf/generate_pdf_product.php - здесь редактируется вывод pdf файла.
<?php
/**
* @version 1.0.1 03.02.2017
* @author Maximis <maximis@list.ru>
* @package generate_pdf_product
* [member=126442]copyright[/member] Copyright (C) Maximis. All rights reserved.
* @license GNU/GPL
*/
include(JPATH_SITE."/components/com_jshopping/lib/pdf_config.php");
include(JPATH_SITE."/components/com_jshopping/lib/tcpdf/tcpdf.php");
class JproductPDF extends TCPDF{
private $params;
private $product;
private $product_images;
function __construct($params, $product, $product_images, $orientation, $unit, $format) {
parent::__construct($orientation, $unit, $format, true, 'UTF-8');
$this->jshopConfig = JSFactory::getConfig();
$this->params = $params;
$this->product = $product;
$this->product_images = $product_images;
$this->SetFont('freesans','',10);
$this->setPrintHeader(false);
$this->setPrintFooter(false);
$this->SetMargins(0,10,0);
$this->SetCreator(PDF_CREATOR);
$this->SetTitle($this->product->name);
$this->SetSubject($this->product->name);
$this->SetAutoPageBreak(true,10);
$this->SetKeywords('product, PDF, '.$this->product->name);
$this->addPage();
}
function addHeader() {
if ($this->params->get('logo')) {
$this->Image($this->params->get('logo'),15,5,30);
}
$this->Line(15,38,195,38);
$this->Ln(40);
}
function addTitle() {
$this->SetXY(15,40);
$this->SetFont('freesans','',18);
$this->SetTextColor(0,0,0);
$this->Cell(180,7,$this->product->name,0,0,'L',false);
}
function addImage() {
if (!empty($this->product_images)) {
$this->Image($this->jshopConfig->image_product_live_path.'/'.$this->product_images[0]->image_name,15,50,85);
}
}
function addExtraFields() {
$this->SetFont('freesans','', 10);
$this->SetY(50);
$this->SetX(110);
if ($this->jshopConfig->product_show_manufacturer && $this->product->manufacturer_info->name != '') {
$this->MultiCell(40,3,_JSHOP_MANUFACTURER.':',0,'L','L',false);
$this->MultiCell(42,3,$this->product->manufacturer_info->name,0,'L','R',false);
$this->Ln();
$this->SetX(110);
}
foreach($this->product->extra_field as $extra_field) {
$this->SetFont('freesans','', 10);
$this->MultiCell(40,3,$extra_field['name'].':',0,'L','L',false);
$this->MultiCell(42,3,$extra_field['value'],0,'L','R',false);
$this->Ln();
$this->SetX(110);
}
if ($this->product->_display_price) {
$this->SetFont('freesans','', 16);
$this->MultiCell(40,3,_JSHOP_PRICE.':',0,'L','L',false);
$this->SetTextColor(255,0,0);
$this->MultiCell(42,3,formatprice($this->product->getPriceCalculate()),0,'L','R',false);
$this->SetX(110);
$this->Line(15, 118, 195, 118);
}
}
function addDescription() {
$this->SetFont('freesans','', 8);
$this->SetY(225);
$this->SetX(15);
$this->SetFillColor(255,255,255);
$this->MultiCell(180,0,strip_tags($this->product->description),0,1,'L',false);
$this->Line(15, 222, 195, 222);
}
function addThumbImages() {
$x = 15;
$y = 122;
$w = 40;
$column = 4;
$interval_x = 43;
$interval_y = 33;
$show = 12;
$count = 1;
foreach($this->product_images as $k=>$image) {
if ($k == $show) {
break;
}
$this->image($this->jshopConfig->image_product_live_path.'/'.$image->image_thumb,$x,$y,$w);
if ($count == $column) {
$count = 1;
$x = $x-$interval_x*($column-1);
$y = $y+$interval_y;
}else{
$count++;
$x = $x+$interval_x;
}
}
$this->addPage();
}
function addFooter() {
$this->Line(15,283,195,283);
$this->SetXY(15,-11);
$this->SetFont('freesansb','',9);
$text_color = $this->convertColorHexToDec($this->params->get('text_color'));
$this->SetTextColor($text_color['red'],$text_color['green'],$text_color['blue']);
$this->Cell(90,0,$this->params->get('company'),0,0,'L');
$this->Cell(90,0,$this->params->get('url'),0,0,'R');
}
}
?>