Jump to content

Add a donate option to the cart


Recommended Posts

Hi,

my boss asked for a tick box added to the shopping cart so people can tick it and an extra euro will be taken from their payment which we will then donate to a local charity.....  Im not really sure where to start, or even if theres a premade option available...

 

any thoughts appreciated

 

Steven

Link to comment
Share on other sites

You my friend are a true genius......

 

just wondering though if I want to change the word WRAPPING in the cart to DONATION how can I do this? what file should I edit?

 

I cannot edit the file through translations as it is too big and will not load and my ISP will not assist in this matter,

 

here is the prestashop error, and what the isp said...

 

Total expressions : 3982. Click the fieldset title to expand or close the fieldset..

Warning, your hosting provider limits the maximum number of fields to post in a form:
1000 for max_input_vars
Please ask your hosting provider to increase the suhosin post and request limit to 4082 at least. or edit the translation file manually.

 

Hi Steven,

Unfortunately, it would not be possible to raise that on shared hosting with your configuration. To do that with ourselves you'd need at least a Cloud server:

http://www.blacknight.com/cloud-hosting.html

Regards,

Liam.

Edited by B@ndit (see edit history)
Link to comment
Share on other sites

Before taking your hosting provider at their word, you should check yourself to see if you can edit PHP settings for your website.

 

You probably have been given access to a hosting panel like CPanel, Plesk or somesuch to make changes to your configuration. Enter this panel and search for a menu option/item that allows you to edit your own custom php.ini file and add something like the following:

 

 

max_input_vars = 10000;
suhosin.get.max_vars = 10000;
suhosin.post.max_vars = 10000;

[source: http://www.prestashop.com/blog/en/utilize-the-php-ini-file-to-optimize-your-ecommerce-store/]

 

 

If there is no option for custom php.ini, only then you should resort to manual editing of translation files.

Link to comment
Share on other sites

Thank you both for the valuable information.  I will check out the PHP later today, I did however try to find and edit the translation file by logging into the site via filezilla but could not find the translation file.... is it called something weird or just translation? I did find a folder called Translations and viewed all files in that but the word wrapping appears nowhere.....  any ideas as to where this mysterious file is hiding?

 

regards

 

Steven

Link to comment
Share on other sites

Hello Steven.

 

If you can't find an option for custom php.ini, there is one workaround with .htaccess file that you could try: http://mypresta.eu/en/art/know-how/max-input-wars-in-prestashop-translations-feature.html

 

If that fails also, we go back to the manual editing method. And unfortunately, manual editing of translations is not a trivial process!

 

 

Problem 1: There is not a uniform location for the translation files: some are located inside the modules subfolders, some in your theme's subfolders etc etc.

 

In your case, you want to translate the string with canonical name "Wrapping" that appears in your Front Office inside the blockcart module's position. The file which holds the English translations for this module should be this: modules\blockcart\translations\en.php. Make a backup copy of this file and then open it for editing. And now we come to...

 

Problem 2: This file is (or should be) more or less, empty:

<?php

global $_MODULE;
$_MODULE = array();

?>

Now what? What should you add here to change the translation of "Wrapping"?

 

Well, it would be something like the following:

<?php

global $_MODULE;
$_MODULE = array();
$_MODULE['<{blockcart}prestashop>blockcart_ba794350deb07c0c96fe73bd12239059'] = 'Donation';

?>

Crazy, right? Especially the indecipherable part after the underscore character. This is the MD5 hash for the canonical value ("Gift") of this string. You can get this hash value by going to an online MD5 encrypter (example) and entering the string you want.

 

Please, make backup copies before following the above process. It should work, but I have not tested it.

Edited by parsifal (see edit history)
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...