Jump to content

[Free Module] Cash on Delivery with fee PLUS PS 1.6-1.7


Recommended Posts

  • Replies 530
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I needed a COD with fee module and since I couldn't find what I was looking for (for free), I decided to make one myself. Some features: Compatible with multiple currencies and multiple sho

New version finally uploaded (see original post) fixing (hopefully) all the problems reported to me. A note about compatibility. There are a lot of versions of Prestashop out there with a lot of

@KulMaster, @yama I updated the module, adding the feature you requested, doing my best to use original theme tpls to display the cart summary (and the cart review just above the pay button, if e

Posted Images

I'm sorry but I don't know how this auction module works. In order to have a cod fee with my module, you have to select the COD payment method and confirm the order. If any other payment method is selected by the customer, my module won't be activated.

So, if someone wins the auction, does he have to buy the product as he would in a regular shop, adding the personal info, address etc, selecting the shipping method and finally the payment method? If yes, then he must select the COD payment method and the module should match the condition and apply the cod fee (or at least log the purchase and let you know why the condition was not validated).

Share this post


Link to post
Share on other sites

Hello everybody and thanks to Sakgiok for great module. I have just a little issue about the module:
in BO i have set conditions to apply COD only if customer choose a specific shipment method (express courier)... in next step COD appear with other payment methods, but if custome choose other shipment methods, in next step COD is shown the same (but in this case without fee).
Is it possible to hide COD if shipment method is different that ones set in BO module's configuration? thanks a lot in advance.

COD.JPG

COD2.JPG

COD3.JPG

Edited by maxi1973
Image added (see edit history)

Share this post


Link to post
Share on other sites
2 minutes ago, sakgiok said:

Hi @maxi1973,

Just add a second condition, set it's type to Module Deactivation and select all the courtiers that you don't want the module to be visible.

Perfect, thanks a lot for precious help, works perfect!

  • Thanks 1

Share this post


Link to post
Share on other sites
  • 3 weeks later...
On 10/21/2018 at 9:29 PM, sakgiok said:

I needed a COD with fee module and since I couldn't find what I was looking for (for free), I decided to make one myself.

Some features:

  • Compatible with multiple currencies and multiple shops
  • Ability to either integrate the COD fee with the Carrier's fee, or add a dummy product in the order to reflect the fee, with configurable tax.
  • Many parameters to check for in order to apply the fee (cart total, delivery country, delivery zone, carrier, customer group, product categories, manufacturers, suppliers).
  • Many ways to calculate the fee (fixed value, percentage of the cart value or a combination of the two).
  • All parameters are defined in conditions, which each calculates a fee if is validated. You can choose to use the first one that was validated, or add all of the successful ones to define the fee.
  • Ability to test a scenario to see if your condition will produce the desirable fee.
  • Ability to store all the purchases done with this module, with a complete log of how the fee was calculated.
  • Ability to check (or autocheck if configured) for an update.

I intend to keep updating it, so please let me know if you have any problems or suggestions.

You can find it in github as well if you want to contribute (sakgiok/codwfeeplus).

Edit: v1.0.9 added real time cart summary update during checkout for Prestashop v1.7

Edit: v1.0.10 fixed a bug with carriers not listed when they were added by a module.

Edit: v1.1.0 added a condition type field to be able to disable module when these conditions are met, plus a bug fix and some color redesign (Control+F5 to reload the page to see the new css).

Edit: v1.1.1 Taxes are now displaying correctly in PS1.7 cart summary and in PS 1.6-1.7 invoice and added some helpful buttons in condition parameter editing.

Edit: v1.1.2 Order State is available to be configured plus some bug fixing and visual fixes. Some sanity checks added to make sure all condition values are present in Prestashop.

Edit v1.1.3 Fixed a serious bug in payment validation.

Edit v1.1.4 Fixed some bugs reported here (cart summary in PS1.7, tax displaying, reordering with COD Product etc).

Edit v1.1.5 Added compatibility for PS versions 1.6.0.6 and 1.6.1.24.

Edit v1.1.6 Fixed a bug for some PS versions < 1.6.1.0 and added provision for PS version 1.7.6.0

Edit v1.1.7 Added "States" field in conditions to validate against the state of the delivery address.

Edit v1.1.8 Fixed a bug that prevented the module to work when installed fresh.

Download:

codwfeeplus_1.1.8.zip 250.39 kB · 203 downloads

GitHub Link:

https://github.com/sakgiok/codwfeeplus

Demo:

https://ps17demo.sakgiok.gr/admin107ak3oho

Username: demo@ps17demo.sakgiok.gr

Password: demodemo

Hello

 

why are the 0kr in shoppingcart?

Postförskott problem.png

Share this post


Link to post
Share on other sites

Hello
We have tested and it has not been any weirdness before they were now that the charge disappeared earlier but now it is gone they also saw an update on the module do not know if they can be it maybe we need to update

Share this post


Link to post
Share on other sites

Always a good idea to update to the latest version.

What's the Prestashop version? Did you successfully tested your conditions and you got a fee and don't see it at your cart?

Share this post


Link to post
Share on other sites

Hello

Yeah we tested everything and it worked flawlessly the fee came up but now all of a sudden it is gone we have tried in every way to get it back but they still stand 0kr. the prestashop version are 1.7.5.1

Share this post


Link to post
Share on other sites

I don't know if I can help you with this... I can give you some pointers though...

Check your condition in the module config page. Test them with the test form in the module config page. If you get a fee there and not at your cart, it could be a javascript problem or another module has changed the checkout page elements.

Make a purchase and see if the invoice has the cod fee. If not, check the transaction log (in the module's config page) to see why. If it does, probably it's the same as before (javascript problem).

 

Share this post


Link to post
Share on other sites

Hello,
Can you make an update in the module, which means that the fee is also placed on orders if you take the order manually from the customer and place it in admin. Now only the fee is charged if the customer orders himself via the website

Share this post


Link to post
Share on other sites

Well, I think it's way too complicated to mess with this... You can include the COD payment method in a new order with no problems, and for the fee it self, you can add the COD product in the cart, setting the price to whatever the fee you want...

Share this post


Link to post
Share on other sites

Hello

Thanks for the great usefull module

 

One suggestion to make it better

Is to add a method to gray out the COD option in some cases .

I mean by this  the COD option could be visible but grayed out instead of completely removing the COD the option in some cases

 

This is specialy usefull when you want to let the customer know that we have COD but its not available for your current cart

Example: cart more than 50$ grayout COD and write "sorry COD is only available for orders under 40$"

 

Just like Amazon does (image attached (Screenshot_20191013_201631.thumb.jpg.435ba61cc9631942c2d78ba9046accf8.jpg

  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, sakgiok said:

Здравей @jesika

Предполагам, че използвате модул за напускане? Тъй като променя идентификаторите и класовете, JavaScript на моя модул се нуждае от настройване, за да работи ...

Are the settings complicated ?

Share this post


Link to post
Share on other sites
4 hours ago, jesika said:

Are the settings complicated ?

Well, it's more about rewriting the JavaScript file for your site, if it's possible... Send me a PM with the link of your site, along with the name of your checkout module (or theme if it's included in a theme) in case I've already fixed it before.

Share this post


Link to post
Share on other sites

hello, sir

first of all thank you for this module

I have a problem

I just want use only one state "cash on delivery"  but when I setup everything in order and it still showing ,, i mean when i purchase from other state this module  still showing

how it correct?

Share this post


Link to post
Share on other sites

Hi @abdussamad,

If I understood correctly, you can just make a condition, setting the type to "Module deactivation" and select all the cases that you want the module to be inactive (all the states that the module should not be visible).

Share this post


Link to post
Share on other sites

Hi @sakgiok!

thanks for great module! We have a problem with official DHL shipping module. When we connect COD module with this shipping method the payment is not available on checkout.  The same conditions work well with other shipping methtods.

What can be the reason of this issue?

Shop parameters: Prestashop 1.6.1.24, php 7.2

 

 

Opera Zdjęcie_2019-10-21_151657_sklep.vestus.pl.png

Opera Zdjęcie_2019-10-21_151858_sklep.vestus.pl.png

Opera Zdjęcie_2019-10-21_151817_sklep.vestus.pl.png

Share this post


Link to post
Share on other sites
On 14.10.2019 г. at 16:42, sakgiok said:

Е, по-скоро става въпрос за пренаписване на JavaScript файла за вашия сайт, ако е възможно ... Изпратете ми ЛС с връзката на вашия сайт, заедно с името на вашия модул за проверка (или тема, ако е включена в тема) в случай Вече го оправих.

Will you be able to help me?

Share this post


Link to post
Share on other sites

Unfortunately, I'm not if I'm able to help you, or when. The checkout module you're using is a complicated one, so for sure it'll take me some time, which currently I don't have plenty of...

I'll let you know as soon as I have a solution.

Share this post


Link to post
Share on other sites
17 hours ago, sakgiok said:

Unfortunately, I'm not if I'm able to help you, or when. The checkout module you're using is a complicated one, so for sure it'll take me some time, which currently I don't have plenty of...

I'll let you know as soon as I have a solution.

OK. Thanks.

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hi @sakgiok,

 

Firstly, Thanks for taking time to make this module! 

I am getting an error when i install the module on Prestashop 1.6.1.0 . Any help would be great.

"Fatal error: Call to undefined function array_column() in /home/ourstore/public_html/modules/codwfeeplus/codwfeeplus.php on line 1928   "

Here's a snippet of the code at line 1928

public function checkOrderState($in_order_state)
    {
        $ret = $in_order_state;
        $lang_id = (int) Configuration::get('PS_LANG_DEFAULT');
        $os = OrderState::getOrderStates($lang_id);
        if (array_search($in_order_state, array_column($os, 'id_order_state')) === false) {
            $ret = Configuration::get('PS_OS_PREPARATION');
        }
        return $ret;
    }
 

Thanks,
 

Anand

Edited by anandbag (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hi @sakgiok,

Sorry pressed Enter before completing the message

I am getting an error when i install the module on Prestashop 1.6.1.0 . Any help would be great.

"Fatal error: Call to undefined function array_column() in /home/ourstore/public_html/modules/codwfeeplus/codwfeeplus.php on line 1928   "

Here's a snippet of the code at line 1928

public function checkOrderState($in_order_state)
    {
        $ret = $in_order_state;
        $lang_id = (int) Configuration::get('PS_LANG_DEFAULT');
        $os = OrderState::getOrderStates($lang_id);
        if (array_search($in_order_state, array_column($os, 'id_order_state')) === false) {
            $ret = Configuration::get('PS_OS_PREPARATION');
        }
        return $ret;
    }
 

Thanks,
 

Anand

Share this post


Link to post
Share on other sites

array_column needs php 5.5 at least. I'm not sure if there are more functions in the code that might require higher php versions. I created in php 5.6 and tested it in php 7.0-7.2 so 5.6 should be the minimum.

I suspect, both of the reports are correct and you're running multiple php versions at your system (via php-fpm maybe). If you are on cpanel, you might have a php selection module.

I suggest to change the php version for your shop to at least 5.6 (if your Prestashop version is ok with that).

Alternatively, you can add a function array_column that mimics the functionality of the 5.6 function. Just search google for "array_column php 5.4" for examples.

Share this post


Link to post
Share on other sites
1 minute ago, sakgiok said:

array_column needs php 5.5 at least. I'm not sure if there are more functions in the code that might require higher php versions. I created in php 5.6 and tested it in php 7.0-7.2 so 5.6 should be the minimum.

I suspect, both of the reports are correct and you're running multiple php versions at your system (via php-fpm maybe). If you are on cpanel, you might have a php selection module.

I suggest to change the php version for your shop to at least 5.6 (if your Prestashop version is ok with that).

Alternatively, you can add a function array_column that mimics the functionality of the 5.6 function. Just search google for "array_column php 5.4" for examples.

Hi,

Thank you for the quick response.  

I will check if my Prestashop version allows upgrading PHP.  In not i will try to add function array_coloumn. 

Will keep you posted on how that goes ! 

 

- Anand 

Share this post


Link to post
Share on other sites

hi @sakgiokHi @sakgiok   Adding the Function Fixed the Issue !  Thanks a lot !

18 hours ago, sakgiok said:

Alternatively, you can add a function array_column that mimics the functionality of the 5.6 function. Just search google for "array_column php 5.4" for examples.

Since i could not update my PHP version I added a function at the top of /modules/codwfeeplus/codwfeeplus.php

Below is the function that i added, if it it helpful for others using PHP older than 5.5

if (! function_exists('array_column')) {
    function array_column(array $input, $columnKey, $indexKey = null) {
        $array = array();
        foreach ($input as $value) {
            if ( !array_key_exists($columnKey, $value)) {
                trigger_error("Key \"$columnKey\" does not exist in array");
                return false;
            }
            if (is_null($indexKey)) {
                $array[] = $value[$columnKey];
            }
            else {
                if ( !array_key_exists($indexKey, $value)) {
                    trigger_error("Key \"$indexKey\" does not exist in array");
                    return false;
                }
                if ( ! is_scalar($value[$indexKey])) {
                    trigger_error("Key \"$indexKey\" does not contain scalar value");
                    return false;
                }
                $array[$value[$indexKey]] = $value[$columnKey];
            }
        }
        return $array;
    }
}

 

This module is very Helpful ! Thanks Again ! :-)

- Anand 

 

 

 

 

Quote

 

Quote

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 21/10/2018 at 9:29 PM, sakgiok dice:

I needed a COD with fee module and since I couldn't find what I was looking for (for free), I decided to make one myself.

Some features:

  • Compatible with multiple currencies and multiple shops
  • Ability to either integrate the COD fee with the Carrier's fee, or add a dummy product in the order to reflect the fee, with configurable tax.
  • Many parameters to check for in order to apply the fee (cart total, delivery country, delivery zone, carrier, customer group, product categories, manufacturers, suppliers).
  • Many ways to calculate the fee (fixed value, percentage of the cart value or a combination of the two).
  • All parameters are defined in conditions, which each calculates a fee if is validated. You can choose to use the first one that was validated, or add all of the successful ones to define the fee.
  • Ability to test a scenario to see if your condition will produce the desirable fee.
  • Ability to store all the purchases done with this module, with a complete log of how the fee was calculated.
  • Ability to check (or autocheck if configured) for an update.

I intend to keep updating it, so please let me know if you have any problems or suggestions.

You can find it in github as well if you want to contribute (sakgiok/codwfeeplus).

Edit: v1.0.9 added real time cart summary update during checkout for Prestashop v1.7

Edit: v1.0.10 fixed a bug with carriers not listed when they were added by a module.

Edit: v1.1.0 added a condition type field to be able to disable module when these conditions are met, plus a bug fix and some color redesign (Control+F5 to reload the page to see the new css).

Edit: v1.1.1 Taxes are now displaying correctly in PS1.7 cart summary and in PS 1.6-1.7 invoice and added some helpful buttons in condition parameter editing.

Edit: v1.1.2 Order State is available to be configured plus some bug fixing and visual fixes. Some sanity checks added to make sure all condition values are present in Prestashop.

Edit v1.1.3 Fixed a serious bug in payment validation.

Edit v1.1.4 Fixed some bugs reported here (cart summary in PS1.7, tax displaying, reordering with COD Product etc).

Edit v1.1.5 Added compatibility for PS versions 1.6.0.6 and 1.6.1.24.

Edit v1.1.6 Fixed a bug for some PS versions < 1.6.1.0 and added provision for PS version 1.7.6.0

Edit v1.1.7 Added "States" field in conditions to validate against the state of the delivery address.

Edit v1.1.8 Fixed a bug that prevented the module to work when installed fresh.

Download:

codwfeeplus_1.1.8.zip 250.39 kB · 303 downloads

GitHub Link:

https://github.com/sakgiok/codwfeeplus

Demo:

https://ps17demo.sakgiok.gr/admin107ak3oho

Username: demo@ps17demo.sakgiok.gr

Password: demodemo

Hello,
I installed your module and I must say that it works well and is great because it manages to make many combinations, I asked if you had in mind to modify it with the addition of commissions also on payment methods like paypal, credit card, satispy.
thank you for your time.
Greetings greetings
GV

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi @g.v,

thank you for your kind words. The short answer to your question, is unfortunately no.

The long answer is, every payment method is essentially a separate module and the thing you ask for must be an entirely different module, which I think may be a lot more complicated to have it as a module and work across the various installations and versions out there...

Share this post


Link to post
Share on other sites

Γεια σου Σάκη!

Your module is really great thank you for you contribution!

I have made the tests in the module and it shows the fee as it is supposed but in the ckeckout it shows additional fee:0.

I have read previous answers from you and also checked js conflicts but I dont have any.

Any idea what to try next? PS version 1.7.6.1

Share this post


Link to post
Share on other sites

Hi @kyripapa,

the COD fee is either added to carrier's fee or is added as a cod (fake) product in the invoice. It depends on the module's global settings and the validated condition's settings.

It shouldn't be displayed in the additional fee section.

Share this post


Link to post
Share on other sites

Thank you for your answer.

I have tried both but still the charge is 0.

I attach two files for you to see what I mean, in this case I have chosen charge as a product.

I don't mind any of the options as long as I have the charge actually :)

Kind Regards

1.PNG

2.PNG

Share this post


Link to post
Share on other sites

If you make the purchase, do you get the cod fee? It might be a javascript problem that just doesn't get the correct value of the fee.

Also, if you make the purchase, what the cod module log displays? Does it calculate the fee correctly?

Share this post


Link to post
Share on other sites

In a purchase I don't get the fee as well. In console I didn't find any js error.

I checked the error_log in cpanel (no error) and the prestashop admin logs for errors. 

The cod module log you mentioned is somewhere else that I haven't seen maybe or am unaware of?

 

Share this post


Link to post
Share on other sites

Thank you vary much for that!I do get an error there Submitted state didn't match condition's states

is it because it searches in greek characters while I have put the state in Latin? (Thessaloniki)

Share this post


Link to post
Share on other sites

The state provided with the order is State: No state defined in cart

However I have put the state in the address section in front office

In the condition I have checked all the states (attached file)

3.PNG

4.PNG

Share this post


Link to post
Share on other sites

It seems the state is not part of the address. Since you accept all the states anyway in the condition, just leave it blank. It has the same effect, but it doesn't look for a state for validation.

  • Like 1

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Hi Sakgiok, I really wanna thank you for what you have created!!:), it make my working much easier, and it is a very great module. but I have one request can you please please add a functionality of:

disable COD if user is not of particular state(since it is working for countries, I also want to have restriction for states as well)

 

Can this be done??

Thanks 

Jatin

Share this post


Link to post
Share on other sites

Hi @Jatin Siyal, thanks for your kind words...

I think you can already disable the module based on a state... Just create a "module deactivation" condition and select the states for which you want the module to be deactivated... Doesn't it work for some reason?

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 1 month later...

not added in the front cart

hello, looks like an excellent module,  before migrating I´m testing on a clean install on 1.7.6.2 version and everything seems fine in the back test all is validated correctly but in the front it is not being added, tried  shipping and the create as product option, in the create product it is in the front but 0 value, I´ve checked and re-checked addresses shipping every thing but no avail.

Any suggestions

Thank you

found the reason all works correct now

the "State" field was not available during registration or or "new address creation" and I was adding it later editing the address, once the field was available during registration or address creation all worked correctly

Edited by climia
resolved the issue (see edit history)

Share this post


Link to post
Share on other sites

Hi @climia,

Do you mean that the selection of the cod method is not available at all or you select it and you don't see a fee in the final invoice?

If the latter is true, try checking the log for the transaction (in the module's config page) to see exactly why the fee is not added.

Share this post


Link to post
Share on other sites

hi Sakgiok,

the "State" field was not available during registration or or "new address creation" and I was adding it later editing the address, once the field was available during registration or address creation all worked correctly

Thank you for the quick response

  • Thanks 1

Share this post


Link to post
Share on other sites
On 1/10/2019 at 7:12 PM, sakgiok said:

Hi Yama, no problem with not using this module, I hope someday it's useful to you someway :)

Regarding your question, this wasn't installed by my module, as far as I know, it's coming with the default Prestashop installation for the default cod module.

 

Hi Serrak,

I'll try to look into it and see if I can do something.

Hi Sakgiok, i have this same problem with Easycheckout modul. THX!

The transaction summary does not show the additional cost of Cash on delivery.

https://www.sunnytoo.com/product/easycheckout-one-page-checkout-module-prestashop-1-7?ewd_urp_order_id=36812#rate

Edited by Jan (see edit history)

Share this post


Link to post
Share on other sites
30 minutes ago, Jan said:

Hi Jan,

the problem is that, since this is a paid module, I don't have access to the source code to see what can be done to integrate my module.

Share this post


Link to post
Share on other sites
1 minute ago, sakgiok said:

Hi Jan,

the problem is that, since this is a paid module, I don't have access to the source code to see what can be done to integrate my module.

Hi, my page is not sufficient?

Share this post


Link to post
Share on other sites

First of all thank you for this awesome module.

I just installed it and i m having an "appearance" problem

The boxes of the other payments are all a specific size. The box of this module is full page width (see attatched image)

edit* Not only the box size but the whole formatting (colors, hover color etch) its not the same as the other modules.

Will i need to fix this by css ?

Ευχαριστώ πολύ !

Untitled.png

Edited by Orbitaga (see edit history)

Share this post


Link to post
Share on other sites

Hi @Orbitaga,

Yes you need to either modify the modules/codwfeeplus/views/css/style-front.css file or better yet, override it in your theme folder, to ensure an update won't override your changes.

To override it in your theme folder, you need to create the file themes/<Your Theme Name>/css/modules/codwfeeplus/views/css/style-front.css

If you do that, in the old css file, the cod icon has a relative path, so if you use the same css, you need to correct it in order to find the path of the image, or copy the codwfeeplus.png in the folder themes/<Your Theme Name>/css/modules/codwfeeplus/img/codwfeeplus.png

Share this post


Link to post
Share on other sites

Hello,

I think I have found a bug. If I set the conditons to fix 5EUR COD when the cart is less than 150EUR the fee on the frontend will be 0.

If I do the test on the backend then it says 5EUR will be added so the conditions should be fine.

 

Strangely if I set the condition to more than 150EUR than it's adding the 5 EUR (even if the cart value less than 150EUR)

 

Anyone has the same issue?

Share this post


Link to post
Share on other sites

Hi @Petike_baba,

I just made a test on the my demo page, setting a 5 EUR COD when cart is less or equal to 150 EUR and it worked just fine, both in the backend and the frontend.

I suggest you make a test order on your site, selecting COD payment method and then review in the log the transaction to see the fee calculation process.

Share this post


Link to post
Share on other sites
36 minutes ago, nikdek69 said:

hi, how do I change the text / description ?

thanks

 

cod.PNG

I'm guessing PS 17 so,

go to International -> Translations, select Installed modules translation, select the module from the list and the language (even English). The text you're looking for is, for the first line, in the "CODWFEEPLUS" section and for the second line, in the "PAYMENT_INFOS" section.

 

For PS 16 it's the same procedure, the only lines are in the "PAYMENT" section.

Share this post


Link to post
Share on other sites

is it possible to add COD fee to shipping in summary i mean right now there are two positions

shipping xx
cod fee xxx

i would like to show shipping only with COD fee already included

Share this post


Link to post
Share on other sites

im looking for same effect as i can get with integration type "add to carrier's fee" BUT already on last step of checkout, when i choose payment method as COD then COD fee should be added to shipping as one fee (carrier+cod) not separate rows

Share this post


Link to post
Share on other sites

I suppose if you delete the contents of the /modules/codwfeeplus/views/js/front.js (just the contents not the file), the extra COD line in the checkout should not be displayed.

Share this post


Link to post
Share on other sites

Hello, i downloaded the link of the module, am very new in this. To be honest i have no idea how to add the module or better say what file to import in the "add module". I tried to put it all but it gives me error. I just installed the 1.7.6.4 version

Share this post


Link to post
Share on other sites
  • 2 weeks later...