Post by jennarif » Fri Jan 30, 2015 7:28 am

There are two issues when the shortened version of the product description is created.

1. Two dots are added to the end of the description, when, in fact, what should be added is three to form a proper ellipse. Of course - if the shortened version already ends with a period, then added just 2 is OK. This should be pretty easy to fix.

2. HTML entities (like  ) get truncated in certain circumstances. I have a product who's description ends like so: "Available on Amazon.com. &nb.." The non-breaking spaces were added, because I didn't want the first few characters of the next sentence. Hmmmm.... Now we get a little complicated. I suppose the short description creation should also remove or translate HTML entities so they don't get truncated. However - then we have no control over removing unwanted characters in the short description. Perhaps in an update you can add the ability to enter a SEPARATE short description rather than truncating the full description?

New member

Posts

Joined
Sat Jan 24, 2015 6:42 am

Post by fido-x » Fri Jan 30, 2015 2:56 pm

jennarif wrote:Perhaps in an update you can add the ability to enter a SEPARATE short description rather than truncating the full description?
You could use the "meta_description" for your short description instead of the truncated full description.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by jennarif » Sat Jan 31, 2015 5:43 am

Is there a setting for that somewhere or would that require a modification?

New member

Posts

Joined
Sat Jan 24, 2015 6:42 am

Post by fido-x » Sat Jan 31, 2015 10:22 pm

It would require a modification. This would probably need to be done for the modules (bestsellers, featured, latest and special) as well as the product pages (category, compare, manufacturer, product, search and special).

In the controller for each of these, there is a block of code that looks similar to the following:

Code: Select all

$data['products'][] = array(
	'product_id'  => $result['product_id'],
	'thumb'       => $image,
	'name'        => $result['name'],
	'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
	'price'       => $price,
	'special'     => $special,
	'tax'         => $tax,
	'rating'      => $rating,
	'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id']),
);
Replacing the 'description' line with the following should work:

Code: Select all

'description' => html_entity_decode($result['meta_description'], ENT_QUOTES, 'UTF-8'),

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia
Who is online

Users browsing this forum: No registered users and 10 guests