Author Topic: 3rd Party Virtuemart Featured Products Mod problem  (Read 3859 times)

mbcalvin

  • Beginner
  • *
  • Posts: 8
3rd Party Virtuemart Featured Products Mod problem
« on: April 30, 2010, 00:19:34 am »
I recently purchased a template from templatemonster.com. It came with a new featured products module that is intended for the homepage. After manually installing this module, it stays up on every page. I have used the menu selction option and selected Home, but for some reason, there are no category browse or flypages, it only shows the featured products module. To see the problem, please go to www.satgator.com When you click on a product or a store link, it only shows the module in the content area. If I disable the module, I can see the landing and flypages, but the homepage doesn't look like I want it to. Below is the code for the module. Any suggestions would be appreciated.

from mod_virtuemart_featuredprod.php

Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/*
* Special Products Module
*
* @version $Id: mod_virtuemart_featureprod.php 1159 2008-01-14 20:30:30Z soeren_nb $
* @package VirtueMart
* @subpackage modules
*
@copyright (C) 2000 - 2004 Mr PHP
// W: www.mrphp.com.au
// E: info@mrphp.com.au
// P: +61 418 436 690
* Conversion to Mambo and many enhancements:
@copyright (C) 2004-2005 Soeren Eberhardt
*
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* VirtueMart is Free Software.
* VirtueMart comes with absolute no warranty.
*
* www.virtuemart.net
*/
global $mosConfig_absolute_path;

// Load the virtuemart main parse code
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}

$max_items $params->get'max_items'); //maximum number of items to display
$category_id $params->get'category_id'null ); // Display products from this category only
$display_style $params->get'display_style'"vertical" ); // Display Style
$products_per_row $params->get'products_per_row'); // Display X products per Row
$show_price = (bool)$params->get'show_price'); // Display the Product Price?
$show_addtocart = (bool)$params->get'show_addtocart'); // Display the "Add-to-Cart" Link?

require_once ( CLASSPATH'ps_product.php');
$ps_product = new ps_product;
$db = new ps_DB;
global 
$desc;

if ( 
$category_id ) {
// BEGIN - MultiCategory Display - deneb
$cat_ids explode(",",$category_id);
if (count($cat_ids) > 1){
$multi_cats 1;
}
// END - MultiCategory Display - deneb

$q  "SELECT DISTINCT product_sku, product_s_desc FROM #__{vm}_product, #__{vm}_product_category_xref, #__{vm}_category WHERE \n";
$q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') \n";
$q .= "AND #__{vm}_product.product_id=#__{vm}_product_category_xref.product_id \n";
$q .= "AND #__{vm}_category.category_id=#__{vm}_product_category_xref.category_id \n";
// BEGIN - MultiCategory Display - deneb
if ($multi_cats){
$i 1;
$q .= "AND (";
foreach ($cat_ids as $cat_id){
if ($i == count($cat_ids)){
$q .= "(#__{vm}_category.category_id='$cat_id')";
} else {
$q .= "(#__{vm}_category.category_id='$cat_id') OR \n";
}
$i++;
}
$q .= ")  \n";
} else {
$q .= "AND #__{vm}_category.category_id='$category_id' \n";
}
// END - MultiCategory Display - deneb
$q .= "AND #__{vm}_product.product_publish='Y' \n";
$q .= "AND #__{vm}_product.product_special='Y' \n";
if( CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
$q .= " AND product_in_stock > 0 \n";
}
$q .= "ORDER BY RAND() LIMIT 0, $max_items";
}
else {
$q  "SELECT DISTINCT product_sku, product_s_desc FROM #__{vm}_product WHERE ";
$q .= "(#__{vm}_product.product_parent_id='' OR #__{vm}_product.product_parent_id='0') AND vendor_id='".$_SESSION['ps_vendor_id']."' ";
$q .= "AND #__{vm}_product.product_publish='Y' ";
$q .= "AND #__{vm}_product.product_special='Y' ";
if( CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
$q .= " AND product_in_stock > 0 ";
}
$q .= "ORDER BY RAND() LIMIT 0, $max_items";
}
$db->query($q);
$desc $db->f("product_s_desc");
if( 
$db->num_rows() > ) {
$width intval(100 intval($db->num_rows()));
?>

<table border="0" cellpadding="0" cellspacing="0">
<?php
$i 0;
while($db->next_record() ){
if ($i%2)
$sectioncolor "sectiontableentry2";
else
$sectioncolor "sectiontableentry1";

if( $display_style == "vertical" ) {
        
?>

<tr align="center" class="<?php echo $sectioncolor ?>">
<td>
<?php 
$ps_product->show_snapshot($db->f("product_sku"), $show_price$show_addtocart);
?>
<br />
</td>
</tr>
<?php
}
elseif( $display_style== "horizontal" ) {
if( $i == )
echo "<tr>\n";
echo "<td align=\"center\">";
$ps_product->show_snapshot($db->f("product_sku"), $db->f("product_s_desc"), $show_price$show_addtocart);
echo "</td>\n";
if( ($i+1) == $db->num_rows() )
echo "</tr>\n";
}
elseif( $display_style== "table" ) {
if( $i == )
echo "<tr>\n";
echo "<td align=\"center\">";
$ps_product->show_snapshot($db->f("product_sku"), $db->f("product_s_desc"), $show_price);
echo "</td>\n";
if ( ($i+1) % $products_per_row == 0)
echo "</tr><tr>\n";
if( ($i+1) == $max_items )
echo "</tr>\n";
}
$i++;
}
?>

</table>
<?php
}
?>
From mod_virtuemart_featureprod.xml
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install SYSTEM "http://www.joomla.org/xml/dtd/1.5/module-install.dtd">
<install type="module" version="1.5.0">
<name>VirtueMart Featured Products</name>
<creationDate>February 2008</creationDate>
<author>The VirtueMart Development Team</author>
<authorEmail>soeren|at|virtuemart.net</authorEmail>
<authorUrl>http://www.virtuemart.net</authorUrl>
<copyright>
Copyright (C) 2004-2008 Soeren Eberhardt-Biermann. All rights
reserved.
</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>1.1.0</version>
<description>Shows featured products from VirtueMart.</description>
<files>
<filename module="mod_virtuemart_featureprod">mod_virtuemart_featureprod.php</filename>
</files>
<params>
<param name="max_items" type="text" default="2"
label="Number of displayed products"
description="This defines the number of products which will be displayed in the module." />
<param name="show_price" type="list" default="1"
label="Show Product Price?"
description="Defines wether the product price is displayed or not.">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="show_addtocart" type="list" default="1"
label="Show Add-To-Cart Link?"
description="Defines wether the Add-To-Cart Link is displayed or not.">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="display_style" type="list" default="vertical"
label="Diplay Style"
description="Here you can decide wether the products are shown in a horizontal or vertical list">
<option value="horizontal">Horizontal (1 Row)</option>
<option value="vertical">Vertical (1 Column)</option>
<option value="table">Table (X rows and Y columns)</option>
</param>
<param name="products_per_row" type="text" default="4"
label="Products per row"
description="Only when Table is selected: The Number of columns per row in the table for the product snapshots." />
<param name="category_id" type="text" default=""
label="Category ID(s)"
description="Here you can fill in one or more category IDs (comma-separated list), so that only products from this special Category are displayed. Just leave blank if you want to display featured products from all categories." />
<param name="cache" type="radio" default="0"
label="Enable Cache"
description="Select whether to cache the content of this module">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="moduleclass_sfx" type="text" default=""
label="Module Class Suffix"
description="A suffix to be applied to the css class of the module (table.moduletable), this allows individual module styling" />
<param name="class_sfx" type="text" default=""
label="Menu Class Suffix"
description="A suffix to be applied to the css class of the menu items" />
</params>
</install>

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10414
  • VirtueMart Version: 3+
Re: 3rd Party Virtuemart Featured Products Mod problem
« Reply #1 on: April 30, 2010, 01:18:16 am »
your homepage needs to be a NON vmart page to do this.

The way module assignment works is by the "item id"

and virtuemart pages all have the same "Item ID" so anything assigned to item ID "1" in your case will show up on ALL vmart pages.

Create a content page for the front page.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

lukelee

  • Jr. Member
  • **
  • Posts: 86
Re: 3rd Party Virtuemart Featured Products Mod problem
« Reply #2 on: October 29, 2010, 01:12:40 am »
I used joomla frontpage as homepage, and assigned featured product on that page ONLY, but still the featured products displayed on everypage!

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10414
  • VirtueMart Version: 3+
Re: 3rd Party Virtuemart Featured Products Mod problem
« Reply #3 on: October 29, 2010, 15:30:08 pm »
there is a setting the vmart admin, to set the number of featured products to display. Set it to 0
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)