What i need is a solution to create a magento customer from an external php application (developed in the yii framework) connected directly to a magento database. The customer info will be entered using a form. The only fields from the magento customer that i am really interested in are customer email and password i.e. i want to create a customer with minimum field that only include email and password as form entry. However, i do not mind adding first name and last name to the form if they are "required" fields. I know that for Magento customer creation, webstore_id and store_id are required, but these can be hard-coded to default values thats okay.
I found code online that demonstrate how to create a customer while utilizing the Mage.php file. Some links to these tutorials include:
http://www.douglasradburn.co.uk/adding-new-customers-to-the-magento-store-programmatically/
http://inchoo.net/ecommerce/magento/programming-magento/programmaticaly-adding-new-customers-to-the-magento-store/
But in these tutorials, they have hard-coded the customer info. Like i said, my requirements include using forms on a php page from an external php application in yii framework.
Solutions will be greatly appreciated.
Create a module in your magento for retrieving the informations from your script and then implement this kind of stuff :
Create customer programmatically
Related
I've a question for my personal project. I've two websites prestashop 1.7.7.x (two databases). I'cant active multisite on this shop this functionnality is instable
I search how to duplicate customers accounts avaibles in ps_customer.
I don't want to synchronize the database. When a customer registers on site A I want to insert the customer account on SITE B and vice versa.
My first idea :
Make a php script automaticaly run with CRON TASK, this script check on db1 every account with condionnaly email and compare with db2 if not email found, I insert the data.
I've a problem with my sql query : (many many data returned,
a cause of the Cartesian product)
select db1.ps_customer.email from db1.ps_customer, db2.ps_customer where db1.ps_customer.email!=db2.ps_customer.email;
If you have any suggestions or information that could help me. Thank you very much.
Have a nice day,
The "Prestashop way" to handle this is by creating a module that you will install in both sites connected to the customer registration hook (actionCustomerAccountAdd) that "invokes" the prestashop API webservice on the other website , so when a customer succesfully register the hook is fired and customer with the same data is created on the other side.
You should start here : https://devdocs.prestashop.com/1.7/modules/
And here more details about webservice : https://devdocs.prestashop.com/1.7/webservice/
Remember that both sites must share the same cookie_key in the configuration file otherwise the hashed passwords from site A will not work on site B and vice versa.
I am using Magento and cakephp applications. I wanted to have same login for both applications.
For Example: Use Magento Login Module without any Layout inside Cakephp, access database to get details of registered users, authentication if not registered, Create account functionality.
Layout from cakephp application and functionality from Magento.
I tried integrating Magento features like login customer based on email, get login user details, Cart items, add product to magento cart, update product details etc. Posted the code which I tried in gist, But not able make entire login and payment funcionality from cakephp.
Gistlink:https://gist.github.com/kanampalli/692edcf70ca48d02a532f410ddf219be
But not able to integrate entire login functionality and Payment through magento once order placed from cakephp application. How to get session and update in both application?
You should take a look to Magento SOAP API.
I am trying to find a way to update the accounts already created in admin panel.
During the create process, the account was created mistakenly in Admin section (caused user to not login via frontend).
See Screenshot: http://puu.sh/9Rjvp/6f4fffd1c6.jpg or http://i.stack.imgur.com/0Q2vm.jpg
I am looking for a programmatic approach using which I can update the account created in value to "website" after-which the customer can be able to login to site. (this can be database direct update if its best suite)
Reason behind for looking a programmatic solution is clear for following reasons.
The number of effected accounts are about 500+
Each or many of these accounts have orders belonging to their account (therefore re-create is not a good approach).
Let me know what database values I have to change for this fix or what should I need to instruct to my custom module?
Any help is highly appreciated.
Following is customer update code snippet:
$customer = Mage::getModel('customer/customer')->load(1212);
$customer->setWebsiteId(2)
$customer->save();
The above code will update website to 2 for customer 1212.
God luck!
I work for a company that has a website with about 700,000 users, it would need a tool that would:
List all users
Email users, create templates, send a newsletter
Show products a user has purchased
If you find a user, show which emails have been sent to the user
Create automated tasks, example: send an email to every user that has a product expiring in 30 days
I'm not sure a CRM can do all theses things, I wanted to try a CRM to figure out how close can I get to having a tool that can do all this. I read that SugarCRM is pretty good, and its free so I'm going to try it out.
What I wanted to know is, using the REST or SOAP api of SugarCRM, can I synchronise all my users with the SugarCRM database ? Or for example each time a user is created on our website, insert it in the database.
And then each time we send an email with our website, use SugarCRM instead to send a mail, and store the data. So that we can view which emails have been sent to specific users.
Thank you
Yes you can do all that but it may require some customisation to suit it exactly to your needs. By 'users' I assume you are referring to Customer 'Accounts' as known on the SugarCRM?
Add custom fields to the Contacts module using Studio. The easiest and quickest way to get your data in will be directly to the database.
The standard fields in Sugar Contacts go in the contacts table. Your custom fields will have "_c" appended to their names and be created in the contacts_cstm table. The two tables are related by contacts.id = contacts_cstm.id_c, which is generally a GUID field (but can be any string value if you need it to be).
Then you need to have a process to add new users in your website into sugar. I suggest polling your user db periodically to look for new records and using the SOAP/REST API (good luck though, it's fairly horrible) to insert them into Sugar.
Other than that your use case is pretty much standard Sugar. For automated tasks which happen whenever an email is sent/received or when a new contact is created, you'll want to look at logic hooks, search for logic_hooks.php in the Sugar documentation.
I am new to sugar and need to have each Account tied to one Contact, the same way that each Lead is linked to a Contact and Account. I have already changed the metadata file to make Account:Contact a 1:1 relationship but past that I am not sure what to do. I would like to ultimately be able to view the contact name for each account when I go to view Accounts as well as be able to import Accounts from a file with a contact field.
I am using Sugar Community Edition 5.2
Instead of using the existing contacts module, a suggestion would be to add a new field (e.g. called account_contact) to the accounts module. That way it would be easy to change the account list view to include the new field, and also include it in the account search options.
I don't think I fully understand you import requirement, but it is possible to set all account fields during the import. So the newly added field is also available in the import.
If you don't want the default Sugar contacts module, you can disable this in the adminstration.
Have you looked into sub-panels at all? Your contact information is always associated with the Account in the detail view--> contacts sub-panel. You want to keep only one contact per account? Create a relate field in the studio FROM CONTACTS to accounts. A one to one account field will appear in contacts and account will have a one to one sub-panel. you can reverse this just by creating this relate field in ACCOUNTS instead. A word of advice - don't start messing with the metadata until you fully understand the relationships built into sugar.