News:

Support the VirtueMart project and become a member

Main Menu

Problem with class mod_virtuemart_product

Started by psm, August 27, 2013, 18:35:25 PM

Previous topic - Next topic

psm

Dear all,
I tried to install my module for live searching inside of mod_virtuemart_product module. I changed mod_virtuemart_product.xml in this way:

Old code

<install type="module" version="1.5.0">
    <name>mod_virtuemart_product</name>
    <creationDate>March 17 2013</creationDate>
    <author>The VirtueMart Development Team</author>
    <authorUrl>http://www.virtuemart.net</authorUrl>
    <copyright>Copyright (C) 2004-2012 Virtuemart Team. All rights reserved.</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <version>2.0.20b</version>
    <description>MOD_VIRTUEMART_PRODUCT_DESC</description>
    <files>
<filename module="mod_virtuemart_product">mod_virtuemart_product.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/default2.php</filename>
<filename>tmpl/default3.php</filename>
<filename>tmpl/index.html</filename>
    </files>
    <params addpath="/administrator/components/com_virtuemart/elements">
<param name="layout" type="filelist" label="MOD_VIRTUEMART_PRODUCT_LAYOUT"
              description="MOD_VIRTUEMART_PRODUCT_LAYOUT_DESC"
              directory="/modules/mod_virtuemart_product/tmpl"
              default="default" hide_default="1" hide_none="1"
              stripext="1" filter="\.php$" exclude="^_" />
.
.
.


New code

<extension type="module" version="2.5" method="upgrade">
    <name>mod_virtuemart_product</name>
    <creationDate>March 17 2013</creationDate>
    <author>The VirtueMart Development Team</author>
    <authorUrl>http://www.virtuemart.net</authorUrl>
    <copyright>Copyright (C) 2004-2012 Virtuemart Team. All rights reserved.</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <version>2.0.20b</version>
    <description>MOD_VIRTUEMART_PRODUCT_DESC</description>
    <files>
<filename module="mod_virtuemart_product">mod_virtuemart_product.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
<filename>tmpl/quicksearch.php</filename>

    </files>
    <params addpath="/administrator/components/com_virtuemart/elements">
.
.
.


And I created in mod_virtuemart_product/tmpl folder new php files and javascript files in this way:

mod_virtuemart_product/tmpl/quicksearch.php
mod_virtuemart_product/tmpl/default.php - used by virtuemart (I just add to this code my layout code)

<?php include('head.php');?>

<br>
<br>

<div class="container">


<div class="hero-unit-2">
    <form>
<input placeholder="Search" class="input-large search-query" type="text" id="key" >
  <div class="result"><div class="loading"></div></div>
    </form>


</div>

mod_virtuemart_product/tmpl/head.php
mod_virtuemart_product/tmpl/config.php
mod_virtuemart_product/tmpl/js/javascript.js
mod_virtuemart_product/tmpl/css/css.css

Everything is connected. My code is functional, but when I want to add this code to my quicksearch.php file:

     <?php
echo mod_virtuemart_product::addtocart ($product);
      
?>



It writes me this error:

"Fatal error: Class 'mod_virtuemart_product' not found in /www/t/r/u46223/public_html/modules/mod_virtuemart_product/tmpl/quicksearch.php on line 34"

Could you please advice me, what is wrong?

Thank you.