Jump to content
Sign in to follow this  
Esox

[Решено] Дублирование описания при пагинации

Recommended Posts

Все работает, текст пропал но теперь "красуется" надпись; Нет товаров этого производителя.

post-669677-0-18468600-1387901193_thumb.jpg

 

Как убрать кто знает? Причем хотел описание вверх переместить т.е. код ввести  после строчки;

<h1><?php echo $heading_title; ?></h1>

Тогда действительно весь товар пропадает с последующих страниц кроме первой(((

Share this post


Link to post
Share on other sites

Спасибо afwollis за решение для OC 1.5.

 

В OpenCart 2.0 в catalog/controller/product/category.php находите строку 140 и меняете с

$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');

на

if ($page == 1) {
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = "";
}
Edited by kisluk
  • +1 2

Share this post


Link to post
Share on other sites

И небольшое дополнение,  которое отключит вывод изображения для описания на 2+n страницах

if ($category_info['image']) {

на

if ($category_info['image'] && $page == 1) {
Edited by kisluk

Share this post


Link to post
Share on other sites

Для производителей исправляем

if ($manufacturer_info['image']) {

на

if ($manufacturer_info['image'] && $page == 1) {

и с

$data['description'] = html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8');

на

if ($page == 1) {
$data['description'] = html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = "";
}

 
Сделал .xml. Кидаем my-fix.ocmod.xml в /system/, обновляем кеш.

<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>Fix default options</name>
  <code>default</code>
  <version>1.0</version>
  <author>triangle</author>
  <link>https://triangle.co.ua</link>
  <file path="catalog/controller/product/category.php">
	<operation>
      <search>
        <![CDATA[if ($category_info['image']) {]]>
      </search>
      <add position="replace">
        <![CDATA[if ($category_info['image'] && $page == 1) {]]>
      </add>
    </operation>
	<operation>
      <search>
        <![CDATA[$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');]]>
      </search>
      <add position="replace">
        <![CDATA[if ($page == 1) {
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = "";
}]]>
      </add>
    </operation>
  </file>
  <file path="catalog/controller/product/manufacturer.php">
	<operation>
      <search>
        <![CDATA[if ($manufacturer_info['image']) {]]>
      </search>
      <add position="replace">
        <![CDATA[if ($manufacturer_info['image'] && $page == 1) {]]>
      </add>
    </operation>
	<operation>
      <search>
        <![CDATA[$data['description'] = html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8');]]>
      </search>
      <add position="replace">
        <![CDATA[if ($page == 1) {
$data['description'] = html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = "";
}]]>
      </add>
    </operation>
  </file>
</modification>
  • +1 3

Share this post


Link to post
Share on other sites

а как canonical сделать для первой страницы пагинации?

Share this post


Link to post
Share on other sites

А зачем?

сеошник рекомендует

Share this post


Link to post
Share on other sites

для 3 версии чего-то не работает Parse error: syntax error, unexpected ''description'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /home/www/system/storage/modification/catalog/controller/product/category.php on line 167

Share this post


Link to post
Share on other sites
В 21.11.2012 в 17:04, afwollis сказал:

catalog/controller/product/category.php

находите строчку 114

 


$this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');

меняете на

 


if ($page == 1) {$this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');} else {$this->data['description'] = "";}

После замены на oc 2.1 при переходе в категорию выдает ошибку 
Parse error: syntax error, unexpected '' (T_STRING), expecting '(' in /home/host1594277/site.ru/htdocs/www/system/storage/modification/catalog/controller/product/category.php on line 187

Share this post


Link to post
Share on other sites
В 30.11.2015 в 15:47, kisluk сказал:

Спасибо afwollis за решение для OC 1.5.

 

В OpenCart 2.0 в catalog/controller/product/category.php находите строку 140 и меняете с


$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');

на


if ($page == 1) {
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = "";
}

Ошибка в ос2.1 
Parse error: syntax error, unexpected '$data' (T_VARIABLE) в 192 строке..

Share this post


Link to post
Share on other sites

 

Супер, всё работает на 5+ ocStore 2.3.0.2.3

Edited by kiruxaluga

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.