More Products by this artist

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24857

Nope, this is the code:


$pathway = JRequest::getInt('category_pathway',0);
if(empty($pathway)){
//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 DESC LIMIT 1';
$database->setQuery($query);
$pageInfo->filter->cid = $database->loadResultArray();
}

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24862

Nicholas,

Maybe the problem lies somewhere else. With some products the artists shows beneath the product category even when the id of the artist is 40 and the id of the product category is 42.

However in the same group I have a product where the artist id is 29 and the product category id 42.

From this product I deleted both the artist and the product category and then added the product category first and the artist second. The artist still shows before the product.

Is this normal or is this the cause of the problem.

Gert.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #24869

It looks like the problem yes. You need to add the categories to your products in the correct order. It's more related to the id of the categories.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24872

I am adding the categories to the products in the correct order. But the problem is that in some cases, even when I add the artist category after the product category, it still shows the artist as the first category. As I said before, it does this for some products, not all.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #24875

You need to remove the categories you added to the product, save the product and then add back the categories to the product. Otherwise, if you do the same thing without saving in the middle, the links to the categories are not destroyed and not recreated, which it why you still have the old order.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24876

I did the following:

1. Delete both categories from the product.
2. Save the product.
3. When I reopen the product the system has added a category product groups.
4. Added the correct product group
5. Save the product
6. Delete the category product groups added by the system in step 3
7. Save the product
8. Add the correct artist category.
9. Save the product.

Now when I reopen the product the artist is still the first category and the product group the second.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24941

Nicholas,

Any idea how to solve this?

Gert.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #24948

Mmm. I don't see why it wouldn't work.
We didn't change anything on that end. Are you sure that you reapplied the modification after the update ?

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #24972

Yes, I did apply the modification. But I don't think the problem is with the modification.

I think the problem is that for some products I am unable to get the artist as the second category. See my earlier post:


Re: More Products by this artist 3 Days, 5 Hours ago
I did the following:

1. Delete both categories from the product.
2. Save the product.
3. When I reopen the product the system has added a category product groups.
4. Added the correct product group
5. Save the product
6. Delete the category product groups added by the system in step 3
7. Save the product
8. Add the correct artist category.
9. Save the product.

Now when I reopen the product the artist is still the first category and the product group the second.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #25015

I cannot reproduce what you're describing.

Each time I add a category to a product, the category gets added with a greater product_category_id.

Now, if you're talking only about the display on the back end, it is indeed ordered on the category_id, but not for your modified query which is based on the product_category_id and thus should not have the problem.

The order on the category listing of the products is done by:
$query = 'SELECT b.* FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('category').' AS b ON a.category_id=b.category_id WHERE a.product_id = '.$product_id.' ORDER BY b.category_ordering';
and should be:
$query = 'SELECT b.* FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('category').' AS b ON a.category_id=b.category_id WHERE a.product_id = '.$product_id.' ORDER BY a.product_category_id';
in adminsitrator/components/com_hikashop/views/product/view.html.php o that the categories are always displayed in the order they are added. However, as I said above, that doesn't change the fact that they are in the correct order in the database.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #25038

Nicholas,

I tested it again after your last message and it's working now.

Must have been a browser cache problem. Thanks for your help.

Gert.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #25313

Hi Nicholas,

Once more I cheered too early. I still cannot get it to work. I even removed the artist from all products and added them again after saving each product.

Could you please have a look at the site to see what's wrong?

Thanks,

Gert.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #25320

Could you give an FTP and database access so that we can check the data in the table and the modification you made in the files ?

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #25338

Just send to you by email. Thanks!

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 2 months ago #25340

The problem indeed didn't came for the order of categories. It was that the category_pathway was somehow set and thus skipping the query all together on the listing of products from the same artist.

The solution is simple. Just change the line:
if(empty($pathway)){
to:
if(true){

in the same file just before the query you changed.

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

  • Posts: 86
  • Thank you received: 0
13 years 2 months ago #25349

Hi Nicholas,

Yes. Now it really works. Thanks so much!

Gert.

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

  • Posts: 13
  • Thank you received: 1
13 years 2 months ago #25377

can you show us a screenshot of your system?

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

Time to create page: 0.091 seconds
Powered by Kunena Forum