In magento, when a person becomes a member, the date "created_at" is saved with the profile.
How can I retrieve this information from magento. I can get the address info etc. but can't work out how to display / get the date a user created its account.
I tried the following:
echo Mage::getResourceModel('customer/customer_collection')->addAttributeToSelect('created_at');
But doesn't work.
Thanks.
Did you try this:
$customer = Mage::getModel('customer/customer')->load(IDHERE);
//or
$customer = Mage::getModel('customer/customer')->loadByEmail('test#test.com');
echo $customer->getCreatedAtTimestamp();
where exactly are you trying to get this? from within the customers session? or are you trying to get an arbitrary customer, rather than the current customer?
Related
I'm following the external APIs documentation : https://www.odoo.com/documentation/13.0/webservices/odoo.html
to implement our companies requirements. I'm required to create a sales order and automatically create an invoice after that. The sales order part is done but I cant seem to be able to attach the Invoice to the Sales order
I've tried linking it via the 'invoice_ids' field but the documentation does not mention how to provide a many2many field in it. here is the code:
many2manyInvoice = [(4, invoice_id)]
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
#Admin user Id
uid = common.authenticate(db, username, password, {})
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
models.execute_kw(db, uid, password, 'sale.order', 'write', [[sales_order_id], {'invoice_ids':many2manyInvoice}])
The response returned is 200 , but nothing is happening on the sales order level. I think its the way that I defined the field that might be incorrect.
Can someone help with this issue ? Thanks in advance
Nothing is happening on the sales order level because you are not creating a sales record, writing to it without doing anything. Not sure if this would work in your specific case but here is what I would do.
Use the Pro-forma invoice https://www.odoo.com/documentation/user/13.0/sales/invoicing/proforma.html
Then when a sales record is created run the "Send pro-forma invoice" method using the web api. This takes care of the db linking, as it can get very complicated.
I am developing a module that get user data in a page , I wand to submit this data to prestashop database to create a new user account .
so how can I do this ?
how should I understand what data I should get from user Like email,phone number and etc . (I want to know this Shop get what data from user to sign them up).
thank you
You can use this piece of code to create a Customer.
$customer = new Customer();
$customer->firstname = 'John';
$customer->lastname = 'Doe';
$customer->email = 'johndoe#gmail.com';
$customer->passwd = md5(pSQL(_COOKIE_KEY_.'yoursecretpasswordhere'));
$customer->save();
Like Madhi said, you will get all information needed for the Customer in Customer.php
Cheers :)
All the things you need are defined in the "classes/Customer.php" file.
Each PrestShop class has one "public static $definition" and each field of the $definition that has the "'required' => true", is required
I created a customer attribute in backend magento, but I want to show this attribute to the user so that he can alter its value in the frontend. My input field is being displayed in the frontend, but the value is not there. I am not able to get this value. I found that the value that I need to display is in the apscustomer_entity_varchar table and the column is called 'value'. How can I get that value from that table? I was trying this:
$collection = Mage::getModel('eav/entity_attribute')->getCollection();
foreach ($collection as $data) {
return $data;
}
but it was not working, so I used SQL code and it worked. However I know that's not a nice way to do that in Magento. What I did was something like:
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "SELECT * FROM `apscustomer_entity_varchar ` WHERE `entity_id`='$id'";
$rows = $connection->fetchAll($sql);
How can I get the value column from my apscustomer_entity_varchar table in the magento way, using the getModel?
You need to retrieve the customer of the session and then you can get the attribute you want :
Mage::getSingleton('customer/session')->getData('attributeName');
Mage::getSingleton('customer/session')->getAttributeName(); //Magic getter
Where attributeName is the name of the attribute you want to get the value.
I found out how to do that :D
It's actually very simple. Even if this is a custom customer attribute (created in Magento admin panel), I need to get the attribute not using the 'eav/entity_attribute' model, but using the 'customer/customer' model. So I just need to do that:
$customer_data = Mage::getModel('customer/customer')->load($customer_id)->getData();
echo $customer_data['attributeThatYouWant'];
If you are not sure what is the name of your attribute you can look at Magento Admin Panel under Customer/Manage-Attributes, or you can use that after getting the model:
var_dump($customer_data);
Now you are able to get the name of all customer attributes.
I am trying to create new customer with shipping address and then want them to redirect to a page to show "Thank You" or "Error" message. I have used:
$createFields = array(
'first_name'=>$first_name,
'last_name'=>$last_name,
'email'=>$email,
'company'=>$company,
'phone'=>$phone,
'addresses'=>array(
'first_name'=>$first_name,
'last_name'=>$last_name,
'phone'=>$phone,
'street_1'=>$street_1,
'city'=>'',
'state'=>'',
'zip'=>'',
'country'=>''
)
);
$customers = Bigcommerce::createCustomer($createFields);
to create customer but it's not working at all. Once I remove 'addresses' field, new customer get created.
Can anyone help me telling how can I add address with customer? Also how can I check whether customer has been created properly or not?
It may happen customer tries to re-register himself - the system should show error "email already exists".
I am new to Bigcommerce API - any help will be appreciated.
Thanks
In the Bigcommerce class Client.php, you can find that exist a method named: createCustomerAddress. You just need to pass it the customer id and the address single array that you want to add.
An example of this could be:
$address = array(
'country'=>'United States',
'first_name'=>'First',
'last_name'=>'Last',
'street_1'=>'5543 Ave34',
'city'=>'Miami',
'state'=>'Florida',
'zip'=>'54023',
'phone'=>'783 000 0000'
);
Bigcommerce::createCustomerAddress($customer_id, $address);
I'm trying to create a cakephp website which has a notification system telling people when they log in how many new items they have.
I currently have the site logging every time a visitor logs into the site however I am unsure how I can compare date/timestamps against each other in a find.
What the find should do is return all data that has a newer timestamp when compared to the persons previous loggedIn.created
I am unsure how to code this/just trying to figure out a concept on how I can code this. any help or direction would be appreciated.
To make this simple a
user hasMany logIns
logIns belongsTo user
a user hasMany Invoices
Invoices belongTo user
user has id, name, account_id
loggedin has id, created, user_id
invoice has id, sender, receiver, created, account_id
You can use the normal comparison operators < and > with dates and datetimes.
> means "after"
< means "before"
To find invoices that have been created after a login date in a CakePHP controller, you could write for example:
$previous_login = '2012-09-20'; # obtain from somewhere
$new_invoices = $this->Invoice->find('all', array(
# "created after previous login"
'conditions' => array('created >' => $previos_login)
));