Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Noindex, nofollow для товара


 Share

Recommended Posts

Нужно для всех товаров посивить <meta name="robots" content="noindex,nofollow">.

Подскажите как это оформить?

Link to comment
Share on other sites


system/library/document.php

всивить

private $robots;     
public function setRobots($value) {
	$this->robots = $value;
}

catalog/controller/product/produst.php

всивить

$this->document->setRobots('noindex,follow');

 

Link to comment
Share on other sites

34 минуты назад, SGrWr_34 сказал:

system/library/document.php

всивить

private $robots;     
public function setRobots($value) {
	$this->robots = $value;
}

catalog/controller/product/produst.php

всивить

$this->document->setRobots('noindex,follow');

Выдает ошибку Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting function (T_FUNCTION) in /www/system/storage/modification/catalog/controller/product/product.php on line 4

Edited by astrex00
Link to comment
Share on other sites


посивил после public function index () { ошибки нету, но и на сайте не выводит <meta name="robots" content="noindex,nofollow">. Что мог упустить?

Link to comment
Share on other sites


3 минуты назад, SGrWr_34 сказал:

Да не срилииет. Всивьте перед

$this->document->setDescription($product_info['meta_description']);

Посивил.

На сайте все равно не выводит тег. Кеш обновлял.

Link to comment
Share on other sites


В header еещё добавьте

$data['robots'] = $this->document->getRobots();

и в library

public function getRobots() {
	return $this->robots;
}

и в шаблон header

<?php if ($robots) { ?>
	<meta name="robots" content="<?php echo $robots; ?>" />
<?php } ?>

 

Edited by SGrWr_34
Link to comment
Share on other sites

7 минут назад, SGrWr_34 сказал:

В header еещё добавьте

$data['robots'] = $this->document->getRobots();

и в library

public function getRobots() {
	return $this->robots;
}

Не выводит на сайте.

Всивил в system/library/document.php

 

private $robots;

public function setRobots($value) { $this->robots = $value; }

public function getRobots() { return $this->robots; }

 

В catalog/controller/product/produсt.php

 

$this->document->setRobots('noindex,nofollow');

 

В /catalog/controller/common/header.php

 

$data['robots'] = $this->document->getRobots();

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.