Skip to main content

Limit Title Characters on Product Listing Page

14 years 1 day ago #78857 by foxy3433
Is there a way to limit the amount of characters shown for products on the products listing page????

Please Log in or Create an account to join the conversation.

14 years 1 day ago #78893 by Jerome
Hi,

The best way is to modify the view and add a limitation where the product name is displayed (using "substr").

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

14 years 21 hours ago - 14 years 21 hours ago #79015 by foxy3433
So would i do somthing like :
Code:
<?php $rest = substr(, 0, -7); ?>
Last edit: 14 years 21 hours ago by foxy3433.

Please Log in or Create an account to join the conversation.

14 years 20 hours ago #79035 by Xavier
Hi,

Yes, something like:
Code:
<?php echo substr($this->row->product_name, 0, 7); //To display 7 characters. ?>
or do that with "$this->row->product_description", depending on what you want
Be careful, in the string "$this->row->product_description" it could be html tags.
The following user(s) said Thank You: foxy3433

Please Log in or Create an account to join the conversation.

13 years 11 months ago - 13 years 11 months ago #80123 by foxy3433
When trying to edit the product listing page

i.e

Click on a category and you see all your products in that category with add to cart button..

Which file edits this file via VIEW?
Last edit: 13 years 11 months ago by foxy3433.

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80172 by Xavier
Hi,

The view to edit is depending on your configuration, if you set a display in Div with image and title displayed, then the view is "product / listing_img_title".
The following user(s) said Thank You: foxy3433

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80198 by foxy3433
oo my Gosh why am i going on stupid Cheers Mate

Think i need sleep

Sorry for wasting you time that was a stupid question now awake had a bit of sleep

SORRY

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80216 by foxy3433
Right i now have five mins to implement the character limit

So we have product name listed here:

<!-- PRODUCT NAME -->
<span class="hikashop_product_name">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">


<?php }
echo $this->row->product_name;
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT NAME -->

I need to insert the title limit and manufactures name at the start i.e

<?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?>

Any time i input the codes i get nothing, but it works fine on show_block???

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80234 by foxy3433
<!-- PRODUCT NAME -->
<span class="hikashop_product_name">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">


<?php
echo substr($this->row->product_name, 0, 7); //To display 7 characters.
?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT NAME -->

That's the title limited Figured it out

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80239 by foxy3433
Unable to get Manufacture name in Title on Product listing page

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80240 by Xavier
Are you sure that you edit in the good view of the good template ?

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80241 by foxy3433
Ye i got the Limit working fine for the title but need the brand name to appear in Title also... Code i got won't work

<?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?>

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80256 by Xavier
I tried this code on my end, and it's working fine, try to add it just after the code:
Code:
<?php echo substr($this->row->product_name, 0, 7); //To display 7 characters. ?>

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80260 by foxy3433
Right we are confused i Sorted The Limit out i need the BRAND name to come up before title is this possible~????

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80338 by Xavier
Hi,

Yes I understood that you have solved the limit problem, and I was telling you to try to add the code:
Code:
<?php $class = hikashop_get('class.category'); $manufacturer = $class->get($this->element->product_manufacturer_id); echo $manufacturer->category_name; ?>
Before:
Code:
<?php echo substr($this->row->product_name, 0, 7); //To display 7 characters. ?>

Because I tried the code:
Code:
<?php $class = hikashop_get('class.category'); $manufacturer = $class->get($this->element->product_manufacturer_id); echo $manufacturer->category_name; ?>

And it's working fine on my end. ;)

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80363 by foxy3433
ooo ok i'll try it now cheers mate

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80405 by foxy3433
Nunno whats going on but that don't work my end, plus i have to be in the correct file as the limit is working

<!-- PRODUCT NAME -->
<span class="hikashop_product_name">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">

<?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?><?php echo substr($this->row->product_name, 0, 30); //To display 7 characters.
?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT NAME -->

You want BK-End Access to explore or url to page to view source?

Please Log in or Create an account to join the conversation.

13 years 11 months ago - 13 years 11 months ago #80454 by Jerome
Hi,
Code:
<!-- PRODUCT NAME --> <span class="hikashop_product_name"> <?php if($this->params->get('link_to_product_page',1)){ ?> <a href="<?php echo $link;?>"> <?php $categoryClass = hikashop_get('class.category'); $manufacturer = $categoryClass->get($this->row->product_manufacturer_id); echo $manufacturer->category_name; echo substr($this->row->product_name, 0, 30); ?> </a> <?php } ?> </span> <!-- EO PRODUCT NAME -->

PS : You can use the tag "code" for pasting your code, it would be easier to read :)

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Last edit: 13 years 11 months ago by Jerome.
The following user(s) said Thank You: foxy3433

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80487 by foxy3433
That worked..... Thank you..

Have we not got a MYSQL Query to just bang the brand name in title of product cause i need it on checkout and cart...

Please Log in or Create an account to join the conversation.

13 years 11 months ago #80558 by nicolas
The code is the same there too:
<?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?>

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum