they don't retain any of the text formatting!
Where there is a sentence then a return to the next line it joins the words together!
Example….
If I have this text
typed out in my description
for the product it will
look like this….
If I have this texttyped out in my
descriptionfor the product it willlook like this….
Any ideas?
I use Arial font
I have a heading at 36pt set to bold
followed by a sub heading in 24pt
then bodycopy in 14pt
Cheers
To change that, edit catalog/controller/extension/module/featured.php and replace line 57 with the following :
Code: Select all
'description' => utf8_substr(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8'), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
Replaced the original with the edited on via Filezilla.
When I did that I had no website just a blank page!
Luckily I saved the original, so uploaded that back and the webpage came back!!!
here is my amended line…
'description' => utf8_substr(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
It looks like when you tried to add the code, the $product_info would be the wrong array name but rather the: $result array name from the location to where you replaced the code.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
What do you mean, is this the code you currently have?
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
<?php
class ControllerExtensionModuleFeatured extends Controller {
public function index($setting) {
$this->load->language('extension/module/featured');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$data['products'] = array();
if (!$setting['limit']) {
$setting['limit'] = 4;
}
if (!empty($setting['product'])) {
$products = array_slice($setting['product'], 0, (int)$setting['limit']);
foreach ($products as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
} else {
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
}
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$price = false;
}
if ((float)$product_info['special']) {
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$special = false;
}
if ($this->config->get('config_tax')) {
$tax = $this->currency->format((float)$product_info['special'] ? $product_info['special'] : $product_info['price'], $this->session->data['currency']);
} else {
$tax = false;
}
if ($this->config->get('config_review_status')) {
$rating = $product_info['rating'];
} else {
$rating = false;
}
$data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $rating,
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
);
}
}
}
if ($data['products']) {
return $this->load->view('extension/module/featured', $data);
}
}
}
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
why does it then totally remove the description and then mess with the
font size/colour of the prices which are default inputs in the product data & special areas
when I create a product?
So how do I input the text for descriptions so it retains the punctuation (fullstop & returns)?
I guess one way would be if you count the characters in the description to know where it would be cut down, and possibly change that limit. Another option could be actual text linebreaks, but I didnt test it.
So, as you can see, it's not that easy, and recommended to be left as is.
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
This what I have used.
(screenshot attached)
Attachments
how it looks on the site for Featured box - Screen Shot 2017-10-20 at 1.16.57 PM.png (338.14 KiB) Viewed 1736 times
how it is typed out in product description - Screen Shot 2017-10-20 at 1.16.45 PM.png (225.43 KiB) Viewed 1736 times
Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com
Users browsing this forum: DesignCart and 97 guests