WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: Broem on July 11, 2016, 05:51:56 PM

Title: Invoice payment option not working
Post by: Broem on July 11, 2016, 05:51:56 PM
I did install the Bakery Shop (latest version) and running WB 2.8.3. Now i'm having some issues with the Invoice Payment option. When I select this option (I also have the COD (pay by delivery) and a Mollie plugin) i get some warnings and it wont let me pay. The COD payment option is working fine, just as the Mollie payment.

When i Select the Invoice option and I would get an overview of the Customer Detailers and Item List i first get an error on the View_Summary.php file. (Below):
Warning: array_keys() expects parameter 1 to be array, string given in /home/user/public_html/modules/bakery/view_summary.php on line 65

Also i get some other errors, it can not find the DIR name for the INVOICE method (referring to bakery/payment_method//languages/EN.php) so it misses the payment name. I'm not sure what file should send this to the view_summary or where it gets it, but i think something is going wrong here.
Title: Re: Invoice payment option not working
Post by: freeSbee on July 11, 2016, 08:31:24 PM
Hi Broem

First make sure the payment method has been installed on the server. Go to the bakery/payment_methods/invoice directory and check if it contains 5 files and a language directory.

If true go to the Bakery backend  >  Payment methods. This will reload all available payment methods. Then use phpMyAdmin to check if the payment method makes part of the mod_bakery_payment_methods table. Amongst other fields the "directory" field should be "invoice", the "name" field should be "Invoice" and the "version" field should be "0.3".

Regards Christoph
Title: Re: Invoice payment option not working
Post by: Broem on July 11, 2016, 08:46:24 PM
Hi Christoph,

Thank you for the response. I did check all the things you noticed and these seem to be correct (as you said). But still i get a warning about the array that the payment method can not be found.

Thank you.
Title: Re: Invoice payment option not working
Post by: freeSbee on July 12, 2016, 11:08:39 AM
Hi Broem

Make a purchase and go to the "(2) Terms & Conditions and Payment Method" page of the Bakery checkout process. Check the HTML code of the "Charge to my Account" button. It should be something like:
Code: [Select]
<input type="submit" name="payment_method[invoice]" class="mod_bakery_bt_pay_invoice_f" value="Charge to my Account" onclick="javascript: return checkTaC()">
Please post your code if you are not sure that it is proper.

Regards Christoph
Title: Re: Invoice payment option not working
Post by: Broem on July 12, 2016, 03:37:30 PM
The code i get is the following:

Code: [Select]
<input type="submit" name="payment_method[invoice]" class="mod_bakery_bt_pay_invoice_f" value="Ik betaal na ontvangst van de factuur" onclick="javascript: return checkTaC()">
Title: Re: Invoice payment option not working
Post by: freeSbee on July 12, 2016, 04:32:24 PM
OK, the html looks fine …

Now we have to check the $_POST array. Please add some debug code to the file bakery/view_summary.php right after the comment at line 63:
Code: [Select]
// Put payment method selected by user into session var
Add this code and upload the file to the server:
Code: [Select]
echo '<pre>';
echo 'DEBUG:<br>';
print_r($_POST);
echo '</pre>';

Then again go to the Bakery checkout until you reach "(3) Summary". You should get a debug message similar to the following:
Code: [Select]
DEBUG:
Array
(
    [summary] => true
    [agree] => yes
    [cust_msg] =>
    [payment_method] => Array
        (
            [invoice] => Ik betaal na ontvangst van de factuur
        )

)
Title: Re: Invoice payment option not working
Post by: Broem on July 12, 2016, 04:42:30 PM
Output:

Code: [Select]
DEBUG:
Array
(
    [summary] => true
    [agree] => yes
    [cust_msg] =>
    [payment_method] => molliev2
    [setting_continue_url] => http://www.broodjesservicepeelenmaas.nl/pages/broodjes/broodje.php
)


Molliev2 is an addon developed by Dev4Me as additional Dutch payment method (iDeal), also on this forum. I have 3 payment methods active, Invoice, MollieV2 and CoD (Cash on Delivery)
Title: Re: Invoice payment option not working
Post by: Ruud on July 12, 2016, 04:58:06 PM
Could it be you are using the wrong Mollie plugin? There are two versions (for bakery 1.6.x and bakery 1.7.x)

In the info.php located in /modules/bakery/payment_methods/molliev2/ it should say:
Code: [Select]
$requires_bakery_module = '1.7';
Title: Re: Invoice payment option not working
Post by: Ruud on July 12, 2016, 05:25:11 PM
I found the problem  :-(

It is actually a problem of the Molliev2 plugin.
The "Ik betaal via Mollie" button is generated in it's own form construct. (I guess because it was done that way in older Bakery versions)
This breaks the main form for other payment plugins.
The order of the payment methods in the website depends if it goes wrong or not. So sometimes it will work and sometimes it fails.

I fixed the plugin and put the new version on my website.
https://www.dev4me.nl/modules-snippets/opensource/bakery-betaal-plugin-voor-mollie/

Download > Unpack > Overwrite the existing molliev2 files.
Title: Re: Invoice payment option not working
Post by: Broem on July 12, 2016, 05:32:50 PM
@ Ruud, was using 1.7 (verified that).

Great you did find the issue, i'm going to download the latest version and upload the files again and test it.
Title: Re: Invoice payment option not working
Post by: freeSbee on July 19, 2016, 02:44:26 PM
Hi Ruud

Thank you for the quick fix!
I have just released a new version of Bakery that contains the upgraded version of Molliev2 payment plugin v1.1. Download it from the Bakery Website:
http://www.bakery-shop.ch/#download

Regards Christoph