Menu Content

Podpora

> Diskusní fóra, FAQs & placená podpora
Welcome, Guest
Username Password: Remember me

Integrating Pdf Download in user frontend with VM2
(1 viewing) (1) Guest
Support forum for customers who have purchased this product. Archive only, no new post can be added.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.

TOPIC: Integrating Pdf Download in user frontend with VM2

Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30367

Hi,

I read the documentation but that only works for older versions of VM.
How can I integrate the pdf download in users fronted in VM 2?!

Regards

Fritz
The topic has been locked.

Re: Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30410

  • maju
  • OFFLINE
  • Posts: 1107
Dear Fritz,

New documentation will be prepared soon.

If you want to provide your users with possibility to download their PDF invoices from VirtueMart
frontend (VM 2.x.x), at the Order list, do the following steps:

1. Locate the file components/com_virtuemart/views/orders/tmpl/list.php
2. On start of file (right after "defined('_JEXEC') or die('Restricted access');"), add following code:

/* START: ARTIO VM INVOICE ICON INTEGRATION */
$helper =
JPATH_ADMINISTRATOR.DS.'components'.DS.'com_vminvoice'.DS.'helpers'.DS.'invoicehelper.php';
if (file_exists($helper))
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_vminvoice'.DS.'helpers'.DS.
'invoicehelper.php');
/* END: ARTIO VM INVOICE ICON INTEGRATION */

3. Line 72 (after previous step probably around 80) (VirtueMart v2.0.6), add the code. Code must be
inserted before "</tr>" tag:

<!-- START: ARTIO VM INVOICE ICON INTEGRATION -->
<td align="center">
<?php if (class_exists('invoiceHelper') &&
invoiceHelper::getInvoiceNo($row->virtuemart_order_id)){?>
<a href="index.php?option=com_vminvoice&controller=invoices&task=pdf&cid=<?php
echo $row->virtuemart_order_id
?>" target="_blank">
<img src="<?php echo JURI::root()?>media/media/images/mime-icon-16/pdf.png">
</a>
<?php } ?>
</td>
<!-- END: ARTIO VM INVOICE ICON INTEGRATION -->

Please note that the line number may differ with different version or when using other add-ons
modyfing the VirtueMart source code.
To use another than PDF icon, modify the image path at the added line 4.

4. You may also want to add table header around line 50 (before </thead> tag)

<!-- START: ARTIO VM INVOICE ICON INTEGRATION -->
<th>
<?php echo JText::_('COM_VIRTUEMART_INVOICE'); ?>
</th>
<!-- END: ARTIO VM INVOICE ICON INTEGRATION -->

5. To add link also for delivery note, add block of code described in step 3 again. Only difference will
be link inside <a href="...<?php
Instead
index.php?option=com_vminvoice&controller=invoices&task=pdf&cid=
wil be
index.php?option=com_vminvoice&controller=invoices&task=pdf_dn&cid=

Best Regards
ARTIO Support Team
The topic has been locked.

Re: Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30415

Hi,

thanks for that step by step guide. :-)
Because of your good explanation I am sure I did right.

But unfortunately it has no effect.
Or will it only affect new orders?

Regards

Fritz
The topic has been locked.

Re: Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30463

  • pama
  • OFFLINE
  • Posts: 489
Hello. If you followed step by step, it should work. It will display icon only if invoice is available (invoice number is created).
ARTIO Support Team
The topic has been locked.

Re: Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30542

Hi,

I did and it is not working.

This is the complete code:


<?php
/**
*
* Orderlist
* NOTE: This is a copy of the edit_orderlist template from the user-view (which in turn is a slighly
* modified copy from the backend)
*
* @package VirtueMart
* @subpackage Orders
* @author Oscar van Eijk
* @link www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license 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: list.php 5434 2012-02-14 07:59:10Z electrocity $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
/* START: ARTIO VM INVOICE ICON INTEGRATION */
$helper =
JPATH_ADMINISTRATOR.DS.'components'.DS.'com_vminvoice'.DS.'helpers'.DS.'invoicehelper.php';
if (file_exists($helper))
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_vminvoice'.DS.'helpers'.DS.
'invoicehelper.php');
/* END: ARTIO VM INVOICE ICON INTEGRATION */
?>
<h1><?php echo JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'); ?></h1>
<?php
if (count($this->orderlist) == 0) {
//echo JText::_('COM_VIRTUEMART_ACC_NO_ORDER');
echo shopFunctionsF::getLoginForm(false,true);
} else {
?>
<div id="editcell">
<table class="adminlist" width="80%">
<!-- START: ARTIO VM INVOICE ICON INTEGRATION -->
<th>
<?php echo JText::_('COM_VIRTUEMART_INVOICE'); ?>
</th>
<!-- END: ARTIO VM INVOICE ICON INTEGRATION -->
<thead>
<tr>
<th>
<?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_ORDER_NUMBER'); ?>
</th>
<th>
<?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_CDATE'); ?>
</th>
<!--th>
<?php //echo JText::_('COM_VIRTUEMART_ORDER_LIST_MDATE'); ?>
</th -->
<th>
<?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_STATUS'); ?>
</th>
<th>
<?php echo JText::_('COM_VIRTUEMART_ORDER_LIST_TOTAL'); ?>
</th>
</thead>
<?php
$k = 0;
foreach ($this->orderlist as $row) {
$editlink = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=details&order_number=' . $row->order_number);
?>
<tr class="<?php echo "row$k"; ?>">
<td align="left">
<a href="<?php echo $editlink; ?>"><?php echo $row->order_number; ?></a>
</td>
<td align="left">
<?php echo vmJsApi::date($row->created_on,'LC4',true); ?>
</td>
<!--td align="left">
<?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?>
</td -->
<td align="left">
<?php echo ShopFunctions::getOrderStatusName($row->order_status); ?>
</td>
<td align="left">
<?php echo $this->currency->priceDisplay($row->order_total); ?>
</td>
<!-- START: ARTIO VM INVOICE ICON INTEGRATION -->
<td align="center">
<?php if (class_exists('invoiceHelper') &&
invoiceHelper::getInvoiceNo($row->virtuemart_order_id)){?>
<a href="index.php?option=com_vminvoice&controller=invoices&task=pdf&cid=<?php
echo $row->virtuemart_order_id
?>" target="_blank">
<img src="<?php echo JURI::root()?>media/media/images/mime-icon-16/pdf.png">
</a>
<?php } ?>
</td>
<!-- END: ARTIO VM INVOICE ICON INTEGRATION -->
</tr>
<?php
$k = 1 - $k;
}
?>
</table>
</div>
<?php } ?>


Should be correct...
The topic has been locked.

Re: Integrating Pdf Download in user frontend with VM2 12 years, 7 months ago #30558

  • pama
  • OFFLINE
  • Posts: 489
Hello. Are you sure invoices are available? (also in backend)

Btw.
<!-- START: ARTIO VM INVOICE ICON INTEGRATION -->
<th>
<?php echo JText::_('COM_VIRTUEMART_INVOICE'); ?>
</th>
<!-- END: ARTIO VM INVOICE ICON INTEGRATION -->
should be placed before </thead> tag.
ARTIO Support Team
The topic has been locked.
Přihlášení uživatele Prázdný