Add short descriptions under products in listings

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1331

Hello again,

Our website is nearly complete. However, I would like to know if or how I can add short descriptions under my products when I am viewing a product listing. It would also be great if I could add a Read more... button at the end of the short descriptions.

The reason we would like to do this is because we are worried that our customers may not immediately realize that clicking on a product will simply show it in more detail, rather than actually purchasing it.

Thanks for your time,
-Redeemer

EDIT: A small 'Details' button would do the trick too, if that's possible.

Last edit: 14 years 2 weeks ago by Redeemer.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1334

Hi,

You can go in Display->Views and search for "listing_img". There you will have several files that you can customize. It depends on the option "item layout" of your menu/module. Suppose that you use the default one, "image and title", you will have to edit the listing_img_title.php file.
There, you will be able to modify the HTML the way you want. If you just want to display a button below the name of the product you can add the code

echo '<br /><input type="submit" class="button" name="Details" value="Details" onClick="window.location=\''.$link.'\'"/>';
just after the code
echo $this->row->product_name;
near line 20.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1337

Well, I did what you suggested and indeed the results are good... But I would also like it if the Details button appeared in product modules, too. For some reason this isn't happening, although I added the code to the products->listing_img_title.php script.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1339

Like I said, maybe you use another item layout than listing_img_title ? In which case, you will have to edit the corresponding view file. Maybe listing_title ? If you do a screenshot of the options of your module, I would be able to tell you which one to modify.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1340

I've attached an image file that shows the Hikashop module properties for a "Latest Products" module I have:

Attachments:
Last edit: 14 years 2 weeks ago by Redeemer.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1344

Your options are good. There is no reason for the button not to be displayed.
Could you give a link of the problem ?

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1359

Sorry, I'm building my website offline. It's being hosted in a VM that's hidden in our intranet.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1362

Then try to make the modification into all the listing_img files the listing_title file. That's got to be one of them.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1363

I've tried adding the button to several of the views, but none of these additions seemed to have solved the problem. :huh:

This is very strange...

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1364

Maybe you could make a screenshot of the whole page where you have the problem ?

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1368

The problem occurs on any module regardless of view type except for my 'Product Listing' page.

Here's a screenshot of the listing page with the desired results...

Attachments:

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1370

And here's a screenshot of the frontpage, where you can clearly see that the 'Latest Products' module is missing 'Details' buttons.


The same problem shown above also occurs when I look at a list of products under a specific product category.

Attachments:
Last edit: 14 years 2 weeks ago by Redeemer.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1386

I'm out of ideas. The lsiting of products on both screenshots uses the same file listing_img_title.php
So, if you changed the code as I said, you should get the same result.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1387

Ok, here's my entire listing_img_title.php file...

<?php
/**
 * @package		HikaShop for Joomla! 1.5
 * @version		1.3.2
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php $link = hikashop::completeLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway);?>
<div style="height:<?php echo $this->image->main_thumbnail_y;?>px;text-align:center;clear:both;" class="hikashop_product_image">
	<?php if($this->params->get('link_to_product_page',1)){ ?>
		<a href="<?php echo $link;?>">
	<?php }
		echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->product_name));
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>
</div>
<?php
if($this->params->get('show_price')){
	?><br/><?php 
	$this->setLayout('listing_price');
	echo $this->loadTemplate();
} 
?><br/>
<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;
		echo '<br /><input type="submit" class="button" name="Details" value="Details" onClick="window.location=\''.$link.'\'"/>';
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>
</span>
<?php 
if($this->params->get('add_to_cart')){
	?><br/>
	<form action="<?php echo hikashop::completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->row->product_id.'_'.$this->params->get('main_div_name'); ?>"><?php 
		$this->setLayout('quantity');
		echo $this->loadTemplate();
		?>
		<input type="hidden" name="product_id" value="<?php echo $this->row->product_id; ?>" />
		<input type="hidden" name="add" value="1"/>
		<input type="hidden" name="ctrl" value="product"/>
		<input type="hidden" name="task" value="updatecart"/>
	</form><?php 
}?><?php
/**
* @package HikaShop for Joomla! 1.5
* @version 1.3.2
* @author hikashop.com
* @copyright (C) 2010 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?>
<?php $link = hikashop::completeLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway);?>
<div style="height:<?php echo $this->image->main_thumbnail_y;?>px;text-align:center;clear:both;" class="hikashop_product_image">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">
<?php }
echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->product_name));
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</div>
<?php
if($this->params->get('show_price')){
?><br/><?php
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
?><br/>
<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;
echo '<br /><input type="submit" class="button" name="Details" value="Details" onClick="window.location=\''.$link.'\'"/>';
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</span>
<?php
if($this->params->get('add_to_cart')){
?><br/>
<form action="<?php echo hikashop::completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->row->product_id.'_'.$this->params->get('main_div_name'); ?>"><?php
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
<input type="hidden" name="product_id" value="<?php echo $this->row->product_id; ?>" />
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="ctrl" value="product"/>
<input type="hidden" name="task" value="updatecart"/>
</form><?php
}?>

I put the code snippet you made on line 34.

Perhaps this will be helpful to you.

Last edit: 14 years 2 weeks ago by Redeemer.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1388

That code is fine.

I was expecting that, otherwise, it wouldn't display the details button anywhere.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1396

Well, I need this to be done, and I don't have much skill when it comes to PHP, so...

Does anyone have any ideas?

EDIT: I noticed earlier today that I can put <Read More> tags in product descriptions, but they don't seem to do anything.

Perhaps it would be a good idea to make these tags functional, so that you can set a product to appear with part of it's description in a list... And when you press the 'Read more' button, it takes you to the product page.

Last edit: 14 years 2 weeks ago by Redeemer.

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1397

I was thinking again about that problem...
Maybe it could come from a caching issue ? If you cache the modules content on your website that's something which could happen since the HTML was already generated, you would not see your modification on the modules. You could easily check that by changing the color of the module background in the options of the module. If it doesn't change when displaying the module, then it's likely that it's a caching problem.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1410

Hi,

Sorry, I've tried clearing my cache to solve the problem... The problem doesn't seem to lie there, either.

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

  • Posts: 36
  • Thank you received: 0
14 years 2 weeks ago #1483

Ok, I solved the issue for myself. Here was the problem:

For whatever reason, there are TWO listing_img_title.php files that hikashop uses. One is kept under the template you are using, in my case "rhuk_milkyway":
/templates/rhuk_milkyway/html/com_hikashop/product/listing_img_title.php

This one can be edited right through the Display->Views menu in the back-end of your Joomla! installation.

The second file is kept in:
/components/com_hikashop/views/product/tmpl/listing_img_title.php

For whatever reason, the Product Listing component uses the first one, but all other modules use the second.

It is my guess that they use two files because one is needed for template-specific layouts, and one is needed for generic modules.

At any rate, if you want a 'Details' button, or any other modification, to appear no matter if the products are appearing as the content or as a module, you must make the changes to BOTH files.

So, thanks for your help anyway, Nicolas; it was your code that helped me accomplish this in the first place. ;)
-Redeemer

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

  • Posts: 82908
  • Thank you received: 13378
  • MODERATOR
14 years 2 weeks ago #1485

Hum. Interesting. Normally, the file in the template should always be used by joomla if there and the other one ignored. That's the principle of the override of views in joomla. Be it in a module or as main component. It's strange that it's not the case on your website.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum