Hiển thị các bài đăng có nhãn virtuemart. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn virtuemart. Hiển thị tất cả bài đăng

24 tháng 8 2012

Joomla 1.5 - Virtuemart - How to show product and sub categories?

When i worked with Joomla 1.5 and Virtuemart, there is a common problem that if your shop is organized with 2 categories level, the parent category doesn't show products or sub categories; the result is "Categories is empty".

I have found 1 solution from internet. You can double check at this link or below:

In administrator/components/com_virtuemart/classes/ps_product_category.php

/*
 * Returns an array of the categories ids recursively for a given category
 * untreeCat copy lashae (virtuemart forum http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=20837.0)
 * @param int $kat
  * @param int $container
 * rewritten by haselnuss (to use ps_DB class and store the function in ps_product_category.php)
 */
 function untreeCat($kat, &$container) { 
  $db = new ps_DB;
  $q = "SELECT category_child_id FROM #__{vm}_category_xref WHERE category_parent_id='$kat'"; 
  $db->query($q);
  // if it is a leaf (no data underneath it) then return 
  if (!$db->num_rows()) { 
   return; 
  } 
  //else append the result, and recurse the function (so to speak) 
  else 
  { 
   while($db->next_record()) {
     $container[] = $db->f("category_child_id");
     $kat = $db->f("category_child_id");
     $this->untreeCat($kat, $container);
    }
  }
 }  
and in administrator/components/com_virtuemart/html/shop_browse_queries.php
About line 63 change:
// Filter Products by Category
if( $category_id ) {
 if( !empty( $search_this_category ) && (!empty( $keyword ) || !empty( $manufacturer_id ) )) {
  $where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
 } elseif( empty( $keyword ) && empty( $manufacturer_id )) {
  $where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
 }
}
to:
// Filter Products by Category
/*
 * Returns an array of the categories ids recursively for a given category
 * untreeCat copy lashae (virtuemart forum http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=20837.0)
 * rewritten by Creb (to use shop.browse page detection)
 */
if( $category_id ) {
 if( !empty( $search_this_category ) && (!empty( $keyword ) || !empty( $manufacturer_id ) )) {  
  $where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id; 
 } elseif( empty( $keyword ) && empty( $manufacturer_id )) {
 
 if ($_GET["page"]=="shop.browse") { 
     //$where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
 $kategoriListesi = array();
 $ps_product_category->untreeCat($category_id, $kategoriListesi);
 $qkat = " `#__{vm}_product_category_xref`.`category_id` IN(".$category_id . ",";  
 foreach ($kategoriListesi as $kat)
 {
  $qkat .= $kat . ',';
 }
 $qkat .= ")";

 $qkat = str_replace(',)', ')', $qkat);
 $where_clause[] = $qkat;
} else {
$where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
} 
 
 }
}
If we need hide category thumbnails comment line 106 in administrator/components/com_virtuemart/html/shop.browse.php
//$navigation_childlist = $tpl->fetch( 'common/categoryChildlist.tpl.php');

09 tháng 2 2012

Virtuemart, Mootools problems

When i worked in a project, there is problem happen with Virtuemart and Mootools in IE8, IE7. When you setup the menu with sub and view the virtuemart layout the menu will be not correct. And you can see the error with mootool.js.

After google and try many solutions without any luck, i found 1 very simple.

1. Go to the plugin management
2. Enable the Mootools upgrade
3. Bingo. Everything will be fine.

I hope this article will help you solve your problem.