Плагин поиска CakeRC - неопределенный индекс PrgComponent.php, строка 389

1

Я пытаюсь установить плагин CakeRc Search, чтобы иметь красивые URL-адреса во время поиска, но я продолжаю получать следующие ошибки:

Notice (8): Undefined index: Properties [APP\Plugin\Search\Controller\Component\PrgComponent.php, line 389]

Warning (4096): Argument 1 passed to PrgComponent::serializeParams() must be an array, null given, called in ...\app\Plugin\Search\Controller\Component\PrgComponent.php on line 390 and defined [APP\Plugin\Search\Controller\Component\PrgComponent.php, line 268]

Warning (2): array_merge() [function.array-merge]: Argument #2 is not an array [APP\Plugin\Search\Controller\Component\PrgComponent.php, line 404]

Warning (4096): Argument 1 passed to PrgComponent::exclude() must be an array, null given, called in ...\app\Plugin\Search\Controller\Component\PrgComponent.php on line 405 and defined [APP\Plugin\Search\Controller\Component\PrgComponent.php, line 325]

Warning (2): Invalid argument supplied for foreach() [APP\Plugin\Search\Controller\Component\PrgComponent.php, line 327]

Это моя модель:

class Properties extends AppModel {

public $actsAs = array('Search.Searchable');

public $filterArgs = array(
    'location' => array(
        'type' => 'value',
    ),
    'area' => array(
        'type' => 'value',
    )
);

}

Это мой контроллер:

class PropertiesController extends AppController {

public $helpers = array('Property', 'Image');
public $uses = array('Properties','Area');
public $components = array('Search.Prg');

public $presetVars = array(
    array('field' => 'location', 'type' => 'value'),
    array('field' => 'area', 'type' => 'value'),
);

public function search() {

    //PRG

    $this->Prg->commonProcess();

    ....
 }
}

Это мое мнение:

        <?php
        echo $this->Form->create('Properties', array(
            'url' => array_merge(array('action' => 'search'), $this->params['pass']),
            'class' => 'advance-search-form clearfix'
        ));
        ?>
        <div class="option-bar">
            <label>
                Location
            </label>
            <span class="selectwrap">
                <?php
                foreach ($locations as $location)
                    $locations_[$location['Area']['location']] = $location['Area']['location'];

                echo $this->Form->input(
                    'location', array(
                    'options' => $locations_,
                    'empty' => 'Any',
                    'class' => 'search-select',
                    'type' => 'select',
                    'id' => 'select-location',
                    'name'=> 'location',
                    'label' => false,
                        )
                );
                ?>
            </span>
        </div>

        <div class="clearfix"></div>

        <div class="option-bar">
            <label>
                Area
            </label>
            <span class="selectwrap">
            <?php
            echo $this->Form->input(
                'area', array(
                'empty' => 'Any',
                'class' => 'search-select',
                'type' => 'select',
                'id' => 'select-area',
                'name' => 'area',
                'label' => false
                    )
            );
            ?>
            </span>
        </div>
        <input type="submit" value="Search" class=" real-btn btn">
   <?php echo $this->Form->end(); ?>

Я попытался изменить файл prgComponent.php в строке 389:

  $searchParams = $this->controller->request->data[$modelName];

в

  $searchParams = $this->controller->request->data;

Это очищает ошибку, но URL-адреса еще не отображаются в формате prg... :( Я получаю это:

 properties/search?url=properties%2Fsearch&location=&area=

Любая помощь будет оценена благодаря вам.

Теги:
cakephp
search

1 ответ

0

Удалите проблему, изменив строку 389 prgComponent.php на

$searchParams = $this->controller->request->data;

и изменение контроллера $ components var:

public $components = array(
    'Search.Prg' => array(
        'commonProcess' => array('paramType' => 'named'),
        'presetForm' => array('paramType' => 'named')
    )
);

Это теперь делает URL-адреса

properties/search/location:Central Algarve/area:

Ещё вопросы

Сообщество Overcoder
Наверх
Меню