News:

Support the VirtueMart project and become a member

Main Menu

Email order notice without attaching pdf

Started by dontflinch, July 25, 2012, 19:49:32 PM

Previous topic - Next topic

dontflinch

I would like the order emails that go out have the whole order information that they contain but not have the pdf attached.

I've looked around and haven't found it yet.  Maybe I will find it before there is a reply here but it is worth a shot.


I have had problems with the tcpdf and had to comment out some monospace font stuff that was breaking my checkout but it makes the pdf look ugly.

The email portion is very nicely styled and it alone is sufficient imo.

How can I disable the attachment of the pdf version of the invoice to the confirmation/shipped/pending emails?

John2400

Hi , in 2.0.8 e,

have you tried this setting -

Now I'm not sure if you use paypal if it doesn't automatically trigger a pdf invoice automatically but you could let us know.

[attachment cleanup by admin]

dontflinch

Hi,

I did see that setting but did not try it because it seemed like that would send no email at all.

I want the email to go, just not the pdf attachment.

I will try it and let you know.

Thanks for replying.

dontflinch

so, ultimately I did answer my own question.

I did try what John suggested and it didn't send anything.

then when answering someone else I discovered the file I had already modified to stop the 500 errors was the same file that contained the pdf generation, which of course made sense.  :-[

so I made the file components/com_virtuemart/controllers/invoice.php look like this:

<?php
/**
 *
 * Controller for the front end Orderviews
 *
 * @package VirtueMart
 * @subpackage User
 * @author Oscar van Eijk
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: orders.php 5432 2012-02-14 02:20:35Z Milbo $
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access for invoices');

// Load the controller framework
jimport('joomla.application.component.controller');

/**
 * VirtueMart Component Controller
 *
 * @package VirtueMart
 */
class VirtueMartControllerInvoice extends JController
{

public function display() {

$format JRequest::getWord('format','html');
if ($format=='pdf') {
$viewName='Pdf';
}
else $viewName'Invoice';

$view $this->getView($viewName$format);
//  $view->headFooter = true;
$view->display();
}

function checkStoreInvoice($orderDetails 0){

JRequest::setVar('task','checkStoreInvoice');

$force true;

// @ini_set( 'max_execution_time', 5 );

$path VmConfig::get('forSale_path',0);
if($path===){
vmError('No path set to store invoices');
return false;
} else {
$path .= 'invoices'.DS;
if(!file_exists($path)){
vmError('Path wrong to store invoices, folder invoices does not exist '.$path);
return false;
} else if(!is_writable$path )){
vmError('Cannot store pdf, directory not writeable '.$path);
return false;
}
}

$orderModel VmModel::getModel('orders');
$invoiceNumberDate=array();
if (!  $orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
    return 0;
}

$invoiceNumber $invoiceNumberDate[0];

if(!$invoiceNumber or empty($invoiceNumber)){
vmError('Cant create pdf, createInvoiceNumber failed');
return 0;
}
if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) {
return 0;
}


//  $app = JFactory::getApplication('site');

//We come from the be, so we need to load the FE langauge
$jlang =JFactory::getLanguage();
$jlang->load('com_virtuemart'JPATH_SITE'en-GB'true);
$jlang->load('com_virtuemart'JPATH_SITE$jlang->getDefault(), true);
$jlang->load('com_virtuemart'JPATH_SITEnulltrue);

$this->addViewPathJPATH_VM_SITE.DS.'views' );
$format 'html';
$viewName'invoice';
$view $this->getView($viewName$format);

$view->addTemplatePathJPATH_VM_SITE.DS.'views'.DS.'invoice'.DS.'tmpl' );

$view->invoiceNumber $invoiceNumberDate[0];
$view->invoiceDate $invoiceNumberDate[1];

$view->orderDetails $orderDetails;
$view->uselayout 'invoice';

ob_start();
$view->display();
$html ob_get_contents();
ob_end_clean();


}
}




// No closing tag


and it appears to work for what I was after.

I LOVE the you guys got some kinda pdf functioning going because the product pages really need it!

but the email invoice is enough imo and pdf there is unnecessary and was causing problems anyway.

fyi, this is a core hack and won't go across update, so I often post these fixes as much for myself as anyone else.  ;)

Apewire

Just what I was looking for... Thanks dontflinch  ;D !

Too bad the PDF invoice system is broken. I would love to send PDF invoices to my costumers in the future, but the layout is all screwed up and I can't seem to fix it.

John2400

Apewire,

hi saw your note here about pdfs ? I user 2.5.6 and vm 2.0.8 e version- in this version pdfs work very well? have your updated , and or reloaded the software again on your site. I had very similar issues in the early stages of 2.0.8 but the team worked very hard on trying to fix this.

Apewire

Hi John,

I also use Joomla 2.5.6 and VM 2.0.8E. The PDF's that are generated in the backoffice work like a charm. My problem lays with the PDF's that are sent to the costumer when a product is ordered because they can't be overridden (I'm sure they can be overridden, but I cannot find where this happens). The emails that are sent to the costumers look fine and because I've still got a lot of overriding to do this fix works for me :). Maybe I'll will use the PDF's in the future when my site is online and I'm 100% sure the PDF's work!

WebStuff

This may be a dumb question, if so I apologise.
Why do we send pdf's by default? Is there some sort of legal reason for this extra overhead?
I saw on another forum that there was an option under Configuration->Checkout to turn it off but it is not on my version.

John2400

Hi ,

We actually send an invoice because of legal requirements in most if not all countries. By default because it is a standard accounting practice. However invoices also make your accountant happy. No proof of legal exchange could mean you are making false sales. Some practices have done this in the past to increase false company profits etc.  For the average "joe" yes might not seem much but later as sales increase this should be important.

Others might say it is not important but turning up to - a legal entity with a few emails of exchange is not good practice.
Now on most of the new versions you can simply turn this off or change the setting shown in the image below.

[attachment cleanup by admin]

WebStuff

#9
Thanks John2400 for the clarification.
What I'm trying to get at is that the pdf attachment is just a duplicate of the email invoice. Legally an electronic email printed off or held on disc with exactly the same transaction details as a pdf file has no more validity for government bodies or tax authorities. Either can be "tampered" with and re-edited. View the number of free pdf editing programs on the web for ready download.
I had already seen the setting you pointed out however if you have chosen an option or options then change your mind you cannot remove all of them and must leave one option active. As suggested elsewhere you can make a new order status called "NONE" and only send the pdf  for that one, i.e. not at all.

Thanks again for the clarification.

rzrz

thanks, this is helpful to me.

I have tried deleting the [confirmed] but it is reverted back and there aren't any options of [none] so I put the [cancelled] which is least likely to be triggered.