I'm using PrestaShop 1.5.5.0.
My website is www.allworldfurniture.com and live now. I saw that one customer has registered 3 times with same name, same age and same mail id. How is it possible ? is there any hacker trying to do so ?
Name, age and other stuff can be identical but how one mailid is registered multiple time ? any idea friends ? Shall I change something ?
This is not likely a hacker. This is probably just someone who put their information into your form and accidentally submitted it three times. They probably thought their information hadn't submitted (possibly because of a slow network) and click submit again.
You should only allow users to send form data once every minute, for example, so that that doesn't happen again.
Solution
Hello everyone
to stop multiple customer id / Guest id with same email PRESTASHOP 1.6
Go in this file \publicHTML\classes\Customer.php
remplace variable $ignore_guest true to false in function parameters like this
Lines 392-393
// public static function customerExists($email, $return_id = false, $ignore_guest = true)
public static function customerExists($email, $return_id = false, $ignore_guest = false)
Enjoy
Related
Hello to all the community,
Thank you in advance to whoever will take the time to answer me 😆!
In fact, I want to find a solution to make the minimum purchase on the checkout page ( not on the cart page ) and it depends on the address city.
I already did it in Prestashop 1.6 but now I use Prestashop 1.7.7.1 I am obliged to override the cart Presenter but I didn't rich a convenient solution.
Even I purchased a module of minimum purchase by country and modified it to be by the city but the module itself is not stable and it didn't work properly and the support of the module cannot find a solution because it requires an override of the core of Prestashop in the Symfony code and it will affect all the order tunnel which is typically impossible.
This topic will be a real challenge for developers that they don't know the impossible 😆!
Thanks in advance.
Assuming you are creating a module, in CartPresenter class you have hook overrideMinimalPurchasePrice. You can hook your module to this hook and modify the $minimalPurchase value in your module according to your logic.
You said that price depends on the address's city. Well, in your hook you can get the address, because in Prestashop front-office you always have access to cart and cart might have delivery address id:
public function hookOverrideMinimalPurchasePrice($params)
{
$cart = $this->context->cart;
$id_address = $cart->id_address_delivery;
// If customer did not enter the address yet, the address id is 0.
if($id_address != 0)
{
$address = new Address($id_address);
$city = $address->city;
if($city == 'New York')
$params['minimalPurchase'] = 100;
}
}
}
You do not have to return anything in the hook, because in CartPresenter.php the hook is called with parameter being passed by reference:
Hook::exec('overrideMinimalPurchasePrice', [
'minimalPurchase' => &$minimalPurchase,
]);
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 have a business process flow that a customer wants to use cosmetically. All the stages are only on one entity. The customer wants certain look up fields to be read-only. What I've discovered is that while I can disable fields in the active stage of the business process flow using Xrm.Page, users can access other stages and enter data however they like. I haven't been able to find a supported method of making lookup fields readonly in non-active stages. Does anyone know how to do this?
Please try put the following code in the OnLoad event of the Form:
// Get the field in BPF
var c = Xrm.Page.getControl("header_process_<your field name>");
if (c != null) {
c.setDisabled(true);
}
Hope it helps!
I've recently added Facebook authentication to my site, which results in the user automatically being directed to the Address page once they have authenticated. Those users logging in this way will not be shown the extra questions I had asked them during the normal checkout/registration process ('How did you hear about us ?', etc..).
My question is, how do I add these fields into the Address form and get them to be inserted into the ps_customer table as they would be if a user was registering using the traditional way ? I could add fields to the Address template/controller right now, but they would end up being saved in the ps_address table instead
Any help would be much appreciated,
Thanks
It is possible but will need some work around.
After you added the fields to the address form, you have to overried the Address.php class. Do it as followed.
1) In override/classes folder find the Address.php file, and also open classes/Address.php file .
2) In file classes/Address.php file, find add function which will be as below
/**
* #see ObjectModel::add()
*/
public function add($autodate = true, $null_values = false)
{
if (!parent::add($autodate, $null_values))
return false;
if (Validate::isUnsignedId($this->id_customer))
Customer::resetAddressCache($this->id_customer);
return true;
}
Copy that exact function to override/classess/Address.php file and place it in the class.
3) Just after the below code
if (!parent::add($autodate, $null_values))
return false;
Write down your code to insert the extra fields to another table. Just get the POSTed values and write you won sql query to insert it into customers table or any other tables if you need.
Thank you
I want to be able to use the AppReceiptId from the result of CurrentApp.GetAppReceiptAsync() and tie it to a username in my backend service, to verify that the user has actually purchased the app.
I know I'm supposed to use CurrentAppSimulator in place of CurrentApp, but CurrentAppSimulator.GetAppReceiptAsync() always returns a different, random value for AppReceiptId. This makes it difficult to test with my service.
Is there a way to make it always return the same value, other than just using a hardcoded one? I'm worried that when I replace CurrentAppSimulator with CurrentApp and submit it to the store, it won't behave the way I expect it to. In the real world, the AppReceiptId won't ever change, right?
The Code I use to get AppReceiptId:
var receiptString = await CurrentAppSimulator.GetAppReceiptAsync();
XmlDocument doc = new XmlDocument();
doc.LoadXml(receiptString);
var ReceiptNode = (from s in doc.ChildNodes
where s.NodeName == "Receipt"
select s).Single();
var AppReceiptNode = (from s in ReceiptNode.ChildNodes
where s.NodeName == "AppReceipt"
select s).Single();
var idNode = (from s in AppReceiptNode.Attributes
where s.NodeName == "Id"
select s).Single();
string id = idNode.NodeValue.ToString();
id will always be some random Guid.
CurrentApp.GetAppReceiptAsync().Id is a unique ID for the actual purchase. Although it does technically represent a unique purchase made by a single Windows ID, it doesn't represent the user themselves and I don't think there's any guarantee on the durability of that ID.
Would you be better suited using the Windows Live SDK to track the actual user identity across devices?
At any rate, to answer your original question, no I don't believe there's any way to make it return the same ID all the time. The only logical place for that functionality would be in the WindowsStoreProxy.xml file, and I don't see anything in the schema that would allow you to specify this information.