Erik

Erik

Binnenkort

We willen deze plugin graag gebruiken om informatie te verzamelen en vragen om een vrijwillige donatie, alleen is het minimum bedrag €0,50.

Lennard

Lennard

· ·

Zodat je hetzelfde formulier ook kunt gebruiken voor het bestellen van gratis diensten en producten.

totaal 1 stem
Philip Beekman
Philip Beekman

Philip Beekman

· ·

Ik zou dit ook handig vinden, omdat er ook mensen zijn die wel een order willen plaatsen maar rechtstreeks van hun eigen bankrekening willen betalen.

totaal 1 stem
Philip Beekman
Lieke

Lieke

·

Dit zou fantastisch zijn zo dat het formulier overal voor inzetbaar is

nog geen stemmen
Lennard

Lennard

·

Wanneer wordt deze update beschikbaar verwacht?

nog geen stemmen
Pieter Naber @ Mantix

Pieter Naber @ Mantix

·

Ik had dit vandaag weer nodig, dus even zelf de wijziging doorgevoerd.

Ik raad niet aan om dit direct over te nemen, zo is de functie "sendEmail" overgenomen uit een andere class, en dubbele code is nooit heel fijn. Maar dit werkt wel :-)

Ik heb het volgende aangepast:

classes\Form.php, regel 746 vervangen door: if ($totalPrice > 0) { $order = $mollie->post('orders', $orderData); } else { $order = (object) array( 'id' => $rfmpId, 'mode' => substr($apiKey, 0, 4), 'status' => 'paid', 'amount' => (object) array( 'currency' => 'EUR', 'value' => '0,00', ), '_links' => (object) array( 'checkout' => (object) array( 'href' => $redirect . 'payment=' . $rfmpId, ), ), ); }

classes\Form.php, na bovenstaande aanpassing regel 779, toegevoegd: if ($totalPrice == 0) { // send emails $this->sendEmail($postId, $order->status, $registrationId, $order, 'customer'); $this->sendEmail($postId, $order->status, $registrationId, $order, 'merchant'); }

classes\Form.php, na bovenstaande aanpassingen regel 812 vervangen door: if ($totalPrice > 0) { $payment = $mollie->post('payments', $paymentData); } else { $payment = (object) array( 'id' => $rfmpId, 'method' => 'nopayment', 'mode' => substr($apiKey, 0, 4), 'status' => 'paid', 'amount' => (object) array( 'currency' => $currency, 'value' => number_format($totalPrice, $decimals, '.', ''), ), '_links' => (object) array( 'checkout' => (object) array( 'href' => $redirect . 'payment=' . $rfmpId, ), ), ); }

classes\Form.php, na bovenstaande aanpassingen regel 846, toegevoegd: if ($totalPrice == 0) { // send emails $this->sendEmail($postId, $payment->status, $registrationId, $payment, 'customer'); $this->sendEmail($postId, $payment->status, $registrationId, $payment, 'merchant'); }

classes\Form.php, na bovenstaande aanpassingen regel 924: ` private function sendEmail($post, $status, $registrationId, $payment, $type) { if (!in_array($status, ['paid', 'expired', 'canceled', 'charged_back'])) { return; }

    $status = str_replace('_', '', $status);

    $enabled = get_post_meta($post, '_rfmp_enabled_' . $status . '_' . $type, true);
    if ($enabled != '1') {
        return;
    }

    $currency   = get_post_meta($post, '_rfmp_currency', true) ?: 'EUR';
    $decimals   = $this->helpers->getCurrencies($currency);
    $symbol     = $this->helpers->getCurrencySymbol($currency);
    $vatSetting = get_post_meta($post, '_rfmp_vat_setting', true);

    $registration = $this->db->get_row("SELECT * FROM {$this->mollieForms->getRegistrationsTable()} WHERE id=" .
                                       (int) $registrationId);

    $priceOptionString   = [];
    $priceOptionInterval = null;
    $priceOptionTable    = '<table style="width:100%"><tr><td></td><td><strong>' .
                           __('Description', 'mollie-forms') . '</strong></td><td><strong>' .
                           __('Price', 'mollie-forms') . '</strong></td><td><strong>' .
                           __('Subtotal', 'mollie-forms') . '</strong></td></tr>';
    $priceOptionTableVat = '<table style="width:100%"><tr><td></td><td><strong>' .
                           __('Description', 'mollie-forms') . '</strong></td><td><strong>' .
                           __('Price', 'mollie-forms') . '</strong></td><td><strong>' . __('VAT', 'mollie-forms') .
                           '</strong></td><td><strong>' . __('Subtotal', 'mollie-forms') . '</strong></td></tr>';

    $subtotal = 0;
    $total    = 0;
    $totalVat = 0;

    $priceOptions = $this->db->get_results("SELECT * FROM {$this->mollieForms->getRegistrationPriceOptionsTable()} WHERE registration_id=" .
                                           (int) $registrationId);
    foreach ($priceOptions as $priceOption) {
        $optionPrice = $priceOption->price * $priceOption->quantity;

        if ($vatSetting === 'excl') {
            $optionVat = ($priceOption->vat / 100) * $optionPrice;
            $total     += $optionVat;
        } else {
            $optionVat = ($priceOption->vat / (100 + $priceOption->vat)) * $optionPrice;
        }

        $subtotal += $optionPrice;
        $total    += $optionPrice;
        $totalVat += $optionVat;

        $priceOptionString[] = $priceOption->quantity . 'x ' . $priceOption->description;

        if ($priceOptionInterval === null) {
            $priceOptionInterval = $priceOption->frequency_value . ' ' . $priceOption->frequency;
        }

        $priceOptionTable    .= '<tr><td>' . $priceOption->quantity . 'x</td><td>' . $priceOption->description .
                                '</td><td>' . $this->helpers->getCurrencySymbol($priceOption->currency ?: 'EUR') .
                                ' ' . number_format($priceOption->price, $decimals, ',', '') . ' ' .
                                $this->helpers->getFrequencyLabel($priceOption->frequency_value . ' ' .
                                                                  $priceOption->frequency) . '</td><td>' .
                                $this->helpers->getCurrencySymbol($priceOption->currency ?: 'EUR') . ' ' .
                                number_format($subtotal, $decimals, ',', '') . '</td></tr>';
        $priceOptionTableVat .= '<tr><td>' . $priceOption->quantity . 'x</td><td>' . $priceOption->description .
                                '</td><td>' . $this->helpers->getCurrencySymbol($priceOption->currency ?: 'EUR') .
                                ' ' . number_format($priceOption->price, $decimals, ',', '') . ' ' .
                                $this->helpers->getFrequencyLabel($priceOption->frequency_value . ' ' .
                                                                  $priceOption->frequency) . '</td><td>' .
                                $this->helpers->getCurrencySymbol($priceOption->currency ?: 'EUR') . ' ' .
                                number_format($optionVat, $decimals, ',', '') . '</td><td>' .
                                $this->helpers->getCurrencySymbol($priceOption->currency ?: 'EUR') . ' ' .
                                number_format($optionPrice, $decimals, ',', '') . '</td></tr>';
    }

    $priceOptionTable .= '<tr><td colspan="3"><strong>' . __('Total', 'mollie-forms') .
                         '</strong></td><td><strong>' . $symbol . ' ' . number_format($total, $decimals, ',', '') .
                         '</strong></td></tr></table>';


    if ($vatSetting == 'excl') {
        $priceOptionTableVat .= '<tr><td colspan="4"><strong>' . __('Subtotal', 'mollie-forms') .
                                '</strong></td><td><strong>' . $symbol . ' ' .
                                number_format($subtotal, $decimals, ',', '') . '</strong></td></tr>';
        $priceOptionTableVat .= '<tr><td colspan="4"><strong>' . __('VAT', 'mollie-forms') .
                                '</strong></td><td><strong>' . $symbol . ' ' .
                                number_format($totalVat, $decimals, ',', '') . '</strong></td></tr>';
    }

    $priceOptionTableVat .= '<tr><td colspan="4"><strong>' . __('Total', 'mollie-forms') .
                            '</strong></td><td><strong>' . $symbol . ' ' .
                            number_format($total, $decimals, ',', '') . '</strong></td></tr></table>';

    $createdAt = new DateTime($registration->created_at, wp_timezone());

    $data    = [];
    $search  = [
        '{rfmp="amount"}',
        '{rfmp="interval"}',
        '{rfmp="status"}',
        '{rfmp="payment_id"}',
        '{rfmp="method"}',
        '{rfmp="form_title"}',
        '{rfmp="created_at"}',
        '{rfmp="priceoption"}',
        '{rfmp="priceoption_table"}',
        '{rfmp="priceoption_table_vat"}',
        '{rfmp="url"}',
        '{rfmp="registration_id"}',
    ];
    $replace = [
        $this->helpers->getCurrencySymbol($payment->amount->currency) . ' ' . $payment->amount->value,
        $this->helpers->getFrequencyLabel($priceOptionInterval, true),
        $status,
        $payment->id,
        $payment->method ?: '-',
        get_the_title($post),
        wp_date(get_option('date_format') . ' ' . get_option('time_format'), $createdAt->getTimestamp()),
        implode(', ', $priceOptionString),
        $priceOptionTable,
        $priceOptionTableVat,
        $payment->redirectUrl,
        $registrationId,
    ];

    $fields = $this->db->get_results("SELECT * FROM {$this->mollieForms->getRegistrationFieldsTable()} WHERE registration_id=" .
                                     (int) $registrationId);
    foreach ($fields as $row) {
        if ($row->type === 'email') {
            $data['to_email'] = $row->value;
        }

        $data[$row->field] = $row->value;
        $search[]          = '{rfmp="' . trim($row->field) . '"}';

        if ($row->type === 'checkbox') {
            $replace[] = $row->value === '1' ? __('Yes', 'mollie-forms') : __('No', 'mollie-forms');
        } else {
            $replace[] = $row->value;
        }
    }

    $email = get_post_meta($post, '_rfmp_email_' . $status . '_' . $type, true);
    $email = str_replace($search, $replace, $email);
    $email = str_replace(['http://', 'https://'], '//', $email);
    $email = str_replace('//', (is_ssl() ? 'https://' : 'http://'), $email);
    $email = nl2br($email);

    $subject = get_post_meta($post, '_rfmp_subject_' . $status . '_' . $type, true);
    $subject = str_replace($search, $replace, $subject);

    $fromname  = get_post_meta($post, '_rfmp_fromname_' . $status . '_' . $type, true);
    $fromemail = get_post_meta($post, '_rfmp_fromemail_' . $status . '_' . $type, true);
    $fromemail = explode(',', trim($fromemail));

    if ($type == 'merchant') {
        $to = get_post_meta($post, '_rfmp_toemail_' . $status . '_' . $type, true) ?: $fromemail;
    } else {
        $to = $data['to_email'];
    }

    $headers[] = 'From: ' . $fromname . ' <' . $fromemail[0] . '>';
    $headers[] = 'Content-Type: text/html; charset=UTF-8';

    wp_mail($to, $subject, $email, $headers);
}`

templates/metaboxes/priceOptions.php, regel 10: Pas min="0.50" aan naar min="0.00"

Doe er je voordeel mee :-)

nog geen stemmen

Je kunt @ gebruiken om iemand te noemen.

0 euro optie

totaal 8 stemmen
  • Nick van Wobbie.nl heeft item verplaatst naar bord Binnenkort

    3 maanden geleden
  • Nick van Wobbie.nl heeft item verplaatst naar bord Backlog

    10 maanden geleden
  • Erik heeft item verplaatst naar project Mollie Forms

    10 maanden geleden
  • Erik heeft het item aangemaakt

    10 maanden geleden