duplicate prestashop customer account multiple database php / sql / symfony - php

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.

Related

Synching PHP backed Admin portal with a Mobile app

How is it possible to let the android application to know each and every change on admin portal by real time.
Our system is a school based application that works on our own tablets. In system there are Teachers, Parents, Students and a super admin. The tablet has daily attendance management, grades, exams, meetings and so many features for a school system, now the same user entities will have all the features mentioned in the Admin portal as well. lets say www.ourtabletapp.com/admin
so we have a need to synchronize every change that occurs in Admin portal to Android application in real time. (Then and there)
Currently we do have one way synchronization as in any changes to mobile app (new records, modify records and etc) eg: adding a new meeting, then updating it and so on. which is done using a REST API we have written, so mobile app will call the API each time to connect with our DB and synchronize.
Question is what are the ways we have to make it two way synchronization? (Admin portal changes should reflect the mobile application immediately.)
Update:
mobile app is located somewhere else in users mobiles. when a record is added or updated, how to send a request from Admin portal to mobile application and update the sql lite database in it?
you can use the same logic that already has been implemented to notified the admin panel when someone update through the mobile app. let's say if anyone update the any student record from the admin panel , you have to update the DB first [ that already done i think ] and than you have to make the call of REST services that send the call to mobile app with the updated data.
let me know if you need any more help on this. you can share your structure for the better answer if needed.

Change Magento Customer Account Create in data to website

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!

database synchronization issue in multiple zencart site

I have 2 zencart site running and 3rd one is about to be live. I want each user registration and coupon will be available across those 3 sites. Actually I want user registration globally so user can access any site among these 3 with same login info. And update specific coupon info of any user if any changes has been made by him. Is it possible? pls share any idea you have. Thanks
What about having 3 separate databases but share customers and coupons tables
I've done something similar

Can I have a user database synced with SugarCRM and use it mostly for emailing?

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.

issuing login information upon receipt of purchase

I am selling stuff from here:
http://foundationletters.com/buy-master-mind-products/
One of the things on sale is a subscription to a specific website.
As you can see, I have connected e-junkie to my authorize.net account.
Let's say that I already have pre-generated accounts. In other words, I have logins and passwords that I am selling. I need to be able to convey them one at a time to every person that buys the product.
How do I do this?
I am sorry for such an open ended question. I prefer to not do much PHP / MySQL programming. Perhaps I can just have the person download a program that will automatically connect to a remote txt file from which it will grab an account?
But still i would need a placeholder, I would need to know which accounts are taken and which are not?
Please help if you have e-commerce experience selling "information" rather than physical merchandise using ecommerce with authorize.net
I think if I understand your question correctly, you want to be able to give people access to information/data (in this case, login credentials) upon completion of a transfer of funds (a sale), correct?
This is similar to a software license activation model wherein software vendor sells a license to use their software, the purchaser is given access to use the software by way of an activation key, product code etc. When done via. the Web, typically the seller, upon verifying payment from the buyer, makes the information available on the resulting Web page (usually called a receipt page). This is where the seller displays the sensitive data to the buyer. Customarily, on this page the seller will include a message such as "please print for your records". Additionally, it's very useful to allow the buyer to visit the Ecommerce site again at a later point to re-access the purchased information (if by chance they lost it).
Since you are selling "accounts", what your software could do (after payment is verified):
Generate a new username/password combination and store the credentials in whatever system depends on them to authenticate the customer later.
Display the credentials on the resulting Web page for the customer.
(optionally) Create an association in your database between the new "credentials" record and the new "order" record (not sure of your db schema, but using these names in place of actual entity names).
Hope this helps!
-aj

Categories