VM 2.0.12f - Joomla 2.5.7
How can i remove the vendor First and Last name from the Invoice shopper receives ? The Vendor name is our Company and is sound funny Mr. Company :)
I know all the files are in here : components/com_virtuemart/views/invoice/tmpl/
I try to look for this in to mail_html_header.php but i didn't find it
Thanks
Hello,
As you see inside the mail_html_header.php arround line 29 it's echo'ing the vendorAddress, vendorAddress has all that information you saw and is created from the public function renderVendorAddress.
So, inside the template mail_html_header.php (i assume that you will create an override for that file) we could use the function renderVendorAddress to render it again and exclude some more information, so in line 29 we have
<?php echo $this->vendorAddress; ?>
Replace with the following 2 lines:
<?php $vendorAddressnew= shopFunctions::renderVendorAddress($virtuemart_vendor_id,"<br />",array('name','username','email','agreed','first_name','last_name'));
echo $vendorAddressnew; ?>
and will work as you wish!
An other way to do this ... just saying :
Go to backend Shop->Shop-> Additional information and place one space to first name and one space to last name and press save ...
I prefer the first one, so good luck :)
Regards
I use the second method and is working great
Thank you for the support
Hello,
Great, i prefer the second one because each time you want to edit shop you have to place that spaces again :)
btw, you could use first, last name as a slogan ;)
Regards
Hi,
For those who used the second option - spaces for blank names, how did you remove the title Mr/Mrs from the line in the invoice?
Thanks
Quote from: ufo_hk on July 30, 2013, 03:11:07 AM
For those who used the second option - spaces for blank names, how did you remove the title Mr/Mrs from the line in the invoice?
Did you look into shopper field with the name "Title"?
Quote from: Maxim Pishnyak on July 30, 2013, 21:26:40 PM
Quote from: ufo_hk on July 30, 2013, 03:11:07 AM
For those who used the second option - spaces for blank names, how did you remove the title Mr/Mrs from the line in the invoice?
Did you looked into shopper field with the name "Title"?
Hi Maxim
What do you mean here? I looked in Control Panel > Shop > Shopper Information > where "Title" has 2 options, "Mr" or "Mrs", I couldn't see a way of not showing any?
Thanks
FP
Quote from: Maxim Pishnyak on July 30, 2013, 21:26:40 PM
Did you looked into shopper field with the name "Title"?
Yes - even added a blank line for an entry, tried to apply this to the "vendor" user and it did not work, because the "blank" field does not show up as an option to select, when trying to change this in either:
Vendor additional information or
via "shoppers" information.
The blank field does show in the "registration" form now but thats only good for new registrations.
Quote from: fastpat27 on August 11, 2013, 20:58:21 PM
Quote from: Maxim Pishnyak on July 30, 2013, 21:26:40 PM
Quote from: ufo_hk on July 30, 2013, 03:11:07 AM
For those who used the second option - spaces for blank names, how did you remove the title Mr/Mrs from the line in the invoice?
Did you looked into shopper field with the name "Title"?
Hi Maxim
What do you mean here? I looked in Control Panel > Shop > Shopper Information > where "Title" has 2 options, "Mr" or "Mrs", I couldn't see a way of not showing any?
Thanks
FP
You can add additional titles under "title" including a blank field - however it didn't change my vendor title even thou I tried.
Did you try Bytelord's advices (see posts above) that could be applicable to a Title field also?
Hi Maxim
I wouldn't be confident enough to hack the coding as Bytelord suggests. I could probably find the file to hack after a bit of searching but it's the array of fields (array('name','username','email','agreed','first_name','last_name') I'm not too sure about, as in where do I find them to know what to display, and is this what I need to be altering in the first place??
His second solution sounded easier but only replaces the name with a dot instead of removing it.
Thanks
FP
com_virtuemart.2.0.20b\components\com_virtuemart\views\invoice\tmpl\mail_html_header.php
<tr>
<td align="top">
<img src="<?php echo JURI::root () . $this->vendor->images[0]->file_url ?>" />
</td>
<td>
<?php echo $this->vendorAddress; ?>
</td>
</tr>
com_virtuemart.2.0.22\components\com_virtuemart\views\invoice\tmpl\mail_html_header.php
<tr>
<?php if ($this->vendor->vendor_letter_header_image>0) { ?>
<td class="vmdoc-header-image"><img src="<?php echo JURI::root () . $this->vendor->images[0]->file_url ?>" style="width: <?php echo $this->vendor->vendor_letter_header_imagesize; ?>mm;" /></td>
<td colspan=1 class="vmdoc-header-vendor">
<?php } else { // no image ?>
<td colspan=2 width="100%" class="vmdoc-header-vendor">
<?php } ?>
<div id="vmdoc-header" class="vmdoc-header" style="font-size: <?php echo $this->vendor->vendor_letter_header_font_size; ?>pt;">
<?php echo VirtuemartViewInvoice::replaceVendorFields ($this->vendor->vendor_letter_header_html, $this->vendor); ?>
</div>
</td>
</tr>
What ideas do you have, Fastpat27?
Hi Maxim
VM 2.0.22a
I replaced:
<?php if ($this->vendor->vendor_letter_header>0) { ?>
<tr>
<?php if ($this->vendor->vendor_letter_header_image>0) { ?>
<td class="vmdoc-header-image"><img src="<?php echo JURI::root () . $this->vendor->images[0]->file_url ?>" style="width: <?php echo $this->vendor->vendor_letter_header_imagesize; ?>mm;" /></td>
<td colspan=1 class="vmdoc-header-vendor">
<?php } else { // no image ?>
<td colspan=2 width="100%" class="vmdoc-header-vendor">
<?php } ?>
<div id="vmdoc-header" class="vmdoc-header" style="font-size: <?php echo $this->vendor->vendor_letter_header_font_size; ?>pt;">
<?php echo VirtuemartViewInvoice::replaceVendorFields ($this->vendor->vendor_letter_header_html, $this->vendor); ?>
</div>
with:
<?php $vendorAddressnew= shopFunctions::renderVendorAddress($virtuemart_vendor_id,"<br />",array('name','username','email','agreed','first_name','last_name'));
echo $vendorAddressnew; ?>
I now get this error on payment:
Parse error: syntax error, unexpected '}' in /home/acc***here/public_html/components/com_virtuemart/views/invoice/tmpl/mail_html_header.php on line 33
and my invoices haven't changed (attached but edited out some details)
My idea would be to have:
Logo
Company name
Address
Town
Postcode
I hope this makes sense...
Regards
FP
[attachment cleanup by admin]
Let's test with this
<?php if ($this->vendor->vendor_letter_header>0) { ?>
<tr>
<?php if ($this->vendor->vendor_letter_header_image>0) { ?>
<td class="vmdoc-header-image"><img src="<?php echo JURI::root () . $this->vendor->images[0]->file_url ?>" style="width: <?php echo $this->vendor->vendor_letter_header_imagesize; ?>mm;" /></td>
<td colspan=1 class="vmdoc-header-vendor">
<?php } else { // no image ?>
<td colspan=2 width="100%" class="vmdoc-header-vendor">
<?php } ?>
<div id="vmdoc-header" class="vmdoc-header" style="font-size: <?php echo $this->vendor->vendor_letter_header_font_size; ?>pt;">
<?php echo VirtuemartViewInvoice::replaceVendorFields ($this->vendor->vendor_letter_header_html, $this->vendor); ?>
<?php $vendorAddressnew= shopFunctions::renderVendorAddress($virtuemart_vendor_id,"<br />",array('name','username','email','agreed','first_name','last_name'));
echo $vendorAddressnew; ?>
</div>
Thanks Maxim
I have replaced the code and no errors so all is good that end. If I view a PDF though, it still hasn't changed. Do I need to change any settings inside VM?
I'll PM your a copy of the invoice.
Regards
FP
So these rows don't do anything, right?<?php $vendorAddressnew= shopFunctions::renderVendorAddress($virtuemart_vendor_id,"<br />",array('name','username','email','agreed','first_name','last_name'));
echo $vendorAddressnew; ?>
Then these command must be deleted, if they don't help.
BTW in current versions there is a command
<?php echo VirtuemartViewInvoice::replaceVendorFields ($this->vendor->vendor_letter_header_html, $this->vendor); ?>
Did you saw 'vendor_letter_header_html' in that row? Did you check file with corresponded name?
You don't have to touch the code to do this, just in case you update the script and you will have to change the code again, so it is not a good idea in this case.
This is what you do (as of V2.0.24) To make the 'Title', 'First Name' and 'Last Name' fields empty for the invoices, notify email, etc.
To remove the 'Title' entry:
In the 'Shopper Fields' under 'Configuration', select the 'title' field, add an empty value (hopefully this should work for your version). Save.
Disable 'required' in both 'first_name' and 'last_name'. Go back to the Shop's Vendor, select tab 'Shopper Information' and remove data values from the First Name & Last Name. Save
For the 'Title' field, you need to do something a little different. Go to the front end and log the vendor's name in, place an item into your cart and edit the billing address info, there it will allow you to add the empty value entry you made earlier. Save. (You can do this in various ways, for example, if you have set up a menu with the VM Account, then you can do it this way, it's up to you how you want to edit this).
Now go back to the admin page of the shop's vendor, Shopper Information and you should now see a value called 'Select Option' in the 'Title' field, do not touch this otherwise you'll lose that value. It seems to replicate an empty value. For some strange reason, you cannot see an empty 'Title' field in the front end.
Now enable 'first_name' and 'last_name' to be 'required', just as before, if you want.
Any changes you make to the shop's vendor, Shopper Information, you will have to set all of this up again.
I hope this helps.
antonitus
P.S. I have to say this way of setting up a vendor is very terrible. Why can't it be easy to do, why should we first set up a user (or Shopper in this case) to be a vendor, why can't we just set a vendor without names and title. I'm very surprised after all these years that this way of setting up a vendor is still being implemented. I hope future versions will omit this way and make it more simpler.
Thank you so much antonitus! Your method worked for me after days of trying to get the code to work.
You're welcomed WouterJ. It's nice to see it is working for you.
antonitus
Antonitus and Wouterj
Agreed no need to touch code or to use the convuluted solution proposed
In vm 2.0.24 the team integrated a simple invoice template configuration that is pretty good!!
Use the invoice layout in admin/shop - Invoice - Tab
Letter Head
Remove this:-
{vm:vendorname}
Is a lot quicker !
+ You can do what you want in the header
e.g. untick vendor image to save space in PDF's
- Remove any palceholders you dont like
-Add your own custom header information.
etc
This also applies for the Letter Foot
Thanks Hutson, I missed that one and is much easier, quicker and less tedious to achieve.
Overall, I think we shouldn't have to create a vendor as a shopper, it doesn't really make sense. I'm assuming the vendor in my case is purely the shop name and all the information about the shop. I also know that Virtuemart wanted a system to allow for various vendors, maybe this is why it is done like this, however this could be created differently and then apply the shopper to that vendor instead of the opposite way. This may need some more logic to make this work.
Yes it might be an issue if multi vendor was ever used. Not really a problem for me at this present time though.
To get rid of Title, First Name and last name from Invoice and everywhere just change in the below file and that is done.
Administrator/components/com_virtuemart/helpers/shopfunctions.php
At line 694:
replace this :
static public function renderVendorAddress ($vendorId,$lineSeparator="<br />", $skips = array('name','username','email',))
with this code:
static public function renderVendorAddress ($vendorId,$lineSeparator="<br />", $skips = array('name','username','email','title','first_name','last_name'))
and around line 712:
replace this:
if ($field['name'] != 'title' and $field['name'] != 'first_name' and $field['name'] != 'middle_name' and $field['name'] != 'zip')
with this code:
if ($field['name'] != 'zip')
I have done this and it is working fine. Please keep a backup file before doing editing.
webtoonz
This will be overwritten in every update!
I suggest we stick to using parameters available rather than hacking core code