Commit bf6de24b12c2fea270786ef872d47989e30f8e5a

Authored by Administrator
1 parent 2b9e3f9e

add variantSku

models/SeoDynamicLang.php
... ... @@ -101,13 +101,13 @@
101 101 return [
102 102 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'),
103 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 13 * @var View $this
14 14 */
15 15 ?>
  16 +
16 17 <?= $form->field($model_lang, '[' . $language->id . ']title')
17 18 ->textInput([ 'maxlength' => true ]); ?>
  19 +
18 20 <?= $form->field($model_lang, '[' . $language->id . ']meta_title')
19 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 34 <?= $form->field($model_lang, '[' . $language->id . ']seo_text')
31 35 ->widget(CKEditor::className(), [
... ... @@ -36,10 +40,3 @@
36 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 43 \ No newline at end of file
... ...
widgets/Seo.php
... ... @@ -29,7 +29,7 @@ class Seo extends Widget
29 29  
30 30  
31 31 const SEO_TEXT = 'seo_text';
32   - const DESCRIPTION = 'description';
  32 + const DESCRIPTION = 'meta_description';
33 33 const META = 'meta';
34 34 const H1 = 'h1';
35 35 const TITLE = 'title';
... ... @@ -135,6 +135,7 @@ class Seo extends Widget
135 135  
136 136 }
137 137  
  138 +
138 139 if (!empty($title)) {
139 140  
140 141 return $title;
... ... @@ -253,7 +254,9 @@ class Seo extends Widget
253 254  
254 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 260 if(!empty($this->key)){
258 261  
259 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 285 }
283 286 }
284 287  
  288 +
  289 + /**
  290 + * @param $param
  291 + * @return mixed
  292 + */
285 293 protected function selectSeoData($param)
286 294 {
287 295  
... ... @@ -294,19 +302,20 @@ class Seo extends Widget
294 302 $result = $widgetData->$param;
295 303  
296 304 } else if (!empty($this->$param)) {
297   -
298   - $result = $this->$param;
299   -
300   - } else {
301   -
302 305 $widgetData = $this->findSeoByDynamic();
303 306  
304 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 321 return $this->replaceData($result);
... ...