Jump to content

<SOLVED>Question about init.php ps 1.2.4 and init.php ps 1.3.1


Recommended Posts

Hello All.

I had all my PS versions working fine with SSL before version 1.3.1 by editing some lines in init.php from PS 1.2.4.
I had to cause i was always getting the HTTP:// request XML error bla bla.
But now with 1.3.1 i see allot off changes in the init.php compared with 1.2.4 and is not working correct for me anymore.
I did the same change in the new file as i did with the old file but still not working 100%, in IE i can not add to cart a product from featured home module, first i must click in view and if i try it again then it works.
I have played many day but i give up, so i replaced the init.php from 1.3.1 with the one from 1.2.4 and all is working again without a problem.

So my question is can it give any problems when i replaced this regarding the working off the whole shop ?
Or is the code from 1.3.1 only optimized for better performance and will the init.php from 1.2.4 will give no further problems.

Hope someone can answer my question so that i can stick with init.php from PS 1.2.4 in PS 1.3.1.

Thanks.

ysco..

Link to comment
Share on other sites

It is a bad idea to replace the init.php file in PrestaShop v1.3.1 with the one in PrestaShop v1.2.4. The new init.php adds a few variables like roundMode and use_taxes which will not be available if you replace the file. This would mess up a PrestaShop v1.3 theme, but if you are using a PrestaShop v1.2.4 theme, I suppose that doesn't matter. The file also includes a few bug fixes. It seems the SSL code has been moved into its own function Tools::getHttpHost, so it looks like they tried to fix SSL issues. A few lines have been rearranged and it looks like the customer address is now being put into the cart. A bug in the maintenance page has been fixed too in that file.

Link to comment
Share on other sites

Hello Rocky ;)

Thanks for your reply buddy.
The problem is that when i use the init.php from 1.3.1 then i get again the ssl problems that i had before.
In init.php 1.2.4 i changed this,

$protocol = 'https://'; <---- so the whole site was ssl but did solve some problems.
$protocol_ssl = 'https://';

And this line 'content_dir' => $protocol_content.$server_host.__PS_BASE_URI__, i deleted this part  $protocol_content.$server_host.



When changed this all my problems where solved from 1.2.xx to the last version i used 1.2.4 and did not get any errors.

But when i change the same in the new PS 1.3.1 like described above then i still have strange things and thats because they probably changed
some lines and you also mentioned Tools::getHttpHost so maybe it has something to do with it.

Do you know a solution buddy ? i want off course init.php from 1.3.1 working but i m a bit lost.
Can you have a look at those two files to see the difference ?

Hoping you can help me out with this one.

Best regards,

ysco..

Link to comment
Share on other sites

I suggest that you change line 76 of classes/Tools.php from:

$host = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$host;



to:

$host = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'https://').$host;



as well as changing line 116 of init.php from:

$protocol = 'http://';



to:

$protocol = 'https://';

Link to comment
Share on other sites

Hello rocky ;)

I will try and see if that helps.
Will let you know the results,
Thanks.

Edit:
Did not helped buddy, i will get the message in firefox when i click on FO add to cart.


TECHNICAL ERROR: unable to add the product.

Details:
Error thrown: [object XMLHttpRequest]
Text status: error


When add to cart in IE the tab freezes and nothing will be added to cart.

ysco..
Link to comment
Share on other sites

Well i have added this line into ajax-cart.js on line 156 thanks to german forum.

url: baseDir .replace(/https/g, "http") +  'cart.php',



Now it works in IE correct and no errors in there but firefox give the XMLHttpRequest error and
now i can`t delete items from cart and i get this message (ERROR: unable to delete the product) in IE and maxthon it works all fine.
Any idea ?


ysco..

Link to comment
Share on other sites

I can't see anything else that needs to be changed. With my search, I could found the following definition in the default PrestaShop theme:

var baseDir = '{$base_dir_ssl}';



I think older PrestaShop themes have different definitions. Try switching to the default PrestaShop v1.3.1 theme are see whether you still get the error message.

Link to comment
Share on other sites

Hello Rocky,

Where in the default presta theme holds that code you mentioned so that i can compare with the theme that i have.
The theme that i bought 2 months ago is a 1.2.5 theme so maybe there could be the problem then ?
Will try tonight ( cause it is a live site ) what you said and try the default prestashop template and see if that one gives any errors, if it gives not a error while not changing something in the init.php file then the problem could be the template i use and maybe needs to be modified.
For now the live site runs without a problem on 1.2.4 init.php but like i said a working 1.3.1 init.php would be better.


Thanks so far rocky ;)

Best regards,

ysco..

Link to comment
Share on other sites

Well I have now in new init.php from PS 1.3.1 replaced a few new lines ( Most SSL )with the old code from PS init.php 1.2.4 but has left the new things in it like tax stuff and so on.
So i replaced some SSL lines and all seems to work now even Tax works so i hope that i don`t get any strange things anymore.

ysco..

Link to comment
Share on other sites

Hello rocky,

Thanks for letting me know, i also have dreamweaver but never used the global search part.
Will play with to see how it works, for now the site runs without a problem after changing the ini.php.

Thanks.

ysco..

Link to comment
Share on other sites

×
×
  • Create New...