public function __construct() { // Load the vendor, so we have the data for the header/footer... // The images are NOT loaded by default, so do it manually, just in case $vendorModel = VmModel::getModel('vendor'); $this->vendor = $vendorModel->getVendor($this->virtuemart_vendor_id); $vendorModel->addImages($this->vendor, 1); $this->vendor->vendorFields = $vendorModel->getVendorAddressFields($this->virtuemart_vendor_id); parent::__construct($this->vendor->vendor_letter_orientation, 'mm', $this->vendor->vendor_letter_format); $this->css = $this->vendor->vendor_letter_css; // set document information $this->SetCreator(vmText::_('COM_VIRTUEMART_PDF_CREATOR')); if (empty($this->vendor->images[0])) { vmError('Vendor image given path empty '); } else { if (empty($this->vendor->images[0]->file_url_folder) or empty($this->vendor->images[0]->file_name) or empty($this->vendor->images[0]->file_extension)) { vmError('Vendor image given image is not complete ' . $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); } else { if (!empty($this->vendor->images[0]->file_extension) and strtolower($this->vendor->images[0]->file_extension) == 'png') { vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif'); } else { $imagePath = str_replace('/', DS, $this->vendor->images[0]->file_url_folder . $this->vendor->images[0]->file_name . '.' . $this->vendor->images[0]->file_extension); if (!file_exists(VMPATH_ROOT . DS . $imagePath)) { vmError('Vendor image missing ' . $imagePath); } else { $this->vendorImage = $imagePath; } } } } // Generate PDF header if (!class_exists('JFile')) { require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php'; } $this->tcpdf6 = JFile::exists(VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_colors.php'); if ($this->tcpdf6) { $this->tcpdf6 = method_exists('TCPDF', 'getAllSpotColors'); } if ($this->tcpdf6) { $getAllSpotColors = TCPDF::getAllSpotColors(); $vlfooterlcolor = TCPDF_COLORS::convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color, $getAllSpotColors); } else { $vlfooterlcolor = $this->convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color); } $this->setHeaderData($this->vendor->vendor_letter_header_image ? $this->vendorImage : '', $this->vendor->vendor_letter_header_image ? $this->vendor->vendor_letter_header_imagesize : 0, '', $this->vendor->vendor_letter_header_html, array(0, 0, 0), $vlfooterlcolor); $this->vendorAddress = shopFunctionsF::renderVendorAddress($this->vendor->virtuemart_vendor_id, "<br/>"); // Trim the final <br/> from the address, which is inserted by renderVendorAddress automatically! if (substr($this->vendorAddress, -5, 5) == '<br/>') { $this->vendorAddress = substr($this->vendorAddress, 0, -5); } $vmFont = $this->vendor->vendor_letter_font; $this->SetFont($vmFont, '', $this->vendor->vendor_letter_font_size, '', 'false'); $this->setHeaderFont(array($vmFont, '', $this->vendor->vendor_letter_header_font_size)); $this->setFooterFont(array($vmFont, '', $this->vendor->vendor_letter_footer_font_size)); // Remove all vertical margins and padding from the HTML cells (default is excessive padding): $this->SetCellPadding(0); $tagvs = array('p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'div' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h1' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h2' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'h3' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)), 'table' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0))); $this->setHtmlVSpace($tagvs); // set default font subsetting mode $this->setFontSubsetting(true); // set default monospaced font // $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $this->SetMargins($this->vendor->vendor_letter_margin_left, $this->vendor->vendor_letter_margin_top, $this->vendor->vendor_letter_margin_right); $this->SetHeaderMargin($this->vendor->vendor_letter_margin_header); $this->SetFooterMargin($this->vendor->vendor_letter_margin_footer); $this->SetAutoPageBreak(TRUE, $this->vendor->vendor_letter_margin_bottom); //set image scale factor $this->setImageScale(PDF_IMAGE_SCALE_RATIO); //TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings $l = ''; $this->setLanguageArray($l); }
echo $this->vendor->vendor_store_name; if (!empty($this->vendor->images[0])) { ?> <div class="vendor-image"> <?php echo $this->vendor->images[0]->displayMediaThumb('', false); ?> </div> <?php } ?> </h1> <div class="vendor-description"> <?php echo $this->vendor->vendor_store_desc . '<br>'; echo shopFunctionsF::renderVendorAddress($this->vendor->virtuemart_vendor_id); ?> </div> <?php echo $this->vendor->vendor_legal_info; ?> <br class="clear" /> <?php echo $this->linktos; ?> <br class="clear" /> <?php
/** * @deprecated use shopFunctionsF::renderVendorAddress instead * @param $vendorId * @param string $lineSeparator * @param array $skips * @return string */ public static function renderVendorAddress($vendorId, $lineSeparator = "<br />", $skips = array('name', 'username', 'email', 'agreed')) { if (!class_exists('ShopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } return shopFunctionsF::renderVendorAddress($vendorId, $lineSeparator, $skips); }
function sendRatingEmailToVendor($data) { $vars = array(); $productModel = VmModel::getModel('product'); $product = $productModel->getProduct($data['virtuemart_product_id']); $vars['subject'] = vmText::sprintf('COM_VIRTUEMART_RATING_EMAIL_SUBJECT', $product->product_name); $vars['mailbody'] = vmText::sprintf('COM_VIRTUEMART_RATING_EMAIL_BODY', $product->product_name); $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($product->virtuemart_vendor_id); $vendorModel->addImages($vendor); $vars['vendor'] = $vendor; $vars['vendorEmail'] = $vendorModel->getVendorEmail($product->virtuemart_vendor_id); $vars['vendorAddress'] = shopFunctionsF::renderVendorAddress($product->virtuemart_vendor_id); shopFunctionsF::renderMail('productdetails', $vars['vendorEmail'], $vars, 'productdetails', TRUE); }
function renderMailLayout($doVendor, $recipient) { $this->comment = nl2br(vRequest::getString('comment')); $this->name = vRequest::getString('name'); if (VmConfig::get('order_mail_html')) { $tpl = 'mail_html'; } else { $tpl = 'mail_raw'; } $this->setLayout($tpl); // Load the product $productModel = VmModel::getModel('product'); $virtuemart_product_id = vRequest::getInt('virtuemart_product_id', 0); $this->product = $productModel->getProduct($virtuemart_product_id); $productModel->addImages($this->product); $layout = $this->getLayout(); //if($layout != 'form' and $layout != 'mail_confirmed'){ $user = JFactory::getUser(); $vars['user'] = array('name' => $user->name, 'email' => $user->email); $vars['vendorEmail'] = $user->email; $vendorModel = VmModel::getModel('vendor'); $this->vendor = $vendorModel->getVendor($this->product->virtuemart_vendor_id); $vendorModel->addImages($this->vendor); $this->vendor->vendorFields = $vendorModel->getVendorAddressFields(); $vars['vendorAddress'] = shopFunctionsF::renderVendorAddress($this->product->virtuemart_vendor_id, ' - '); $this->vendor->vendor_name = $user->name; foreach ($vars as $key => $val) { $this->{$key} = $val; } $this->subject = vmText::sprintf('COM_VIRTUEMART_RECOMMEND_PRODUCT', $this->name, $this->product->product_name); $this->isMail = true; parent::display(); }
static function replaceVendorFields($txt, $vendor) { // TODO: Implement more Placeholders (ordernr, invoicenr, etc.); // REMEMBER TO CHANGE VmVendorPDF::replace_variables IN vmpdf.php, TOO!!! // Page nrs. for mails is always "1" $txt = str_replace('{vm:pagenum}', "1", $txt); $txt = str_replace('{vm:pagecount}', "1", $txt); $txt = str_replace('{vm:vendorname}', $vendor->vendor_store_name, $txt); $imgrepl = ''; if (!empty($vendor->images)) { $img = $vendor->images[0]; $imgrepl = "<div class=\"vendor-image\">" . $img->displayIt($img->file_url, '', '', false, '', false, false) . "</div>"; } $txt = str_replace('{vm:vendorimage}', $imgrepl, $txt); $vendorAddress = shopFunctionsF::renderVendorAddress($vendor->virtuemart_vendor_id, "<br/>"); // Trim the final <br/> from the address, which is inserted by renderVendorAddress automatically! if (substr($vendorAddress, -5, 5) == '<br/>') { $vendorAddress = substr($vendorAddress, 0, -5); } $txt = str_replace('{vm:vendoraddress}', $vendorAddress, $txt); $txt = str_replace('{vm:vendorlegalinfo}', $vendor->vendor_legal_info, $txt); $txt = str_replace('{vm:vendordescription}', $vendor->vendor_store_desc, $txt); $txt = str_replace('{vm:tos}', $vendor->vendor_terms_of_service, $txt); return "{$txt}"; }