Can anyone help. I want to add a button to the Checkout Confirmation page to generate and print the Invoice (the same as would be printed from the Admin Order Form).
Thanks.
Reason: Title adjusted
Done. XML file ready and also the additional invoice template file: order_invoice.tpl file to be uploaded in the catalog/view/theme/<your_custom_template/template/common folder. Since TPL files can't be uploaded on the forum, here's the code:Qphoria wrote:I think a better idea would be to have the normal success page show the full invoice and offer a print button. Something OpenCart has needed for a while
Code: Select all
<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $language; ?>" xml:lang="<?php echo $language; ?>">
<head>
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>" />
<link rel="stylesheet" type="text/css" href="view/theme/default/stylesheet/invoice.css" />
</head>
<body>
<?php foreach ($orders as $order) { ?>
<div style="page-break-after: always;">
<h1><?php echo $text_invoice; ?></h1>
<table class="store">
<tr>
<td><?php echo $order['store_name']; ?><br />
<?php echo $order['store_address']; ?><br />
<?php echo $text_telephone; ?> <?php echo $order['store_telephone']; ?><br />
<?php if ($order['store_fax']) { ?>
<?php echo $text_fax; ?> <?php echo $order['store_fax']; ?><br />
<?php } ?>
<?php echo $order['store_email']; ?><br />
<?php echo $order['store_url']; ?></td>
<td align="right" valign="top"><table>
<tr>
<td><b><?php echo $text_date_added; ?></b></td>
<td><?php echo $order['date_added']; ?></td>
</tr>
<?php if ($order['invoice_no']) { ?>
<tr>
<td><b><?php echo $text_invoice_no; ?></b></td>
<td><?php echo $order['invoice_no']; ?></td>
</tr>
<?php } ?>
<tr>
<td><b><?php echo $text_order_id; ?></b></td>
<td><?php echo $order['order_id']; ?></td>
</tr>
</table></td>
</tr>
</table>
<table class="address">
<tr class="heading">
<td width="50%"><b><?php echo $text_to; ?></b></td>
<td width="50%"><b><?php echo $text_ship_to; ?></b></td>
</tr>
<tr>
<td><?php echo $order['payment_address']; ?><br/>
<?php echo $order['email']; ?><br/>
<?php echo $order['telephone']; ?></td>
<td><?php echo $order['shipping_address']; ?></td>
</tr>
</table>
<table class="product">
<tr class="heading">
<td><b><?php echo $column_product; ?></b></td>
<td><b><?php echo $column_model; ?></b></td>
<td align="right"><b><?php echo $column_quantity; ?></b></td>
<td align="right"><b><?php echo $column_price; ?></b></td>
<td align="right"><b><?php echo $column_total; ?></b></td>
</tr>
<?php foreach ($order['product'] as $product) { ?>
<tr>
<td><?php echo $product['name']; ?>
<?php foreach ($product['option'] as $option) { ?>
<br />
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
<?php } ?></td>
<td><?php echo $product['model']; ?></td>
<td align="right"><?php echo $product['quantity']; ?></td>
<td align="right"><?php echo $product['price']; ?></td>
<td align="right"><?php echo $product['total']; ?></td>
</tr>
<?php } ?>
<?php foreach ($order['total'] as $total) { ?>
<tr>
<td align="right" colspan="4"><b><?php echo $total['title']; ?>:</b></td>
<td align="right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</table>
<?php if ($order['comment']) { ?>
<table class="comment">
<tr class="heading">
<td><b><?php echo $column_comment; ?></b></td>
</tr>
<tr>
<td><?php echo $order['comment']; ?></td>
</tr>
</table>
<?php } ?>
</div>
<?php } ?>
</body>
</html>
Code: Select all
/*
* jQuery Nivo Slider v2.5.2
* http://nivo.dev7studios.com
*
* Copyright 2011, Gilbert Pellegrom
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* March 2010
*/
/* The Nivo Slider styles */
.nivoSlider {
position: relative;
}
.nivoSlider img {
position:absolute;
top:0px;
left:0px;
display: none;
}
/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:6;
display:none;
}
/* The slices and boxes in the Slider */
.nivo-slice {
display:block;
position:absolute;
z-index:5;
height:100%;
}
.nivo-box {
display:block;
position:absolute;
z-index:5;
}
/* Caption styles */
.nivo-caption {
position:absolute;
left:0px;
bottom:0px;
background:#000;
color:#fff;
opacity:0.8; /* Overridden by captionOpacity setting */
width:100%;
z-index:8;
}
.nivo-caption p {
padding:5px;
margin:0;
}
.nivo-caption a {
display:inline !important;
}
.nivo-html-caption {
display:none;
}
/* Direction nav styles (e.g. Next & Prev) */
.nivo-directionNav a {
position:absolute;
top:45%;
z-index:9;
cursor:pointer;
}
.nivo-prevNav {
left:0px;
}
.nivo-nextNav {
right:0px;
}
/* Control nav styles (e.g. 1,2,3...) */
.nivo-controlNav a {
position:relative;
z-index:9;
cursor:pointer;
}
.nivo-controlNav a.active {
font-weight:bold;
}
/* slider theme */
.slideshow {
margin-bottom: 20px;
}
.slideshow a {
border: 0;
display: block;
}
.nivo-controlNav {
position: absolute;
right: 10px;
bottom: 5px;
text-align: center;
height: 22px;
z-index: 99;
}
.nivo-controlNav a {
vertical-align: top;
display: block;
width: 22px;
height: 22px;
background: url('../image/bullets.png') no-repeat;
text-indent:-9999px;
border:0;
margin-right:3px;
float:left;
}
.nivo-controlNav a.active {
background-position:0 -22px;
}
.nivo-directionNav a {
display:block;
width:30px;
height:30px;
background:url('../image/arrows.png') no-repeat;
text-indent:-9999px;
border:0;
}
a.nivo-nextNav {
background-position:-30px 0;
right:15px;
}
a.nivo-prevNav {
left:15px;
}
.nivo-caption {
text-shadow:none;
font-family: Helvetica, Arial, sans-serif;
}
.nivo-caption a {
color:#efe9d1;
text-decoration:underline;
}
Attachments
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Firstly, I changed :
Code: Select all
<search position="after" index="6"><![CDATA[}]]></search>
Code: Select all
<search position="after" offset="1"><![CDATA[$this->response->setOutput($this->render());]]></search>
Now I'm stuck on
Code: Select all
$total_data = $this->model_checkout_order->getOrderTotals($order_id[0]);
I found getOrderTotals in model/account/order
and I got somthing to work by using
Code: Select all
$this->load->model('account/order');
total_data = $this->model_account_order->getOrderTotals($order_id[0]);
BTW - thanks for all the time you put into these forums. I've noticed you're in here helping a lot. Thank-you
and changed
Code: Select all
<link rel="stylesheet" type="text/css" href="view/theme/default/stylesheet/invoice.css" />
Code: Select all
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/invoice.css" />
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
1. I copied the code and created "order_invoice.tpl" with it
2. I uploaded it to : catalog/view/theme/default/template/common folder
3. I downloaded the XML file, and uploaded it to : catalog/view/theme/default/template/common folder
4. I copied the code for the CSS and "created" catalog/view/theme/default/stylesheet/invoice.css
After doing these steps, I literally se NO difference. I'm assuming there is a step that I have to do that's not listed??
There are no such case of uploading an XML file into that folder. All XML files goes to the vqmod/xml folder as you must have VQMod installed to see the results.3. I downloaded the XML file, and uploaded it to : catalog/view/theme/default/template/common folder
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I have VQMod installed...I wondered how teh XML was going to be pulled in by simply plopping it there. I'll try to put it inside that folder tonight and will report back.
Thanks for the fast reply!
And still nothing is being displayed after order success (As far as being able to view the invoice / print button). Just normal.
I'm REALLY new at this sort of stuff so please bare with me.
Do I need to run or add anything else besides just placing the xml inside the vqmod/xml folder (and other changes I haev already done and listed above)???
I looked in the vqmod/vqcache folder, and I do see
- vq-catalog_controller_checkout_success.php
- vq-catalog_language_english_checkout_success.php
- vq-catalog_model_checkout_order.php
as well as a few other files, so it looks like it's doing something.
I just don't see anything other than the usually successful message after checkout.
I'm testing it with a fresh install (you can click through an order as I have guest enabled and COD for payment).
http://steinermilitaryscopes.com/
Another note: I installed VQMod 1.2.3 (if it matters).
Any ideas? Thanks in advance!
- Toby
"The only way to get to the top is to get off your bottom." - Fortune Cookie
if you rename the XML extension to something else and re-test this behavior from checkout, can you define from there if the JSON error keeps showing ?
AFAIK, my XML file does not make any requests to JSON.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
To be a bit more specific, I get the error on the checkout page, when I try to confirm my payment type (step 5).
- Toby
"The only way to get to the top is to get off your bottom." - Fortune Cookie
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
On my test server (which has several modifications), I enabled the COD payment option. Then, I selected an item at random and added it to my cart. After going through almost the entire checkout process, it throws the JSON error at me in a pop up box. If I go straight to "<site>/index.php?route=checkout/success", it has the "Print Invoice" button successfully displayed. However, since I don't have an order in the last 15 minutes, clicking on it just takes me to the home page.
Hope that helps clarify. Thanks for your help again, straightlight.
- Toby
"The only way to get to the top is to get off your bottom." - Fortune Cookie
So, yes, you do have contributions installed.On my test server (which has several modifications)
As for the 15 minutes idleing, it will indeed forward back to the home page and as explained on my original post regarding security issues when leaving idled orders since the success page is not under SSL by default.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
This is what my XML file already does.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/
Users browsing this forum: No registered users and 311 guests