- Posts: 8
- Thank you received: 0
Incorrect "number of products"
14 years 5 months ago #47519
by pjaaar
Incorrect "number of products" was created by pjaaar
Hi,
Joomla version: 2.5.4
HikaShop version: 1.5.7
Here is the catalogue structure I use:
Category 1
-- Category 1.1
-- Category 1.1.1 (5 products here)
-- Category 1.1.2 (5 products here)
-- Category 1.2
-- Category 2.1.1 (5 products here)
-- Category 2.1.2 (5 products here)
I got an incorrect number of products at the first level (I'm talking about a category listing), I got this:
Category 1 (0)
-- Category 1.1 (0)
-- Category 1.2 (0)
Finally, at a second level, I got correct results:
Category 1.1 (10)
-- Category 1.1.1 (5)
-- Category 1.1.2 (5)
How can I change the query to make that the number of products across the categories is correct?
Sry for ma bad language,
Thx in advance
Joomla version: 2.5.4
HikaShop version: 1.5.7
Here is the catalogue structure I use:
Category 1
-- Category 1.1
-- Category 1.1.1 (5 products here)
-- Category 1.1.2 (5 products here)
-- Category 1.2
-- Category 2.1.1 (5 products here)
-- Category 2.1.2 (5 products here)
I got an incorrect number of products at the first level (I'm talking about a category listing), I got this:
Category 1 (0)
-- Category 1.1 (0)
-- Category 1.2 (0)
Finally, at a second level, I got correct results:
Category 1.1 (10)
-- Category 1.1.1 (5)
-- Category 1.1.2 (5)
How can I change the query to make that the number of products across the categories is correct?
Sry for ma bad language,
Thx in advance
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47681
by nicolas
Replied by nicolas on topic Re: Incorrect "number of products"
Hi,
Try to download again the package from our website and install it again over your current hikashop. We made some changes which should avoid that.
If that doesn't solve the problem, please provide more information on how to reproduce the problem like screenshots of the options of your module/menu.
Try to download again the package from our website and install it again over your current hikashop. We made some changes which should avoid that.
If that doesn't solve the problem, please provide more information on how to reproduce the problem like screenshots of the options of your module/menu.
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47822
by pjaaar
Replied by pjaaar on topic Re: Incorrect "number of products"
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47940
by nicolas
Replied by nicolas on topic Re: Incorrect "number of products"
Please change the file administrator/components/com_hikashop/classes/category.php by the one in the archive enclosed and it should solve the problem.
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47981
by pjaaar
Replied by pjaaar on topic Re: Incorrect "number of products"
First, thx a lot for your help, the pb still not resolved 
Here is the reality in the back end:
Category 1: 0 object
Category 1.1: 0 object
Category 1.1.1: 1 object
Category 1.1.2: 2 objects
Category 1.2: 0 object
Category 1.2.1: 18 objects
Category 1.2.2: 8 objects
Category 2: 15 objects
Category 2.1: 4 objects
With the version 1 of category.php I had these results in the front end:
First level:
Category 1: 0 object (wrong)
Category 1.1: 0 object (wrong)
Category 1.2: 0 object (wrong)
Category 2: 19 objects (correct)
Category 2.1: 4 objects (correct)
Second levels are fine.
With the version 2 of category.php I had these results:
First level:
Category 1: 0 object (wrong)
Category 2: 19 objects (correct)
Category 2.1: 4 objects (correct)
Second levels are fine.
I want:
First level:
Category 1: 29 objects (count of all products in sub categories...)
Category 1.1: 3 object
Category 1.2: 26 object
Category 2: 19 objects
Category 2.1: 4 objects
Here is the reality in the back end:
Category 1: 0 object
Category 1.1: 0 object
Category 1.1.1: 1 object
Category 1.1.2: 2 objects
Category 1.2: 0 object
Category 1.2.1: 18 objects
Category 1.2.2: 8 objects
Category 2: 15 objects
Category 2.1: 4 objects
With the version 1 of category.php I had these results in the front end:
First level:
Category 1: 0 object (wrong)
Category 1.1: 0 object (wrong)
Category 1.2: 0 object (wrong)
Category 2: 19 objects (correct)
Category 2.1: 4 objects (correct)
Second levels are fine.
With the version 2 of category.php I had these results:
First level:
Category 1: 0 object (wrong)
Category 2: 19 objects (correct)
Category 2.1: 4 objects (correct)
Second levels are fine.
I want:
First level:
Category 1: 29 objects (count of all products in sub categories...)
Category 1.1: 3 object
Category 1.2: 26 object
Category 2: 19 objects
Category 2.1: 4 objects
Please Log in or Create an account to join the conversation.
14 years 5 months ago #48031
by nicolas
Replied by nicolas on topic Re: Incorrect "number of products"
Sure I understand what you want. We don't have the problem anymore on our end with that file.
Are you sure that you uploaded it properly on your website ?
Are you sure that you uploaded it properly on your website ?
Please Log in or Create an account to join the conversation.
14 years 4 months ago #49136
by pjaaar
Replied by pjaaar on topic Re: Incorrect "number of products"
Yeah I'm pretty sure 
Can u tell me what modifications you made?
Can u tell me what modifications you made?
Please Log in or Create an account to join the conversation.
14 years 4 months ago #49209
by nicolas
Replied by nicolas on topic Re: Incorrect "number of products"
I changed the code:
to:
in that file.
Code:
foreach($element as $k => $v){
$element[$k]=(int)$v;
}
$filters[] = 'a.category_parent_id IN ('.implode(',',$element).')';
$this->type=0;
Code:
if($all){
$this->database->setQuery('SELECT category_left,category_right FROM '.hikashop_table('category').' WHERE category_id IN ('.implode(',',$element).')');
$leafs = $this->database->loadObjectList();
$conditions = array();
foreach($leafs as $v){
$conditions[] = '(a.category_left > '.$v->category_left.' AND a.category_right < '.$v->category_right.')';
}
$filters[] = '('.implode(' OR ',$conditions).')';
$this->type=0;
}else{
foreach($element as $k => $v){
$element[$k]=(int)$v;
}
$filters[] = 'a.category_parent_id IN ('.implode(',',$element).')';
$this->type=0;
}
Please Log in or Create an account to join the conversation.
14 years 4 months ago #49419
by pjaaar
Replied by pjaaar on topic Re: Incorrect "number of products"
In category / listing_img_title.php
What Defines number_of_products? Where is it defined?
Code:
<span class="hikashop_category_name">
<a href="<?php echo $link;?>">
<?php
echo $this->row->category_name;
if($this->params->get('number_of_products',0)){
echo ' (error here for category #33'.$this->row->number_of_products.')';
}
?>
</a>
</span>
What Defines number_of_products? Where is it defined?
Please Log in or Create an account to join the conversation.
14 years 4 months ago #49457
by nicolas
Replied by nicolas on topic Re: Incorrect "number of products"
$this->params->get('number_of_products',0) comes from the option "Show the number of products" of the listing module.
$this->row->number_of_products is calculated in the file
omponents/com_hikashop/views/category/view.html.php
$this->row->number_of_products is calculated in the file
omponents/com_hikashop/views/category/view.html.php
Please Log in or Create an account to join the conversation.
14 years 4 months ago - 14 years 4 months ago #49468
by pjaaar
Here is the result in mysql:
I debugged the file components/com_hikashop/views/category/view.html.php line #183 - #187
Note: in the id's, #47 is a sub category of #35 and results are fine but #31 has two sub categories (#38 & #39) and the results are going wrong (0)
Replied by pjaaar on topic Re: Incorrect "number of products"
Code:
SELECT count(a.product_id) AS number_of_products,a.category_id FROM #__hikashop_product_category AS a INNER JOIN #__hikashop_product AS b ON a.product_id=b.product_id AND b.product_published>0 WHERE a.category_id IN (29,30,31,32,33,35,46,47) GROUP BY a.category_id
Here is the result in mysql:
Code:
number_of_products category_id
6 29
2 30
2 32
1 33
15 35
1 46
4 47
I debugged the file components/com_hikashop/views/category/view.html.php line #183 - #187
Note: in the id's, #47 is a sub category of #35 and results are fine but #31 has two sub categories (#38 & #39) and the results are going wrong (0)
Last edit: 14 years 4 months ago by pjaaar.
Please Log in or Create an account to join the conversation.
14 years 4 months ago - 14 years 4 months ago #49472
by pjaaar
Replied by pjaaar on topic Re: Incorrect "number of products"
So, I gave up.
I moved all the products in a new set of categories (the same structure as the first one :S ) & it works.
But thx for your time
I moved all the products in a new set of categories (the same structure as the first one :S ) & it works.
But thx for your time
Last edit: 14 years 4 months ago by pjaaar.
Please Log in or Create an account to join the conversation.
Time to create page: 0.221 seconds