Displaying other products from category

  • Posts: 25
  • Thank you received: 1
10 years 9 months ago #141618

Hi, I need to display in my template, on the product detail page, a list of products from the same category. Is there a specific module to do this? Or do I have to code?

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : x.x.x
-- Joomla version -- : x.x
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

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

  • Posts: 2
  • Thank you received: 0
10 years 9 months ago #141619

I think I'm having the same issue. When a user clicks on the category name, I want only the products in that category to appear. Haven't been able to figure out how to do it with filters.

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

  • Posts: 12953
  • Thank you received: 1778
10 years 9 months ago #141644

Hi,

@acwilan :
A solution can be to use a related products module, You'll find more information about this through this thread .

@kathleyne :
Can you give me more information about the issue that you are having, and show me how did you configured your category listing and its associated module through some screenshots for example ?

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

  • Posts: 2
  • Thank you received: 0
10 years 9 months ago #141737

Sure, here's a screen cap! I have two modules doing the same thing. They are both set up to be Category modules. They list categories of product that contain product. When I click on one of the categories, they next page shows all of my product rather than taking me to the product within the category I've clicked on.

I've tried using a filter, and used every setting option I can find.

Attachments:

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

  • Posts: 25
  • Thank you received: 1
10 years 9 months ago #141784

Yes, the problem is that my customer doesn't want to enter manually one-by-one each product related to other products. So in the meantime he wants to display the related products module, and if it doesn't has related products, display other products from the same category. What I'm trying to do in the `show_default.php` template of the `product` view is something like this:

    <div class="shop-product-related">
        <div class="shop-title-container">
            <h1>
                Related Products
            </h1>
<?php 
$html = $renderer->render('product-related-products', array('style' => 'default'), null); 
if (empty($html)) {
    $html = $renderer->render('category-products', array('style' => 'default'), null); 
}
echo $html;
?>
        </div>
    </div>

But I don't know how to render a "other products from this same category" module. So I was thinking there must be something like:
$catClass = hikashop_get('class.category');
$category = $catClass->get($this->element->category_id);
$products = $category->getProducts();
foreach ($product in $products) {
  if ($product->product_id != $this->element->product_id) {
.....
  }
}

Is it possible?

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

  • Posts: 25
  • Thank you received: 1
10 years 9 months ago #141785

This might be helpful. I'll give it a shot.

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

Time to create page: 0.089 seconds
Powered by Kunena Forum