R
R
Ruslan16002021-08-13 08:02:52
Yii
Ruslan1600, 2021-08-13 08:02:52

How to make cnc for a product card?

Good day.
I want to make a logical CNC product card, for example mtrade.loc/metalloprokat/armatura/list-stalnoy-06.html

rules in main.php:

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '.html',
            'rules' => [
                '/' => 'site/index',
                'error' => 'site/error',
                'about' => 'site/about',
                'contact' => 'site/contact',
                'catalog' => 'category/catalog',
                'news' => 'news/news',
                'catalog/<alias:[\w_\/-]+>' => 'category/category',  //категория
                '<category:[\w_\/-]+>/<alias:[\w_\/-]+>' => 'products/products',  //товары категории
                '<parent:[\w_\/-]+>/<category:[\w_\/-]+>/<alias:[\w_\/-]+>' => 'products/product',  // ссылка на карточку товара
            ],
        ],


The problem is that the link directs me to "products/produtc s " i.e. to the same page, but should be on 'products/product'. Link type:
echo \yii\helpers\Url::to(['products/product', 'parent'=>$get_parent->alias, 'category'=>$get_category->alias, 'alias' => $item['alias']]);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question