Jump to content

Modifying domain contact selection in standard cart


Remitur

Recommended Posts

Issue: in standard cart (but in other carts too...), when you came to the selection of registrant contact, you can choose one yet existing profile,

That's good, but to select it, the only info showed is name and surname ... that's confusing, because often happens that a customer has many contact profiles with same name and surname, and different company name...

So, it would be nice if, instead of only name + surname, would be exposed name + surname + company name...

I guess this can be done editing checkout.tpl, in these lines:

                    <p class="small text-muted">{$LANG.orderForm.domainAlternativeContact}</p>

                    <div class="row margin-bottom">
                        <div class="col-sm-6 col-sm-offset-3">
                            <select name="contact" id="inputDomainContact" class="field">
                                <option value="">{$LANG.usedefaultcontact}</option>
                                {foreach $domaincontacts as $domcontact}
                                    <option value="{$domcontact.id}"{if $contact == $domcontact.id} selected{/if}>
                                        {$domcontact.name}
                                    </option>
                                {/foreach}
                                <option value="addingnew"{if $contact == "addingnew"} selected{/if}>
                                    {$LANG.clientareanavaddcontact}...
                                </option>
                            </select>
                        </div>
                    </div>

... but I can't understand how ... 😞

 

Link to comment
Share on other sites

What a pity!!!  😞

The only way to make it little easier it's so:

                            <select name="contact" id="inputDomainContact" class="field">
                                <option value="">{$LANG.usedefaultcontact}</option>
                                {foreach $domaincontacts as $domcontact}
                                    <option value="{$domcontact.id}"{if $contact == $domcontact.id} selected{/if}>
                                        {$domcontact.id}-{$domcontact.name}
                                    </option>
                                {/foreach}
                                <option value="addingnew"{if $contact == "addingnew"} selected{/if}>
                                    {$LANG.clientareanavaddcontact}...
                                </option>
                            </select>

So contact id is near the name of the contact (and if you know the contact id, it's ok)

Not the best fix, but better than a sandwich of broken glass... 😉

 

Link to comment
Share on other sites

it's not a difficult hook to write, so with a spare 5 minutes during the tea break in the cricket... 🏏

<?php

# Cart Domain Contacts Add Company Name Hook
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function hook_cart_domaincontacts($vars) {
	
	$client = Menu::context('client');
	if ($client && $vars['templatefile'] == 'viewcart') {
		$contacts = $vars['domaincontacts'];
		foreach($contacts as $key => $domaincontact) {
			$companyname = Capsule::table('tblcontacts')->where('userid', $client->id)->where('id', $domaincontact['id'])->value('companyname');	
			if ($companyname) {
				$contacts[$key]['name'] = $domaincontact['name'].' ('.$companyname.')';
			}
		}			
		return array("domaincontacts" => $contacts);
	}
}
add_hook('ClientAreaPageCart', 1, 'hook_cart_domaincontacts');
?>

OD7RxUC.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated