Button to change category list

  • Posts: 4
  • Thank you received: 0
9 years 11 months ago #182560

Hi,

How can I create a button in a category list, for example, that allow me to choose to show all the products in the category or to show the subcategories that cotains that products?

Thanks.

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

  • Posts: 2143
  • Thank you received: 747
9 years 11 months ago #182572

Hi,

No offence, but the subject of your post is slightly misleading... it seems you don't want to "change" the category listing with an additional button, but just display the category contents.

First, the category title (and image, if existing) should work as links to the content. Correct? Or having trouble with it?

Next, if you prefer adding a button in addition to this, it's pretty simple and requires only basic knowledge of HTML and an open mind to reading and copying some PHP code:

  1. Study the documentation here .
  2. In the HikaShop backend, via -> Display -> Views, find and open the "category / listing_img_title" (or whichever type of view you're using) for your frontend template.
  3. Add the code for your button where you prefer it to show, probably as an <a> element with the usual button classes.
  4. For the href="" part, copy and paste the PHP link part from elsewhere in the same file.
  5. Save, and test by reloading your site in the frontend.

Should work just fine.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 4
  • Thank you received: 0
9 years 11 months ago #182579

Sorry but it's difficult to me to explain in english.

What I want is a button in the SUBcategories list of a parent category, that show the full list of products within the parent category.

Thanks.

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

  • Posts: 2143
  • Thank you received: 747
9 years 11 months ago #182584

Pretty much everything is possible, and so is this. Only, it's a bit trickier and, other than editing a different view, it requires more work and definitely more PHP knowledge for adding the code. If you're not capable yourself, you may want to hire a developer to do it for you.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 11 months ago #182599

Hi,

A simple solution would be to create a products listing menu item for each category via the Joomla menu manager and add the link to it in a custom category field that you would create via the menu Display>Custom fields (it requires the Essential or the Business edition). Then, you could just add such code in the "listing" file of the view "category" in order to add a link to the menu item with the products:
<?php if(!empty($this->element->custom_field)) echo '<a href="'.$this->element->custom_field.'">Products of the category</a>'; ?>
where you would replace "custom_field" with the column name of your custom category field.

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

Time to create page: 0.078 seconds
Powered by Kunena Forum