hello , I hope you are well guys .
1- When the product has a long name ,I want to shorten it when it appears in the Homepage.
2- How do I control the number of lines .
1- When the product has a long name ,I want to shorten it when it appears in the Homepage.
2- How do I control the number of lines .
Attachments
how sddc.png (97.97 KiB) Viewed 1288 times
You'd want to use sub string to shorten off the text:
http://php.net/manual/en/function.substr.php
http://php.net/manual/en/function.substr.php
Increase Page Speed (#1 rated commercial extension on OpenCart Marketplace)
15in1 Essential Extensions Value Pack Premium Customer Testimonials Reward Points Extended Admin Security Lockdown Suite
irc.freenode.net #opencart
It looks like your titles are already using substr(). To shorten them just adjust the last number in the operation. This is most likely found in the conroller for your list, module, feed, or other area. These are found in yourstore/catalog/controller/ in whatever folder is applicable. So find the controller file you need and look for the title var or whatever is making product titles.
For example, it may look something like this in one of those controllers:
What does it mean?
- Cut the output of $result['name'] off when i say
- Start from 0 which is the first char
- Count 100 chars of $result['name'] then stop
- Only output 100 chars of $result['name']
By changing the 100, it changes the chars it outputs from the string/title. So if you enter 50, it will make your titles half as long. Keep in mind, each area of display probably has its own controller, so adjust it everywhere
For example, it may look something like this in one of those controllers:
Code: Select all
substr($result['name'], 0, 100)
- Cut the output of $result['name'] off when i say
- Start from 0 which is the first char
- Count 100 chars of $result['name'] then stop
- Only output 100 chars of $result['name']
By changing the 100, it changes the chars it outputs from the string/title. So if you enter 50, it will make your titles half as long. Keep in mind, each area of display probably has its own controller, so adjust it everywhere
https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.
Dhaupin wrote:It looks like your titles are already using substr(). To shorten them just adjust the last number in the operation. This is most likely found in the conroller for your list, module, feed, or other area. These are found in yourstore/catalog/controller/ in whatever folder is applicable. So find the controller file you need and look for the title var or whatever is making product titles.
For example, it may look something like this in one of those controllers:What does it mean?Code: Select all
substr($result['name'], 0, 100)
- Cut the output of $result['name'] off when i say
- Start from 0 which is the first char
- Count 100 chars of $result['name'] then stop
- Only output 100 chars of $result['name']
By changing the 100, it changes the chars it outputs from the string/title. So if you enter 50, it will make your titles half as long. Keep in mind, each area of display probably has its own controller, so adjust it everywhere
thank you so much thanks
Who is online
Users browsing this forum: Google [Bot] and 332 guests