Commit b5777d7813b967a54f9287e6b3d8fdd9e0300050

Authored by Administrator
1 parent 3d4c48f5

add variantSku

Showing 1 changed file with 14 additions and 9 deletions   Show diff stats
@@ -68,7 +68,7 @@ class Seo extends Widget @@ -68,7 +68,7 @@ class Seo extends Widget
68 68
69 if(empty($filter) && empty($sort) && empty($paginate) ){ 69 if(empty($filter) && empty($sort) && empty($paginate) ){
70 70
71 - return $this->prepareString($this->selectSeoData(self::SEO_TEXT,$filter)); 71 + return $this->prepareString($this->selectSeoData(self::SEO_TEXT,$filter,$priority));
72 72
73 } else { 73 } else {
74 74
@@ -101,7 +101,7 @@ class Seo extends Widget @@ -101,7 +101,7 @@ class Seo extends Widget
101 101
102 $filter = \Yii::$app->request->get('filters', []); 102 $filter = \Yii::$app->request->get('filters', []);
103 103
104 - $default = $this->selectSeoData(self::H1, $filter); 104 + $default = $this->selectSeoData(self::H1, $filter,$priority);
105 105
106 if ($default != $this->{self::H1}) { 106 if ($default != $this->{self::H1}) {
107 107
@@ -122,10 +122,10 @@ class Seo extends Widget @@ -122,10 +122,10 @@ class Seo extends Widget
122 $filter = \Yii::$app->request->get('filters', []); 122 $filter = \Yii::$app->request->get('filters', []);
123 123
124 124
125 - $title = $this->selectSeoData(self::TITLE, $filter); 125 + $title = $this->selectSeoData(self::TITLE, $filter,$priority);
126 126
127 127
128 - if(!empty($filter) && $title == $this->{Seo::TITLE} || !empty($filter) && empty($this->{Seo::TITLE})) { 128 + if(!empty($filter) && $priority==3 || !empty($filter) && empty($this->{Seo::TITLE})) {
129 129
130 $array = $this->arrayBuilder($filter); 130 $array = $this->arrayBuilder($filter);
131 131
@@ -143,13 +143,12 @@ class Seo extends Widget @@ -143,13 +143,12 @@ class Seo extends Widget
143 } else { 143 } else {
144 return $this->prepareString($this->project_name); 144 return $this->prepareString($this->project_name);
145 } 145 }
146 -  
147 break; 146 break;
148 case self::DESCRIPTION: 147 case self::DESCRIPTION:
149 148
150 $filter = \Yii::$app->request->get('filters', []); 149 $filter = \Yii::$app->request->get('filters', []);
151 150
152 - $description = $this->selectSeoData(self::DESCRIPTION, $filter); 151 + $description = $this->selectSeoData(self::DESCRIPTION, $filter,$priority);
153 152
154 if (!empty($description)) { 153 if (!empty($description)) {
155 154
@@ -178,7 +177,7 @@ class Seo extends Widget @@ -178,7 +177,7 @@ class Seo extends Widget
178 $sort = \Yii::$app->request->get('sort', []); 177 $sort = \Yii::$app->request->get('sort', []);
179 $paginate = \Yii::$app->request->get('page', []); 178 $paginate = \Yii::$app->request->get('page', []);
180 179
181 - $meta = $this->selectSeoData(self::META, $filter); 180 + $meta = $this->selectSeoData(self::META, $filter,$priority);
182 181
183 if(!empty($filter) && !$this->checkFilter($filter) && count($filter, COUNT_RECURSIVE) == 2){ 182 if(!empty($filter) && !$this->checkFilter($filter) && count($filter, COUNT_RECURSIVE) == 2){
184 $key = array_keys ( $filter); 183 $key = array_keys ( $filter);
@@ -282,6 +281,9 @@ class Seo extends Widget @@ -282,6 +281,9 @@ class Seo extends Widget
282 protected function findSeoByDynamic() 281 protected function findSeoByDynamic()
283 { 282 {
284 283
  284 +// print_r(\Yii::$app->controller->id);
  285 +// print_r(\Yii::$app->controller->action->id);
  286 +// die();
285 if(!empty($this->key)){ 287 if(!empty($this->key)){
286 288
287 $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller' => \Yii::$app->controller->id, 'action' => \Yii::$app->controller->action->id, 'key' => $this->key]); 289 $query = SeoDynamic::find()->joinWith('seoCategory')->where(['controller' => \Yii::$app->controller->id, 'action' => \Yii::$app->controller->action->id, 'key' => $this->key]);
@@ -318,11 +320,11 @@ class Seo extends Widget @@ -318,11 +320,11 @@ class Seo extends Widget
318 /** 320 /**
319 * @param $param 321 * @param $param
320 * @param $filter 322 * @param $filter
  323 + * @param $priority
321 * @return mixed 324 * @return mixed
322 */ 325 */
323 - protected function selectSeoData($param, $filter) 326 + protected function selectSeoData($param, $filter, &$priority)
324 { 327 {
325 -  
326 $result = ''; 328 $result = '';
327 329
328 $widgetData = static::findSeoByUrl($this->url); 330 $widgetData = static::findSeoByUrl($this->url);
@@ -330,12 +332,15 @@ class Seo extends Widget @@ -330,12 +332,15 @@ class Seo extends Widget
330 $widgetDynamicData = $this->findSeoByDynamic(); 332 $widgetDynamicData = $this->findSeoByDynamic();
331 333
332 if ($widgetData instanceof \artweb\artbox\seo\models\Seo) { 334 if ($widgetData instanceof \artweb\artbox\seo\models\Seo) {
  335 + $priority = 1;
333 $result = $widgetData->$param; 336 $result = $widgetData->$param;
334 337
335 }else if(!empty($this->$param) && empty($filter)) { 338 }else if(!empty($this->$param) && empty($filter)) {
  339 + $priority = 2;
336 $result = $this->$param; 340 $result = $this->$param;
337 341
338 } else if ($widgetDynamicData instanceof SeoDynamic) { 342 } else if ($widgetDynamicData instanceof SeoDynamic) {
  343 + $priority = 3;
339 $result = $widgetDynamicData->lang->$param; 344 $result = $widgetDynamicData->lang->$param;
340 345
341 } 346 }