Display all products under the sub-categories of the current category too VM2

Started by vanaveno, February 11, 2012, 09:21:41 AM

Previous topic - Next topic

slipperyman

Quote from: Ninjab on August 11, 2013, 11:58:52 AM
getting rid of the parent category image is not the problem, I can do that.

I need this layout:

Category Title (sleeves)
         1st Sub Category Title (iPad)
                Product 1    Product 2    Product 3

         2nd Sub Category Title (iPad mini)
                Product 1    Product 2    Product 3

So far the current layout is the sub categories at the top. And they do not list any products under them.

Did you ever achieved this?

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

If you want help at a bare minimum try to give full information

QuoteDoes this still go for VM3?

Do u think that is a clear question? In this thread apart from totally unhelpful posts like  "that worked - thanks" (what worked?) there are about 3 suggested solutions and ideas

So your questions refer to what exactly?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

treodude

Hi GJC,

Sorry for wasting your time, the problem is no longer relevant.

I got things messed up after a long day, my fault.

ablaye90

Salam
after i do the hack i can't sort by manufacturer
any idea ???
thx

Eireann75

I just wanted to confirm that this CORE HACK still works in VM 3.0.12 on J! 3.4.5. Also it still is not possible to view manufacturers with this hack – which is only a small let-down in my case.

Why is this solution better than assigning each product to its parent category (there still is a working plugin doing that for you in VM3)? Because of SEO. With this hack you get fewer and more consistent URL to your product.

Quote from: franci77 on March 15, 2013, 15:56:02 PM
Don't know if topic is obsolete, but here is the working code for the latest version of Virtuemart.

After the setKeyWord function in \administrator\components\com_virtuemart\models\product.php place:


function untreeCat($vm_catid, &$ccont){
$db = JFactory::getDBO();
$query = 'SELECT `category_child_id` FROM `#__virtuemart_category_categories` WHERE `category_parent_id`="'.$vm_catid.'"';
$db->setQuery($query);
$db->query();

$rows = $db->loadRowList();
if (empty($rows)) {
return;
} else {
foreach($rows as $row) {
array_push($ccont, $row[0]);
$kat = $row[0];
$this->untreeCat($kat, $ccont);
}
}
}


Then search for this:


if ($virtuemart_category_id > 0) {
$joinCategory = TRUE;
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
}


... and replace it with following:


if ($virtuemart_category_id > 0){
$joinCategory = TRUE ;
$catscont = array();
$this->untreeCat($virtuemart_category_id, $catscont);
$qkat = ' `pc`.`virtuemart_category_id` IN('.$virtuemart_category_id;
foreach ($catscont as &$kat){
$qkat .= ', '.$kat;
}
$qkat .= ')';
$where[] = $qkat;
}


Best regards,
franci77

scotous

Hi,

This cannot be confirmed for VM 3.0.12 on Joom 3.4.5 as the product.php itself has different code:

The old if ($virtuemart_category_id > 0) {
$joinCategory = TRUE;
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
}

has now changed to

if ($virtuemart_category_id > 0) {
$joinCategory = TRUE;
if(true){
$where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
} else {
/*GJC add subcat products*/
$catmodel = VmModel::getModel ('category');
$childcats = $catmodel->getChildCategoryList(1, $virtuemart_category_id,null, null, true);
$cats = $virtuemart_category_id;
foreach($childcats as $childcat){
$cats .= ','.$childcat->virtuemart_category_id;
}
$joinCategory = TRUE;
$where[] = ' `pc`.`virtuemart_category_id` IN ('.$cats.') ';
}
} else if ($isSite) {
if (!VmConfig::get('show_uncat_parent_products',TRUE)) {
$joinCategory = TRUE;
$where[] = ' ((p.`product_parent_id` = "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` > "0") ';
}
if (!VmConfig::get('show_uncat_child_products',TRUE)) {
$joinCategory = TRUE;
$where[] = ' ((p.`product_parent_id` > "0" AND `pc`.`virtuemart_category_id` > "0") OR p.`product_parent_id` = "0") ';
}
}


Eireann75 how did you make it work?

Kind Regards
Theo

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

wicko

Not a helpful reply and the link certainly does not lead to an answer.
Designing and maintaining Joomla websites since 2007

Rune Rasmussen

Quote from: scotous on December 10, 2015, 13:37:43 PM
This cannot be confirmed for VM 3.0.12 on Joom 3.4.5 as the product.php itself has different code:

Simply replace the new block of code, and it will work. That solution offered in the new code doesn't load products from all sub categories, so I still prefer the old one.
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

virtumartuser

Hi,
after "Surely this is possible? Can someone please help with this?" by Ninjab
and  "Thank you much for this solution, is working like a char  ;)." by Mana
but the solution is not given . can you give the solution like :

the above product to show on front end in joomla :
clicking on "+" will show the list of products as  and clicking on (-) will hide .

Category Title (sleeves)
       (-)  1st Sub Category Title (iPad)
               ----- Product 1
               -----Product 2   
              ------Product 3

        (+) 2nd Sub Category Title (iPad mini)
              (  Product 1   
                 Product 2   
                 Product 3) this products will be hidden
on rollover product 1,or 2 or 3 display product information with image and clicking on product will show full content.

Thanks,
               


matevzp2