Skip to content

Unable to save/update Voucher Types #147

@sunnylawn

Description

@sunnylawn

Describe the bug

I am trying to save a new field onto a voucher type, when saving, am just getting:

Undefined variable $request

on

1. in /var/www/html/vendor/verbb/gift-voucher/src/controllers/VoucherTypesController.php
at line 68
   {
        $this->requirePostRequest();
 
        $voucherType = new VoucherType();
 
        $voucherType->id = $this->request->getBodyParam('voucherTypeId');
        $voucherType->name = $this->request->getBodyParam('name');
        $voucherType->handle = $this->request->getBodyParam('handle');
        $voucherType->skuFormat = $this->request->getBodyParam('skuFormat');
        $voucherType->descriptionFormat = $request->getBodyParam('descriptionFormat');
 
        // Site-specific settings
        $allSiteSettings = [];
 
        foreach (Craft::$app->getSites()->getAllSites() as $site) {
            $postedSettings = $this->request->getBodyParam('sites.' . $site->handle);
 
            $siteSettings = new VoucherTypeSite();
            $siteSettings->siteId = $site->id;

specifically:

$voucherType->descriptionFormat = $request->getBodyParam('descriptionFormat');

Steps to reproduce

  1. Navigate to Gift Voucher > Voucher Types
  2. Click on voucher
  3. Hit save, or try modifying field and then hitting save

Craft CMS version

5.8.2

Plugin version

4.0.11

Multi-site?

Yes

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions