Skip to content

Instantly share code, notes, and snippets.

@RiodeJaneiroo
Last active April 29, 2019 12:36
Show Gist options
  • Save RiodeJaneiroo/3916577d7033530e683a7341f81cee8a to your computer and use it in GitHub Desktop.
Save RiodeJaneiroo/3916577d7033530e683a7341f81cee8a to your computer and use it in GitHub Desktop.
[OpenCart 2.x Шаблонные title, descr] #opencart #seo
// catalog/controller/product/manufacturer.php
// start
if ($manufacturer_info['meta_title'] && mb_strtolower($manufacturer_info['meta_title']) != mb_strtolower($manufacturer_info['name'])) {
$this->document->setTitle($manufacturer_info['meta_title']);
} else {
$productTitle = $manufacturer_info['name'] . ' в Украине и Киеве купить в интернет магазине — Choco-Yummy';
$this->document->setTitle($productTitle);
}
if($manufacturer_info['meta_description'] && strlen($manufacturer_info['meta_description']) > 60) {
$this->document->setDescription($manufacturer_info['meta_description']);
} else {
$productDescr = 'Лучшее место где купить '.$manufacturer_info['name'].' ➔ В интернет магазине Choco-Yummy ✔Лучшие цены ✔Постоянные акции ✈Самая быстрая доставка';
$this->document->setDescription($productDescr);
}
// end
// catalog/controller/product/product.php
if ($product_info['meta_title'] && mb_strtolower($product_info['meta_title']) != mb_strtolower($product_info['name'])) {
$this->document->setTitle($product_info['meta_title']);
} else {
$productTitle = $product_info['name'] . ' - купить в интернет-магазине сладостей Choco-Yummy';
$this->document->setTitle($productTitle);
}
if($product_info['meta_description'] && strlen($product_info['meta_description']) > 60) {
$this->document->setDescription($product_info['meta_description']);
} else {
$categories = $this->model_catalog_product->getCategories($product_id);
if ($categories) $categories_info = $this->model_catalog_category->getCategory($categories[0]['category_id']);
$productDescr = sprintf('%s — у нас есть %s на любой вкус! Выбери себе сладости которые ещё не пробовал в интернет-магазине Choco-Yummy', $product_info['name'], mb_strtolower($categories_info['name']));
$this->document->setDescription($productDescr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment