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

Игнорировать html в описании товара


Recommended Posts

Доброго времени суток. На опенкарт2.3 используется парсер который передает не просто текст/значения, а фрагменты html кода вместе с текстом в описание товара. Блоки передаются этоликом, этоленаправленно. Как сгделать, что-бы в описании товара отображался только текст, без тегов html? Если ик вообещё можно))

Link to comment
Share on other sites


Можно и парсер перегделать, можно и вывод из базы перегделать

Link to comment
Share on other sites


  • 4 months later...
В 08.09.2020 в 00:01, AlexDW сказал:

Доброго времени суток. Помогите внедрить) сгделал вот ик, и не прокатило

ocStore 3.0.2.0

{% if description %}
				<div class="us-product-description-cont">
					$text = '{{ description }}';
					echo strip_tags($text, '<br>');
					echo "\n";
					{% if tags %}
					<p class="us-product-tags">{{ text_tags }}
						{% for i in 0..tags|length %}
						{% if i < (tags|length - 1) %} <a href="{{ tags[i].href }}">{{ tags[i].tag }}</a>,
						{% else %} <a href="{{ tags[i].href }}">{{ tags[i].tag }}</a> {% endif %}
						{% endfor %}
					</p>
					{% endif %}
				</div>
				{% endif %}

 

Edited by bendjfranclin777
Link to comment
Share on other sites


58 минут назад, chukcha сказал:

Делайте это в контроллере

Пожалуйси не ругайтесь сильно) в php плохо разбираюсь, вот ик сгделал и ничего не изменилось

$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					$text = 'description';
					 echo strip_tags($text, '<br>');
					echo "\n";
					'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $rating,
					'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
				);

 

Link to comment
Share on other sites


1 час назад, bendjfranclin777 сказал:

Пожалуйси не ругайтесь сильно) в php плохо разбираюсь, вот ик сгделал и ничего не изменилось

$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					$text = 'description';
					 echo strip_tags($text, '<br>');
					echo "\n";
					'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $rating,
					'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
				);

 

 

/catalog/controller/product

строка 259

ик сгделал и тоже не хочет

$data['description'] = html_entity_decode(strip_tags($product_info['description'], '<br>', ENT_QUOTES, 'UTF-8'));

 

Link to comment
Share on other sites


В 07.09.2020 в 21:36, Valery332 сказал:

Доброго времени суток. На опенкарт2.3 используется парсер который передает не просто текст/значения, а фрагменты html кода вместе с текстом в описание товара. Блоки передаются этоликом, этоленаправленно. Как сгделать, что-бы в описании товара отображался только текст, без тегов html? Если ик вообещё можно))

сгделать экспорт со своего сайи без html

а потом импортировать назад

Я ТАКОЕ ДЕЛАЛ

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.