- Posts: 86
- Thank you received: 0
More Products by this artist
I'm trying to show three more products from an artist on the product detail page. I thought it worked well, until I found out that when an artist doesn't have three products, some other products not from the same artist are shown.
Am I doing something wrong or is this a bug.
Please see the definition attached.
Gert.
Please Log in or Create an account to join the conversation.
You need to publish your module in the option "Modules under the product page" in the config under the tab display and not as a normal joomla module. Is that the case ?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Then it probably has something to do with the fact that I installed the latest version last Thursday. Didn't check it after that any more.
Anyway, will let you know if I find the problem somewhere else.
Thanks.
Please Log in or Create an account to join the conversation.
The problem is still there. Look at this page:
www.thaihandmadecraft.com/cms/index.php?...y_pathway=29&lang=en
You will see that there are products shown from other artists.
Gert.
Please Log in or Create an account to join the conversation.
Now I understand that you would like to see only the products of the category from which the user is coming. In order to do that, you will have to edit the file components/com_hikashop/views/product/view.html.php and change the code:
$query = "SELECT category_id FROM ".hikashop::table('product_category').' WHERE product_id='.$product_id.' ORDER BY ordering';
$database->setQuery($query);
$pageInfo->filter->cid = $database->loadResultArray();
to the code:
$pathway = JRequest::getInt('category_pathway',0);
if(empty($pathway)){
//load products in the same categories
$query = "SELECT category_id FROM ".hikashop::table('product_category').' WHERE product_id='.$product_id.' ORDER BY ordering';
$database->setQuery($query);
$pageInfo->filter->cid = $database->loadResultArray();
}else{
$pageInfo->filter->cid = array($pathway);
}
Please Log in or Create an account to join the conversation.
Working fine now!
Gert.
Please Log in or Create an account to join the conversation.
Unfortunately it's still not what I need. Now if I first go to the category artists and then select a product it goes well. But if I start from the category product categories it shows products from the product category, not from the artist.
What I need is that whereever I come from, if I display a product page, on that page I only want to see products that were made by the same artist as the product I am showing.
Any idea how I can achieve that?
Gert.
Please Log in or Create an account to join the conversation.
to the code:$query = "SELECT category_id FROM ".hikashop::table('product_category').' WHERE product_id='.$product_id.' ORDER BY ordering';
And, for all your products, the first category you add to it should be the artist category. If it's always the last, then, you should replace ASC by DESC.
//load products in the same first category
$query = "SELECT category_id FROM ".hikashop::table('product_category').' WHERE product_id='.$product_id.' ORDER BY product_category_id ASC LIMIT 1';
Please Log in or Create an account to join the conversation.
Followed your recommendations but still the same problem.
Changed your code to DESC because the artist is the second category. But it doesn't change anything.
Gert.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Not sure what you mean. What would you like to see? By the way, you can still login to the site if it helps.
Gert.
Please Log in or Create an account to join the conversation.
Solved the issue already. It was a problem in the database, not in the code.
Gert.
Please Log in or Create an account to join the conversation.
After working almost 6 months with the system I still have a problem with the above.
The problem is that if an artist has a lower id than the product category it always comes in the first place, even if i add it after the product category.
The ASC, DESC part is therefor not working.
Any other way this can be solved?
Gert.
Please Log in or Create an account to join the conversation.
Because product_category_id will order the categories with the first one being the first added in the categories of the product while category_id will order the categories with the first one being the first category created, which is what you're describing.
Please Log in or Create an account to join the conversation.