Jump to content

Accessing php file from modules folder error 404


Recommended Posts

Hi everybody!


I am trying to build a module that will use AJAX. I am using PS1.6

I have a php file that will return a XML with the data to be displayed on the page.

But when I put my php file somewhere in my modules folder, I get a 404 error when trying to access it. 

Just for testing I put the file on website root and it worked perfectly.


For example:

I have this file:


(It returns 404).



(It returns the XML correctly).
The files are in the server, I triple checked.
It is not a .access problem, because I temporarily deleted the .htaccess file and I still get 404 erros.
I guess this is a protection from prestashop, but I can't figure out how to do in a better way or use this way.
Does anybody have any idea for me?
Matheus (from Brazil)
Link to comment
Share on other sites

it can be a matter of permissions to file.

please make sure that your .php file has got proper permission (each hosting can use little different values of chmod)


check, for example, permissions for file index.php located in root directory of your prestashop. grant the same permissions to your .php file.

Link to comment
Share on other sites


Thanks for the answers!


The permissions are all 644.


Here is the code:

function CalcularFrete(){
	var cep = document.getElementById("cep").value;
	calculando = "<h4>Calculando.. Aguarde</h4>";
	document.getElementById("resultado_frete_span").innerHTML = calculando;
	xmlhttp.onreadystatechange=function () { //essa função será chamada quando retornar.
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {

				resposta = xmlhttp.responseText;
				parser=new DOMParser();
				tabela = "<table><tr><td>Serviço</td><td>Valor</td><td>Prazo</td></tr>";
				numero_servicos = xmlDoc.getElementsByTagName("nome").length
					preco = xmlDoc.getElementsByTagName("preco")[i].childNodes[0].nodeValue;
					if(parseFloat(preco)>0){ //se o preço for zero passa para frente
						tabela += "<tr>";
							tabela += "<td>"+xmlDoc.getElementsByTagName("nome")[i].childNodes[0].nodeValue+"</td>";
							tabela += "<td>"+preco+"</td>";
							tabela += "<td>"+xmlDoc.getElementsByTagName("prazo")[i].childNodes[0].nodeValue+"</td>";			
						tabela += "</tr>"
					tabela = "<h4>Houve um erro ao calcular o frete. Por favor confira seu CEP e tente novamente. Caso percista por favor entre em contato conosco</tr><h4>";
					tabela += "</table><h4>Atenção: Esse valor é válido apenas para esse item e deverá ser confirmado no carrinho ao finalizar a compra. Os prazos informados são apenas os dos Correios e não incluem o tempo para postagem</h4>"; //fecha a tabela
				document.getElementById("resultado_frete_span").innerHTML = tabela;

	link = "https://www.mydomain.com.br/modules/mymodule/calcularfrete.php?";
	link += "cep="+cep+"&";
	link += "peso="+document.getElementById("peso").value+"&";
	link += "vd="+document.getElementById("vd").value+"&"; //montamos o link
	link += "quantidade="+document.getElementById("quantidade").value; //montamos o link
	xmlhttp.open("GET",link,true); //mandamos a localização http

But I can't even access this file by browser.


Thank you!

Edited by matheusryndack (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...