Commit bf6de24b12c2fea270786ef872d47989e30f8e5a
1 parent
2b9e3f9e
add variantSku
Showing
3 changed files
with
37 additions
and
31 deletions
Show diff stats
models/SeoDynamicLang.php
@@ -101,13 +101,13 @@ | @@ -101,13 +101,13 @@ | ||
101 | return [ | 101 | return [ |
102 | 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), | 102 | 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), |
103 | 'language_id' => Yii::t('app', 'language_id'), | 103 | 'language_id' => Yii::t('app', 'language_id'), |
104 | - 'title' => Yii::t('app', 'name'), | ||
105 | - 'meta_title' => Yii::t('app', 'title'), | ||
106 | - 'h1' => Yii::t('app', 'h1'), | ||
107 | - 'key' => Yii::t('app', 'key'), | ||
108 | - 'meta' => Yii::t('app', 'meta'), | ||
109 | - 'meta_description' => Yii::t('app', 'meta_description'), | ||
110 | - 'seo_text' => Yii::t('app', 'seo_text'), | 104 | + 'title' => 'name', |
105 | + 'meta_title' => 'title', | ||
106 | + 'h1' => 'h1', | ||
107 | + 'key' => 'key', | ||
108 | + 'meta' => 'meta', | ||
109 | + 'meta_description' => 'meta description', | ||
110 | + 'seo_text' => 'seo text', | ||
111 | ]; | 111 | ]; |
112 | } | 112 | } |
113 | 113 |
views/seo-dynamic/_form_language.php
@@ -13,19 +13,23 @@ | @@ -13,19 +13,23 @@ | ||
13 | * @var View $this | 13 | * @var View $this |
14 | */ | 14 | */ |
15 | ?> | 15 | ?> |
16 | + | ||
16 | <?= $form->field($model_lang, '[' . $language->id . ']title') | 17 | <?= $form->field($model_lang, '[' . $language->id . ']title') |
17 | ->textInput([ 'maxlength' => true ]); ?> | 18 | ->textInput([ 'maxlength' => true ]); ?> |
19 | + | ||
18 | <?= $form->field($model_lang, '[' . $language->id . ']meta_title') | 20 | <?= $form->field($model_lang, '[' . $language->id . ']meta_title') |
19 | ->textInput(); ?> | 21 | ->textInput(); ?> |
20 | -<?= $form->field($model_lang, '[' . $language->id . ']meta_description') | ||
21 | - ->widget(CKEditor::className(), [ | ||
22 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | ||
23 | - 'preset' => 'full', | ||
24 | - 'inline' => false, | ||
25 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | ||
26 | - ->createUrl('file/uploader/images-upload'), | ||
27 | - ]), | ||
28 | - ]) ?> | 22 | + |
23 | +<?= $form->field($model_lang, '[' . $language->id . ']meta_description')->textarea() ?> | ||
24 | + | ||
25 | +<?= $form->field($model_lang, '[' . $language->id . ']key') | ||
26 | + ->textInput([ 'maxlength' => true ]) ?> | ||
27 | + | ||
28 | +<?= $form->field($model_lang, '[' . $language->id . ']h1') | ||
29 | + ->textInput([ 'maxlength' => true ]) ?> | ||
30 | + | ||
31 | +<?= $form->field($model_lang, '[' . $language->id . ']meta') | ||
32 | + ->textInput([ 'maxlength' => true ]) ?> | ||
29 | 33 | ||
30 | <?= $form->field($model_lang, '[' . $language->id . ']seo_text') | 34 | <?= $form->field($model_lang, '[' . $language->id . ']seo_text') |
31 | ->widget(CKEditor::className(), [ | 35 | ->widget(CKEditor::className(), [ |
@@ -36,10 +40,3 @@ | @@ -36,10 +40,3 @@ | ||
36 | ->createUrl('file/uploader/images-upload'), | 40 | ->createUrl('file/uploader/images-upload'), |
37 | ]), | 41 | ]), |
38 | ]) ?> | 42 | ]) ?> |
39 | -<?= $form->field($model_lang, '[' . $language->id . ']key') | ||
40 | - ->textInput([ 'maxlength' => true ]) ?> | ||
41 | -<?= $form->field($model_lang, '[' . $language->id . ']h1') | ||
42 | - ->textInput([ 'maxlength' => true ]) ?> | ||
43 | - | ||
44 | -<?= $form->field($model_lang, '[' . $language->id . ']meta') | ||
45 | - ->textInput([ 'maxlength' => true ]) ?> | ||
46 | \ No newline at end of file | 43 | \ No newline at end of file |
widgets/Seo.php
@@ -29,7 +29,7 @@ class Seo extends Widget | @@ -29,7 +29,7 @@ class Seo extends Widget | ||
29 | 29 | ||
30 | 30 | ||
31 | const SEO_TEXT = 'seo_text'; | 31 | const SEO_TEXT = 'seo_text'; |
32 | - const DESCRIPTION = 'description'; | 32 | + const DESCRIPTION = 'meta_description'; |
33 | const META = 'meta'; | 33 | const META = 'meta'; |
34 | const H1 = 'h1'; | 34 | const H1 = 'h1'; |
35 | const TITLE = 'title'; | 35 | const TITLE = 'title'; |
@@ -135,6 +135,7 @@ class Seo extends Widget | @@ -135,6 +135,7 @@ class Seo extends Widget | ||
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||
138 | + | ||
138 | if (!empty($title)) { | 139 | if (!empty($title)) { |
139 | 140 | ||
140 | return $title; | 141 | return $title; |
@@ -253,7 +254,9 @@ class Seo extends Widget | @@ -253,7 +254,9 @@ class Seo extends Widget | ||
253 | 254 | ||
254 | protected function findSeoByDynamic() | 255 | protected function findSeoByDynamic() |
255 | { | 256 | { |
256 | - | 257 | +// print_r(\Yii::$app->controller->id); |
258 | +// print_r(\Yii::$app->controller->action->id); | ||
259 | +// die(); | ||
257 | if(!empty($this->key)){ | 260 | if(!empty($this->key)){ |
258 | 261 | ||
259 | $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller' => \Yii::$app->controller->id, 'action' => \Yii::$app->controller->action->id, 'key' => $this->key]); | 262 | $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller' => \Yii::$app->controller->id, 'action' => \Yii::$app->controller->action->id, 'key' => $this->key]); |
@@ -282,6 +285,11 @@ class Seo extends Widget | @@ -282,6 +285,11 @@ class Seo extends Widget | ||
282 | } | 285 | } |
283 | } | 286 | } |
284 | 287 | ||
288 | + | ||
289 | + /** | ||
290 | + * @param $param | ||
291 | + * @return mixed | ||
292 | + */ | ||
285 | protected function selectSeoData($param) | 293 | protected function selectSeoData($param) |
286 | { | 294 | { |
287 | 295 | ||
@@ -294,19 +302,20 @@ class Seo extends Widget | @@ -294,19 +302,20 @@ class Seo extends Widget | ||
294 | $result = $widgetData->$param; | 302 | $result = $widgetData->$param; |
295 | 303 | ||
296 | } else if (!empty($this->$param)) { | 304 | } else if (!empty($this->$param)) { |
297 | - | ||
298 | - $result = $this->$param; | ||
299 | - | ||
300 | - } else { | ||
301 | - | ||
302 | $widgetData = $this->findSeoByDynamic(); | 305 | $widgetData = $this->findSeoByDynamic(); |
303 | 306 | ||
304 | if ($widgetData instanceof SeoDynamic) { | 307 | if ($widgetData instanceof SeoDynamic) { |
305 | 308 | ||
306 | - $result = $widgetData->$param; | 309 | + $result = $widgetData->lang->$param; |
307 | 310 | ||
308 | } | 311 | } |
309 | 312 | ||
313 | + } else { | ||
314 | + | ||
315 | + $result = $this->$param; | ||
316 | + | ||
317 | + | ||
318 | + | ||
310 | } | 319 | } |
311 | 320 | ||
312 | return $this->replaceData($result); | 321 | return $this->replaceData($result); |