How to show Details button in hikashop Product listing

  • Posts: 159
  • Thank you received: 0
6 years 8 months ago #276819

Hi, i want to make a button in product listing page. how to show a button of Details instead of Add to Cart. i want users to go to Product page when Details button is pressed.

Thank you in advance

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

  • Posts: 4519
  • Thank you received: 611
  • MODERATOR
6 years 8 months ago #276833

Hello,

That will required to create an override view on your view listing_div,table or list (link to your item menu display configuration), that will required some html & php knowledge.
For start what you can do, is to switch off the add to cart button, and create an new one with the same class (in order to keep the css of the "add to cart" button) and add in part that start with :

<div class="hkc-md-<?php echo (int)$span; ?> hikashop_product hikashop_product_column_<?php echo $current_column; ?> hikashop_product_row_<?php echo $current_row; ?>">
			<div class="hikashop_container">
				<div class="hikashop_subcontainer <?php echo $this->borderClass; ?>">
this kind of code at the end of the last <div> :
// Create the url link for each product page in php :
$link = hikashop_contentLink('product&task=show&cid=' . (int)$this->row->product_id . '&name=' . $this->row->alias . $this->itemid . $this->category_pathway, $this->row);
 // Button display in html :
<a class="css_button  css_button_cart" href="<?php echo $link;?>">Details</a>
For more details, see this documentation to learn how to custom front-end display

Hope you will succeed to get what you needs.

Regards

Last edit: 6 years 8 months ago by Philip.
The following user(s) said Thank You: Shafan Hameed

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

  • Posts: 159
  • Thank you received: 0
6 years 8 months ago #276913

Ok.. Got it.. Thank you so much

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
5 years 2 weeks ago #305679

I can't get this to work. Why isn't this functionality built in? Seems VERY common to want to view products with descriptions and click button for details rather than Add to Cart without first viewing the product details.

How can I create a link to the product details page from this template?

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 2 weeks ago #305698

Hi,

By default, there is a link to the product details page for each product on the listing of products of HikaShop.
If you don't have that link, then it could be that your template has removed it.
The add to cart button on the listings is only visible if you have the "add to cart button" display setting activated under the "products options" tab of your menu item (via the Joomla menu manager).
So if you disable that setting, you'll only have left the link to the product details page. And if you don't have that link and/or if the add to cart button stays on the products listing, it means that there is some customization which doesn't take into account that setting properly.

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
5 years 2 weeks ago #305706

Yes, there is a link if you know to click on the Title of the product, but it isn't obvious. Why doesn't the system have a built in option to have a "Details" button as an option instead of having to modify templates. Can you please provide code for the link so that I can achieve my goal of having a button instead of an add to cart button. It seems so obvious to have this as an option.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 2 weeks ago #305708

Hi,

You can add such code in the product/listing_img_title.php view file via the menu Display>Views:

<a class="hikabtn" href="<?php echo $link;?>">Details</a>

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
5 years 2 weeks ago #305717

Yes, I'm familiar with how to echo a variable's value in PHP. The problem is the code to build the variable $link in this thread does not work. This is the reason that I'm looking for help in this thread as the code doesn't work! Has the syntax changed?

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 2 weeks ago #305722

Hi,

In the product/listing_img_title.php view file, there is no need to define the $link variable. If you look at the top of that view file, you can see that there is already the code to define that variable:

$link = hikashop_contentLink('product&task=show&cid=' . (int)$this->row->product_id . '&name=' . $this->row->alias . $this->itemid . $this->category_pathway, $this->row);

So the code I posted, is the code you want to use.
The code provided by Philip earlier in this thread is for another view file and I feel it's less appropriate to do the change in that other view file as it's less flexible and more complex code.

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
5 years 2 weeks ago #305738

Thank you! I still think you should add this as a configurable option.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 1 week ago #305740

Thank you for your feedback. We didn't feel it would be needed and adding it would be really easy as it's just a simple echo with an A html tag. We'll reconsider that.

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

Time to create page: 0.085 seconds
Powered by Kunena Forum