user shipment address fields

0
Hi Germinal,
I have a new question for you!
As far as I understand, only user billing data are available as tokens that I can add in my invoice template. Since the user can add/select a different shipment address during the order process, and considering that it can be retrieved in Virtuemart, I was wondering about adding this in the template.
Adding the proper fields in the template is not a problem: I should be able to do this. Real trouble is having shipment data fields as tokens! Is there any way to achieve this?

Regards!
Vittorio

Accepted Answer

Wednesday, December 16 2015, 06:33 PM - #Permalink
0
Hello,
finally I solved the problem thanks to Germinal! Notes variable is filtered to allow HTML code in it, so the content I wanted to pass to it was filtered (ignored).
By commenting a particular row in the invoice model php file, notes token now works the way I want, "importing" the info I need.

Thanks!
The reply is currently minimized Show
Responses (11)
  • Accepted Answer

    Tuesday, December 15 2015, 05:41 PM - #Permalink
    0
    Yes, for sure. I do not want you to solve my issue writing the code; I just want you to help me in understanding if I am missing something.. that is what you said.
    I am sending you the file via email.

    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, December 15 2015, 12:24 PM - #Permalink
    0
    Can I share php file with you, attaching it here? Do you need other files, eventually?
    Please let me know.
    • Germinal Camps
      more than a month ago
      if you want to send me a file at support@ joomlathat.com I'll be glad to take a look.. but again, I cannot "do development" on this unless is through our Custom Coding Service.. all I will be able to tell you is what I told you here, that is, if the code looks good from my point of view or you're missing something...
    • vittoriobruno
      more than a month ago
      Yes, for sure. I do not want you to solve my issue writing the code; I just want you to help me in understanding if I am missing something.. that is what you said.
      I am sending you the file via email.

      Thanks

      PS. Sorry, but I first answered to you with another reply :(
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, December 15 2015, 11:07 AM - #Permalink
    0
    what you're describing seems right. the order on the array does not matter. if the data is correctly taken, it should be correctly populated.
    I'm sure we're missing something but I can't say really what it is unless I see it myself...
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, December 13 2015, 11:38 AM - #Permalink
    0
    Hi Germinal,
    it seems I have some trouble here... I cannot understand what is wrong.
    I worked on the file you told me, creating query for the addition of the information about shipping address.
    Now, if I insert these data into "to_address" token, just substituting for example the billing infos, it works. If I use {to_zip}, {to_city}, {to_state}, {to_country} as shipment address tokens, it works too. So query should be ok.
    It does not work if I assign the infos to {notes} token. First of all, it seems it does not exist in the original invoice_data array, so I manually added it: I tried both to put it in the end of the invoice_data array and between "invoice_date" and "template_id" fields, trying to respect the SQL table columns order... simply, there's no info when I create pdf invoice. Neither there is if I open MYSQL #__invoices_invoices table: "notes" field is always empty.
    Am I missing something?

    Regards
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, December 12 2015, 11:55 AM - #Permalink
    0
    Hello Vittorio,

    I asumed you knew a bit of PHP and MySQL programming... otherwise it can be difficult to implement this. I was trying to "guide" you asuming you would have the skills.. in any case please remember we have a Custom Coding Service which you can hire to develop any custom coding that you may need (like this one or others).

    What i meant is that in that file, all the info for the invoice is populated, in an array. in that case you would need to populate the "notes" field with the info from the Shipping address taken from the VM order...
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, December 12 2015, 11:51 AM - #Permalink
    0
    Hi Germinal,
    maybe it's too complicated for me. I saw the file you mentioned and tried to work on it. Adding a new sql query in order to get shipping information shall not be so hard...but then, I have no idea about saying "put this information into {notes} token"... could you give me any hint?

    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 11 2015, 10:03 AM - #Permalink
    0
    you don't need to modify anything there because the {notes} token is already created for you

    all you need to do is make sure that in the virtuemart plugin.

    but.. SORRY, I made a mistake in my previous post. the file is NOT \plugins\invoicessearch\virtuemart\virtuemart.php

    the file you're looking for is: \plugins\system\invoicemanager_virtuemart\invoicemanager_virtuemart.php
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 11 2015, 09:25 AM - #Permalink
    0
    Hi Germinal,
    if using {notes} token is currently the easiest solution, then it's ok.
    I tried to add my personal SQL query in virtuemart.php file, creating also $item->ship_address, self-explanatory, in addition to the others already existent. Now it's not clear to me how to have this information in {notes} token, since I did not find where the other fields are "linked" to the proper token. In default.php I found the $search and $replace arrays fields, but I cannot understand how to proceed. Is really this the file I have to change for my purpose?

    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 10 2015, 05:39 PM - #Permalink
    0
    hello,

    yes, adding tokens is made in that file, and it's quite straighforward. as you say, the "hard" part is linking to the VM table.
    actually, not linking to the table, but the fact that this data NEEDS to be imported into the invoice when it is created.

    yes, the invoice is created in that file \plugins\invoicessearch\virtuemart\virtuemart.php

    the problem is that there's no place where to "store" this data in the INVOICE model.

    the easiest way that I can see around this would be to import the data (the shipping info) into an UNUSED field of the invoice... probably the NOTES field.

    then you can use the {notes} token to display the info.

    but, again, the important part here would be to tell the plugin to take the VM shipping info from the order and put it in the NOTES field for the invoice.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 10 2015, 11:48 AM - #Permalink
    0
    Hello,
    thanks for your feedback. My request comes from the fact that, invoicing to a company, it could happen that the destination of the goods (maybe a warehouse) could be different from the legal headquarters of the company itself. So I would like to take trace of both addresses even in the invoice.

    I try to understand how hard could be the addition of these fields. In \components\com_invoices\views\invoice\tmpl\default.php file there are all the available tokens. Adding the new ones should be the easy part, right? The hard part is the "link" to VM order table, isn't it? Something dealing with \plugins\invoicessearch\virtuemart\virtuemart.php file, probably. I understood it in general, but I do not know how to change/customize them for my purpose.

    If my understanding is correct, is there any way you can help me?

    Regards
    Vittorio
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 10 2015, 10:51 AM - #Permalink
    0
    Hello Vittorio,

    The thing here is that there is not "shipping address" fields in the invoice manager invoice form.. I mean, there's no "place" where this is imported. Since it's an "invoicing" system it does not have place for shippment info..

    the "difficult" part of this is not to create the tokens for the template (this is relatively easy..), the hard part is that new fields in the invoice form should need to be created to actually store this info (taken from the VM order table, of course)

    do you know what I mean?
    The reply is currently minimized Show
Your Reply