VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Adwans on March 14, 2017, 15:45:32 PM

Title: a New OFFER view, in PDF, independent from invoice created, how to?[SOLVED]
Post by: Adwans on March 14, 2017, 15:45:32 PM
Hello Everyone,
I Need: an "offer" document created as PDF, but without an Invoice (before the Invoice is created, just for offering sth, without purchasing it yet).  As for now, it is impossible to have any new PDF file before the Invoice number is on.
Do I guess correctly that a new virtuemart VIEW is needed?
for instance:
components/com_virtuemart/view/offer/... ?
What do I need for this, which classes or includes - to make it working?
Will VM see my new "offer" view just as it is created?
Any ideas?
2) How to attach such a new document to email?
-- Regards


Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Studio 42 on March 14, 2017, 22:37:13 PM
Many questions and fuzzy.
You need to explain what should be the end result.
Eg. I need a link to a view that can generate a PDF to be attached to mail from my customer ?
What you need in this email and PDF :
- product : sku,desc,image ... ?
- user info, mail .... ?
- vendor info .... ?
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Adwans on March 15, 2017, 00:46:21 AM
Hello,
1. customer makes an order - with no confirmation from shop, yet. So, customer will not get invoice, but "offer" - in pdf. It is a regular order - with vendor, ordered items, addresses billto/ shipto. etc. With similar format to invoice.
2. When particular "offer" is accepted, confirmation to be done. Only now the invoice is created.
At step 1. i cannot generate any PDF file - due to fact that invoice number is not set. (step 2) - AFAIK.
So, from this point comes an idea of "forking" invoice view into separate "offer" view.
Regards

Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Studio 42 on March 15, 2017, 01:33:44 AM
I don't think it's possible, have you check for an existing solution ?
I think that step should be :
- save current cart to table(this can be a simple json or similar) if "offer" link is clicked.
- On confirm by vendor, send mail with link to use "offer" as a new cart.
- user can then process the checkout and pay.
I don't know if it's possible to modify the prices, so i don't understand why this is prefered as adding a wishlist for your customers.
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Adwans on March 16, 2017, 18:36:35 PM
Ok, I see you gave some advise here:
http://forum.virtuemart.net/index.php?topic=136794.msg478466#msg478466
and its not so easy to make new view "seen" by Virtuemart... via plugin,...MVC..
Ok, let say, I m here: (no modifications, no wishlist, only unconfirmed orders from VM)
Starting from orders - single order view - I put some new link:

Quotehttp://..../?option=com_virtuemart&view=invoice&layout=offerprice&format=html&tmpl=component&virtuemart_order_id=102&order_number=....&order_pass=...
(where layout=offerprice is a little modification of invoice layout)
I just want to make a PDF print from above view. Like this:

Quotehttp://..../?option=com_virtuemart&view=invoice&layout=offerprice&format=pdf&tmpl=component&virtuemart_order_id=102&order_number=....&order_pass=...
AND - is it impossible? Because Invoice number is not yet created? I still receive message "Invoice not created".
Can I override this somehow?
OR: print PDF somehow overwise?
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Studio 42 on March 16, 2017, 23:46:23 PM
Why not priting the cart directly using &layout=offerprice&format=pdf ?
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Adwans on March 17, 2017, 00:52:41 AM
Since Invoice is not created yet, cannot use view=invoice... otherway, without any view system throws an error...
But playing with different format=pdf combinations - i found some empty PDF-generating file:
QuoteFE/orders/tmpl/details_pdf.php
so, instead of "echo: old layout used"
I put some code and now I m playing with this new possibility.
So far so good, thank You!
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Milbo on March 18, 2017, 07:49:14 AM
This exists already and we call it delivery note. Check your order list and there you see an icon on the left side of the invoice icon. Just use language overrides and exchange "delivery note" by "offer".
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to?
Post by: Adwans on March 19, 2017, 18:24:08 PM
Great! Thank You, Milbo.
Title: Re: a New OFFER view, in PDF, independent from invoice created, how to? RESOLVED
Post by: Adwans on April 28, 2017, 16:47:22 PM
Quote from: Milbo on March 18, 2017, 07:49:14 AM
This exists already and we call it delivery note. Check your order list and there you see an icon on the left side of the invoice icon. Just use language overrides and exchange "delivery note" by "offer".
Hello, one more question is, how to change this PDF header displaying "Invoice" (in English) to another?
Where to look for the place it comes from?
I m here:
..../?option=com_virtuemart&view=orders&layout=details&format=pdf&tmpl=component&virtuemart_order_id=119&order_number=....&order_pass=...
Printscreen made from this PDF header.
Thank You in advance!
PS. One way is shop->Invoices/Emails->Appearance "Use page layout for product PDF " but i dont like this one.
EDIT:
OK, got this, it is here:
$document->setTitle(vmText::_('         '));