Describe the bug
Hello,
A few days ago I've noticed bug after modifying one of the carriers. Until then everything worked just fine. This carrier is active and is still in use. The error has shown when I've created a new carrier with COD.
I wanted to edit the name of my old carrier, but now I can't do anything.
Another strange thing is that I can't delete/edit or do anything to my active carrier (id 51). Every attempt cause error and modification is not saved. More than that, after error a new duplicate version of editing carrier is creating. I can't delete them, because of URL error.
URL error happened before. When I was creating first default carrier. To fix this I have use instructions from here:
https://github.com/PrestaShop/PrestaShop/pull/8207/commits/a9c5ce496033e830a24fecaed9a81e339fd18519
These changes are still applied to the shop.
Below in the screenshot section, I will explain each screenshot.
I'm looking for suggestion why this error has appeared. Something went wrong in the settings, how I can fix it.
You won't be able to reproduce this problem, at our dev copy of shop this problem doesn't exist.
I will be very pleased if You will suggest what I can check to fix this error, don't reply that You can't reproduce this error - because it's obvious that You won't. In the clean version of PrestaShop this error doesn't exist so You won't be able to replicate it.
To Reproduce
As I've explained before, You won't be able to reproduce it. The only way is to log in to my shop.
Screenshots
Additionnal information
PrestaShop version: 1.7.4.2
PHP version: 7.1.10
Hi @febestore,
About the strange behavior, it is added to our debug roadmap.
Your ticket is a duplicate of #9592
In fact, when I edit a carrier, it does not edit, it actually clones the carrier with updated informations. The original is not deleted in the database but does not appear in the listing.
But, in your case, all the carriers are listed in the BO after editing them.
I tried also to delete the delete tracking URL, but I don't have the same issue described by you.
I attached a video record.
https://drive.google.com/file/d/1SI5Tqgb91SlHfth8iz5lCXc2wVVDUfcm/view
Thanks to check & feedback.
PS: I tried with PS1.7.5.0 & PS1.7.4.4 => Same behavior
Hello,
I've tried to paste default tracking link. Still not working.
Look at my recording:
https://drive.google.com/file/d/1-LtK3oGEzaxPTKStvVaoN1S7QeOOAgai/view
Last carrier ID is '90'. After saving my default carrier, modifications are not applied and the carrier has been copied to ID '91'. Every change does the same. It making big mess.
Any other ideas what can I do?
@febestore, is this carrier created manually, or provided by module?
We need to retrieve the PHP error log and the debug mode report in order to find out what's wrong.
Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/
Thanks!
Was created manually. It worked for 6 months without a problem. The error appeared two days ago when I tried to change the name of the carrier. Now I can't change anything or delete this copies.
I will try to provide PHP error log
@febestore, when you try to edit the carrier, it is duplicated or just a new id is affected to this carrier?
Thanks!
Hi,
When I try to edit any of carriers this error appears, and a carrier is being duplicated.
I can't delete duplicated carriers because of URL error which I wrote about in screenshot 4.
Hello,
Can You write me a private message or email? I will send You error logs which I've found.
Hi @febestore,
This is a public space.
You can provide me logs by email.
My address mail: khouloud.[email protected]
Let's be safe!
Thanks!
Thanks!
I've send you an email ;)
@febestore, thanks!
I just received the email, I will check & feedback.
Hi @febestore,
In your log file log, you have an error [error] [client 157.55.39.41] ModSecurity: Access denied with code 403, [Rule: 'REQUEST_HEADERS:User-Agent' 'bingbot'] [msg "Spiderbot blocked"] [severity "CRITICAL"]
, you need to check this issue with your host.
Could you please try to clear cache manually by deleting all the folder into var/cache (prod & dev).
Thanks to check when you edit a carrier, the carrier is duplicated or no?
Hey,
I've written to my host about this error.
I've deleted cache folder from var. Still, nothing happened.
Yes, a carrier is duplicating every time when I try to edit any of carriers.
For example - when I try to edit any of basic carrier - the error appears - and a carrier is duplicating.
Hi @febestore,
In your Project_Folder/js/admin/carrier_wizard.js file could you please try to replace this
function validateSteps(fromStep, toStep)
{
var is_ok = true;
if ((multistore_enable && fromStep == 3) || (!multistore_enable && fromStep == 2))
{
if (toStep > fromStep && !$('#is_free_on').attr('checked'))
{
is_ok = false;
$('.input_zone').each(function () {
if ($(this).prop('checked'))
is_ok = true;
});
if (!is_ok)
{
displayError([select_at_least_one_zone], fromStep);
return;
}
}
if (toStep > fromStep && !$('#is_free_on').attr('checked') && !validateRange(2))
is_ok = false;
}
$('.wizard_error').remove();
if (is_ok && isOverlapping())
is_ok = false;
if (is_ok)
{
form = $('#carrier_wizard #step-'+fromStep+' form');
$.ajax({
type:"POST",
url : validate_url,
async: false,
dataType: 'json',
data : form.serialize()+'&step_number='+fromStep+'&action=validate_step&ajax=1',
success : function(datas)
{
if (datas.has_error)
{
is_ok = false;
$('div.input-group input').focus(function () {
$(this).closest('div.input-group').removeClass('has-error');
});
displayError(datas.errors, fromStep);
resizeWizard();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
});
}
return is_ok;
}
By this
function validateSteps(fromStep, toStep)
{
var is_ok = true;
if ((multistore_enable && fromStep == 3) || (!multistore_enable && fromStep == 2))
{
if (toStep > fromStep && !$('#is_free_on').attr('checked'))
{
is_ok = false;
$('.input_zone').each(function () {
if ($(this).prop('checked'))
is_ok = true;
});
if (!is_ok)
{
displayError([select_at_least_one_zone], fromStep);
return;
}
}
if (toStep > fromStep && !$('#is_free_on').attr('checked') && !validateRange(2))
is_ok = false;
}
$('.wizard_error').remove();
if (is_ok && isOverlapping())
is_ok = false;
if (is_ok)
{
form = $('#carrier_wizard #step-'+fromStep+' form');
$.ajax({
type:"POST",
url : validate_url,
async: false,
//dataType: 'json',
data : form.serialize()+'&step_number='+fromStep+'&action=validate_step&ajax=1',
success : function(datas)
{
if (datas.has_error)
{
is_ok = false;
$('div.input-group input').focus(function () {
$(this).closest('div.input-group').removeClass('has-error');
});
displayError(datas.errors, fromStep);
resizeWizard();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown, data) {
jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
console.log(data+" "+errorThrown);
}
});
}
return is_ok;
}
Thanks to check & feedback.
Hello,
I've done what You suggested. Again nothing ;/. Error still exist. In attachment, I'm sending a screenshot of the modified js file.
I've recorded error again: https://drive.google.com/file/d/12eXfDGyNYJkxAzMrBQ2Zme0l5MrDv3hq/view
As You can see I've edited carrier with ID 51. The error appears and the carrier was duplicated with ID 93.
As You can see I have so much duplicated carriers it's going to be a huge mess. I can't delete or even disable them...
@febestore, with this modification in this file, if you create a new carrier & you edited, it will be duplicated?
If yes, same behavior, try to delete those modifications, in the meantime, could you please check your database schema & compare it with the full schema for 1.7.4.2 here: https://github.com/PrestaShop/PrestaShop/blob/1.7.4.2/install-dev/data/db_structure.sql
Thanks!
Hello
After creating new carrier error doesn't appear.
Recording: https://drive.google.com/file/d/1jBNYAgidhSE1Hy3tkO88WwYI8EG351VS/view
It seems that old carriers are afflicted. Is there any way to fix them? And delete all of the duplicated carriers?
I need to fix my default carrier - because I have many connections with it at web service. Replacing it will cause few problems.
I am comparing the database schema. I will let You know with about the results.
@febestore, comparing the database schema will help us to find the problem.
Waiting for your feedback.
Thanks!
Hi. I've compared database schema. My file is exactly the same like default schema.
Screenshot and structure below
Hi @febestore,
Despite our several trials, we could not reproduce your issue.
The only we can reproduce is reported in this ticket: #9592.
It seems that your issue is not a PrestaShop's core bug but most likely a server configuration or customization problem.
I invite you to contact our support team: http://addons.prestashop.com/en/388-support to help you solve your issue.
Thanks!
I've found bug by myself.
It was URL problem in Carrier.php. File needed few changes
@febestore, I'm glad that you solve your issue.
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Our developers will help you get it right.
Thank you!
Hi @febestore I have the same error, could you explain what changes you exactly did?
@febestore it would be good to share your solution ...
Thanks
Hi!
The solution is very simple. You need to turn off the URL validation.
Go to /classes/Carrier.php
Find: url' => array('type' => self::TYPE_STRING, 'validate' => 'isAbsoluteUrl'),
Change to: 'url' => array('type' => self::TYPE_STRING),
Hi @febestore,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Our developers will help you get it right.
Thanks!
@khouloudbelguith
Hi, we talked before.
I had the same problem. So I did what febestore mentioned on Feb 19. The result was a 500 server error. So I changed it back to how it was and now my PS gives a white screen. I can't enter it anymore.
I desperately need somebody who can take a look and can fix this for me.
Can and will you do that?
Thanks in advance.
Hi @Arnaldo405,
This issue is currently closed, can you open a new one with more information about your configuration.
Thanks!