More Products by this artist

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8015

Hi Nicholas,

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.

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8029

Hi,

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.

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8234

Yes I did that.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8236

Could you give a link to your store so that we can have a look ?

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

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8751

Sorry, was in Birma for a couple of days without any internet access. I PM you the login details.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8760

Could you give an example of a page where it doesn't work like you want ?

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

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8768

Did you change anything? The page that always showed wrong is now ok!?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8769

I didn't change anything yet as I couldn't find anything wrong :p

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

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8771

Hmm,

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.

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8785

Nicolas,

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8862

Well, your product has two categories, so the module displays the products in the same categories. It's normal.

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.

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #8875

Thanks so much Nicholas,

Working fine now!

Gert.

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

  • Posts: 86
  • Thank you received: 0
13 years 9 months ago #9021

Hi Nicholas,

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #9035

In order to do that, you will have revert the previous change and 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';

to the code:


//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';

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.

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

  • Posts: 86
  • Thank you received: 0
13 years 8 months ago #9061

Hi Nicolas,

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.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 8 months ago #9064

Could you paste the code around your modifications ?

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

  • Posts: 86
  • Thank you received: 0
13 years 8 months ago #9130

Hi Nicolas,

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.

  • Posts: 86
  • Thank you received: 0
13 years 8 months ago #9132

Nicolas,

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.

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

Nicholas,

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.

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

Are you sure that you're using the code ORDER BY product_category_id ASC and not ORDER BY category_id ASC ?
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.

Time to create page: 0.080 seconds
Powered by Kunena Forum