How to get the quote address object when user logged in? - get

One particular user logged in to his account from frontend and add some items to the shopping cart. And then he logged out. And again when he logged in I want to get his quote address object.
How to achieve this? Is there any event which fires and I can get the quote address object?

You can use:
$quote= Mage::getSingleton('checkout/session')->getQuote();//this will try to load the quote by current logged in customer if customer previously left any
$quote->getBillingAddress();//should return billng address object, if current quote has any billling address set
$quote->getShippingAddress();//should return shipping address object, if current quote has any shipping address set
Hope this help !

Related

How to set to email from project.properties files

I need to trigger two emails for my application, one to logged-in user and one to customer-care.
For the customer care, I am setting the email id in project.properties and then hitting the event class:
deleteAccountSupportEvent.setAgentEmail(agentEmailAddress);
agentEmailAddress is picking email id from project.properties:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
I have set the email in Context class as well :
setAgentEmail(((PHDeleteAccountEmailProcessModel) processModel).getAgentEmail());
But instead of all this, mail is getting triggered to logged-in user.
Please help.
You can keep it simple as follows:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
setAgentEmail(agentEmailAddress);
As far as I know context is used for mail body dynamic content. There might be logic where to email addresses are added.

addressused on email "from" attribute

I'm using a pre-operation plugin on create of email to change the entity reference on the email's "from" attribute.
This is the code I use for the setting:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["partyid"] = erQueue; //erQueue is an entityReference of a certain queue
I also want the email to be sent from the queue email adddress, and not from the original sender's address.
should I also set the "addressused attribue of the "from" activityparty, or would it happen automatically?
CRM should default the email address used to primary email address of the selected record.
I've only used addressused in the past when I wanted to use an email address other than the primary email address of the selected record.
So in your case I don't think you need to set the addressused.
Slightly old documentation but still true and relevant I believe.
activityparty.addressused Property
The property activityparty.partyid contains the ID of an account,
contact, lead or systemuser. For account, contact or lead, the
property emailaddress1 is used as the default value for the e-mail
address. If this value is blank, emailaddress2 is used, and so on. For
systemuser, the default e-mail address is internalemailaddress.
To override this default, you can specify an alternate address as the value for addressused. For example, if you set addressused to the
value "someone#example.com", that e-mail address will be used.
After I checked, the email was sent with the email address of the original system user in the "from" field. So I had to change the addressused of the activityparty in the from attribute:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["addressused"] = sQueueEmailAddress;

Changing my account to username in opencart

I have this small problem i am using open cart v 2.0.1.1 and when the user is logged in it shows my account with the drop down. I want to display the username of that particular user instead of " my account" can anyone help me with this problem?
in case of you don't know how start
(1) you will need to read this post How to become an open cart guru
(2) steps
you will need to pass the name of the customer in some variable to the template file by adding it to $data array in catalog/controller/common/header.php # class ControllerCommonHeader # function index
in the template file, change the part that checks whether the user is logged in or not, and add the passed customer name or the old header My Account depending on the branch

How to get customer billing address in blCheckoutWorkflow in broadleaf?

I would like to the get customer billing address details and would like to log them in an activity class in the blCheckoutWorkflow.
I have tried the following.
Order order=context.getOrder();
Customer c=order.getCustomer();
c.getCustomerPayments().get(0).getBillingAddress();
But here the size of the list returned by getCustomerPayments() is 0. So I am getting ArrayIndexOutOfBoundsException.
Is there a way to get the billing address that is entered by the customer in the /checkout.
Kindly, reply me.
getCustomerPayments() is designed to hold saved payment information for a particular Customer and is not really applicable to the current Order. This is used when a Customer wants to save payment information for checking out next time (the 'token' property on CustomerPaymentImpl is used to look up the PCI-sensitive data from the payment gateway).
If you are using Broadleaf 3.1.0-GA+ then you should do:
Order order = context.getOrder();
Address billingAddress = order.getOrderPayments().get(0).getBillingAddress();
If you are using Broadleaf 3.0.10-GA or below you should do:
Order order = context.getOrder();
Address billingAddress = order.getPaymentInfos().get(0).getAddress();

NameLookup does not pull Phone number

I have 2 fields that looks for username, the gets the email address and phone number from user's person document.
Creator_Email: #NameLookup([NoUpdate]; #UserName; "OfficePhoneNumber")
Creator_Ext: #NameLookup([NoUpdate]; #UserName; "OfficePhoneNumber")
The problem is there is one user reported that the extension did not pull out. It came out blank
I have checked on the person document and the phone number is there
the email address pull out correctly, but when I tested changing the first letter of first and last name to lower case (ie. Test.User#domain.com to test.user#domain.com), the field that pulls the email address still show up with Upper case.
I have tried to take the user.id and test it on a different PC and the problem persists.
Any idea why this happens? I know there are 2 address books set up in the company and that is not ideal but I have checked the 2 address books and make sure all the needed information are there.
The #NameLookup formula does a look up to a hidden view on the database, and sometimes you run into a situation where the index for that view isn't up-to-date. You can go to the database and press CTRL+SHIFT+F9 to rebuild all the views, or you can try to use the FORCEUPDATE flag in your formula.
I think you'll find that the #NameLookup call is finding people who have created entries for themselves in their personal address books. If those entries are incomplete, the lookups will fail to find the missing fields.
The #NameLookup will use the parameter...
Go to /File/Preferences/Location then is the current location find the Server Tab and check that you defined Domino Directory server (if empty user search on local)
Check also in the Mail tab, Recipient Name lookup that could "stop after first march" or exhaustively search ALL the names known on the client.
In #NameLookup you can also use [NoUpdate]:[Exhaustive]
be aware as mention before that view may be not up to date, that caching can occurs in the #NameLookup.
In place of this, I suggest to use:
#DbLookup("":"";YourServer:"names.nsf" ; "($VIMPeople)" ; #Name([ABBREVIATE] ;#UserName) ; "OfficePhoneNumber");

Resources