News:

Looking for documentation? Take a look on our wiki

Main Menu

Show number of products in a category.

Started by bmw2182, May 03, 2012, 17:36:30 PM

Previous topic - Next topic

bytelord

Hello,

Yes this is normal because the joomla_folder\administrator\components\com_virtuemart\models\category.php file have been re-written from the new version. You cannot override the core files. So please re-add the functions on my previous post again inside the file around line 375

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

kanbosk


ravi

hello evry one i am new1 over here ....  i am using joomla 2.5 and virtumart 2.0.14 and i want to get the total number of product under one category in mu default view of category ..,, plz any1 help..... how to get total number of product.......... from countproduct() i want it in default.php of category....

bytelord

#33

@ravi

If you don't use multivendor please use these 2 lines on the same post: http://forum.virtuemart.net/index.php?topic=102174.msg366816#msg366816
Follow the instructions please and READ all the thread a little bit better to cover your questions.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

binarix

I tried that.. No luck

<div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">

               <div class="spacer">

                  <h2>

                     <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">

                        <?php echo $category->category_name ?>
                     <?php // if ($category->ids) {

                        echo '<span class="category_image">' . $category->images[0]->displayMediaThumb("",false) . '</span>';

                     //} ?>
                                     <!-- this was added to show the number of products in the category -->
                  <?php $categoryModelkaraoke= VmModel::getModel('category');
                  echo $categoryModelkaraoke->countProducts($category->virtuemart_category_id ); ?>
                  
                     </a>

                  </h2>

               </div>

            </div>

I have attached the code here as well. its not working.. Can you please help

bytelord

Hello,

Please tell me your vm2 version, where did you attach this file? Did you create a template override?
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

binarix

my VM version is 2.0.12f

I override the template category.php as well as the default.php in core joomla category folder


bytelord

Hello,

Template category.php?? and also default.php in core joomla category folder!~!

Quote from: bytelord on November 02, 2012, 14:35:28 PM
But please make a template override for that and do not edit the vm default theme because after a vm upgrade you will the changes.
to make a template override just copy the file joomla_folder\com_virtuemart\views\category\tmpl\default.php to joomla_folder/template/your_joomla_template/html/com_virtuemart/category/default.php
but, did you use already template overrides so you should edit the file joomla_folder/template/your_joomla_template/html/com_virtuemart/category/default.php that already exists???

The actual code for Children categories:

<?php $categoryModelkaraokeVmModel::getModel('category');
      echo 
'('.$categoryModelkaraoke->countProducts($category->virtuemart_category_id ).')'?>


The above will return Chrilder_category name (x_number_of_products)

Some more information regarding templates:

template overrides: http://forum.virtuemart.net/index.php?topic=98505.0
Using the template system: http://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_template_system.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

binarix

If its overridden it wont do any difference. But I have remove the core modifying thing.

But still no luck.

Can you please help

binarix

Unfortunately I cant update the Virtuemart as the template I have is cannot support for new versions

bytelord

Hello,

i cannot give you instructions for the specific template you are using because it could be use it's own framework that i am not aware. The code snippets here is working great for users using their own template overrides and for the most commercial templates. Without more information i cannot help you. The only thing is to place that code inside category view after the <?php echo $category->category_name ?>

In your code example:

<div class="category floatleft<?php echo $category_cellwidth $show_vertical_separator ?>">

               <div class="spacer">

                  <h2>

                     <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">

                        <?php echo $category->category_name ?>
                     <!-- this was added to show the number of products in the category -->
                 <?php $categoryModelkaraokeVmModel::getModel('category');
                  echo 
'('.$categoryModelkaraoke->countProducts($category->virtuemart_category_id ).')'?>

                     <?php // if ($category->ids) {

                        
echo '<span class="category_image">' $category->images[0]->displayMediaThumb("",false) . '</span>';

                     
//} ?>

                                 
                     </a>

                  </h2>

               </div>

            </div>


This should work fine from version 2.0.6 to 2.0.14

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

binarix

I am using istore template and Helix framework.

can I send you a private message with the webaddress as its not good to spam in here.

Thanks for replying for my messages even..

bytelord

Hello,

Sorry i could not work on your template, you should ask support from them, i am not aware how the helix framework is working and also the vm2 template. That solution is working for everyone with third party or not templates.
http://forum.virtuemart.net/index.php?topic=108212.0

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

binarix

Thanks a lot.

I dont think i will get support from those people. When I need help they asked me just to install Template quickpack rather than helping to solve the issue.

even their Quick pack was not working :(

Anyway thanks a lot

bytelord

#44
Hello,

Sorry for hearing that, at least they could told you where the joomla/vm overridden files are been located.

So you have to locate the overridden file category/default.php. Try to look under:

joomla_root_folder/templates/helix_template/html/com_virtuemart/category/default.php

i download also helix framework to take a look and as i see is a plugin, didn't install it, but please take a look under the following:
joomla_root_folder/plugins/system/helix/html/com_virtuemart/category/default.php

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!