VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Products, Prices, Tax and Categories VM 1.1 => Topic started by: doyley3 on May 05, 2008, 20:02:03 pm

Title: How to set up related products
Post by: doyley3 on May 05, 2008, 20:02:03 pm
Hi sorry if this is really basic, but i've set up some products under a category and am trying to add related products, but when i type in a name to search for products and categories box it returns no entries?

Have I set them up wrong?
Title: Re: How to set up related products
Post by: doyley3 on May 07, 2008, 00:41:08 am
I'm using joomla 1.5.3 and virtuemart 1.1 stable. no dropdown option to add for related products
Title: Re: How to set up related products
Post by: samoht on May 07, 2008, 01:52:11 am
did you try typing the name of the category - or the name of a product?

I am using the same config as you and have no problems if I type in the name of the category
Title: Re: How to set up related products
Post by: doyley3 on May 07, 2008, 01:59:08 am
Hi yes it does a little search and comes back with nothing, either products or categories.
Title: Re: How to set up related products
Post by: paulsch on May 14, 2008, 16:45:11 pm
Hi,

i have the same problem. Im using VM1.1 and Joomla 1.0.15 . There's no way to add Related Products. Is there a way to fix it.

Greets Paulsch
Title: Re: How to set up related products
Post by: Mackelito on May 16, 2008, 13:02:45 pm
Hi,
i have the same problem. Im using VM1.1 and Joomla 1.0.15 . There's no way to add Related Products. Is there a way to fix it.
Greets Paulsch

Using same versions and have the same problem... any solution?
Title: Re: How to set up related products
Post by: mylearningspace on May 18, 2008, 06:17:28 am
if category isnt working...

-go to vm admin in simple or extended layout
-go to product list
-select a product
-select last tab 'related products'
-type a keyword should display product results
-click each result to relate to product
-save & voila!

see attached file

[attachment cleanup by admin]
Title: Re: How to set up related products
Post by: Mackelito on May 18, 2008, 12:49:40 pm
Well that would be great... but like we said in previous post that is just the thing that doesn't work :(:(
Title: Re: How to set up related products
Post by: pcjunkie on May 19, 2008, 06:59:12 am
I have this too. The java is opening and then closing again very quickly. Is there a way to prevent this?

[edit] My bad. A little experimentation goes a long way...

Its not picking up on the categories exactly but the first word or each product in the tree
Title: Re: How to set up related products
Post by: Mackelito on May 19, 2008, 10:25:59 am
I have this too. The java is opening and then closing again very quickly. Is there a way to prevent this?
[edit] My bad. A little experimentation goes a long way...
Its not picking up on the categories exactly but the first word or each product in the tree

So it works for you?
Title: Re: How to set up related products
Post by: paulsch on May 20, 2008, 12:01:08 pm
Is there really no way to fix this problem. Has nobody a idea. This problem makes me crazy.
 :-[
Paulsch
Title: Re: How to set up related products
Post by: jaddi01 on May 22, 2008, 16:04:34 pm
Virtumart 1.1 and Joomla 1.5 same issue!  Tried in both firefox and IE, no way to add related products.
Title: Re: How to set up related products
Post by: Tachikoma on May 22, 2008, 22:06:55 pm
Yeah, this problem is really annoying.
I am having the same problem.

The related items dropdown doesn't have any products loaded in the list.
When I enter a search phrase in the dropdown, a search application loads quickly, but then vanishes.

Which include or other php file controls this, maybe we can debug.

Even after a fresh install when everything else is working fine, this problem still persists.

Any developers, please advise!

Thanks,
Brian
Title: Re: How to set up related products
Post by: Tachikoma on May 23, 2008, 22:29:57 pm
You know... Even though this function is described in the user manual, I think the developers left it out...
If anyone does have related products working, can you let us know what version you are using, and where you downloaded it from?
Better still, can you compare your list of functions under the Products module to this list:

changePublishState
csvFieldAdd
csvFieldDelete
csvFieldUpdate
deleteProductFile
discountAdd
discountDelete
discountUpdate
export_csv
insertDownloadsForProduct
moveProduct
productAdd
productAttributeAdd
productAttributeDelete
productAttributeUpdate
productCategoryAdd
productCategoryDelete
productCategoryUpdate
productDelete
productPriceAdd
productPriceDelete
productPriceUpdate
productProductTypeAdd
productProductTypeDelete
ProductTypeAdd
ProductTypeAddParam
ProductTypeDelete
ProductTypeDeleteParam
ProductTypeReorder
ProductTypeReorderParam
ProductTypeUpdate
ProductTypeUpdateParam
productUpdate
product_csv
reorder
reviewUpdate
updateProductFile
uploadProductFile

I swear, I dont see any function that looks anyhting like "Related Products" or "Add related...".

Can a developer confirm that there should be such a function in this module's list for the management of related products?

This is really annoying, not to be able to add related items...
Title: Re: How to set up related products
Post by: samoht on May 24, 2008, 00:13:23 am
I am not a developer but,

in ps_product.php you have the functions: add, insert, and delete - which all have the code for updating the datebase with the related products.

however - it seems that you might want to check the code on product.product_form.php around line 984 and following
Also, at the end of the page is a javascript function
Code: [Select]
var searchField = function(){around line 1400 that should be were the problem is??

I am running the same config as several posters here and the related products works fine for me so I doubt a developer would be able to tell what is wrong based on the little info given.

Hope this helps
Title: Re: How to set up related products
Post by: Tachikoma on May 24, 2008, 01:30:03 am
Thanks for the help.
What folders are these files in?
Administrator/components/com_virtuemart?
Title: Re: How to set up related products
Post by: samoht on May 24, 2008, 02:11:28 am
yes,
\administrator\components\com_virtuemart\html\product.product_form.php


and,
\administrator\components\com_virtuemart\classes\ps_product.php
Title: Re: How to set up related products
Post by: Tachikoma on May 24, 2008, 02:13:01 am
Thanks, I'll try do do... uh... something with this tonight.
Title: Re: How to set up related products
Post by: Mackelito on May 26, 2008, 10:37:38 am
Any news on this?
Title: Re: How to set up related products
Post by: Tachikoma on May 26, 2008, 18:04:44 pm
This is from product.product_form.php:
$tabs->startTab( $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS'), "related-page");

?><br />
<h2><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS') ?></h2>
<br />
        <table class="adminform">
          <tr class="row1">
         <td style="vertical-align:top;"><br />
         <?php echo $VM_LANG->_('VM_PRODUCT_RELATED_SEARCH'); ?>
         <input type="text" size="40" name="search" id="relatedProductSearch" value="" />
         </td>
         <td><input type="button" name="remove_related" onclick="removeSelectedOptions(relatedSelection);" value="&nbsp; &lt; &nbsp;" /></td>
         <td>
         <?php
         $relProducts = array();
         foreach( $related_products as $relProd ) {
            $relProducts[$relProd] = $ps_product->get_field( $relProd, 'product_name');
         }
         echo ps_html::selectList('relProds', '', $relProducts, 10, 'multiple="multiple"', 'id="relatedSelection" ondblclick="removeSelectedOptions(relatedSelection);"');
         ?>
         <input type="hidden" name="related_products" value="<?php echo implode('|', $related_products ) ?>" />
         </td>         
      </tr>
   </table>
<!-- Changed Product Type - Begin -->
<?php
$tabs->endTab();

And from ps_product.php:
if( !empty($d["related_products"])) {
         /* Insert Pipe separated Related Product IDs */
         $related_products = vmGet( $d, "related_products" );
         $q  = "INSERT INTO #__{vm}_product_relations ";
         $q .= "(product_id, related_products) ";
         $q .= "VALUES ('".$d["product_id"]."','".$db->getEscaped($related_products)."')";
         $db->setQuery($q); $db->query();

      }

So based on these 2 bits of code, it looks like the first removes related products, and the second actually inserts the related product information into the database, but that would be only after the proper data is selected.

I am still holding onto the fact that there is no such module/function listed in my copy of VM for "related products".

I'd really like for one of you all who has the related products working, to list your functions for the products module in the VM control panel.

Anyone else know where there might be some code related to related products? I could go through each PHP file, but ... ugh...
I'll do that if I see that someone who has related products working doesn't have a "related" function in their products module.

-Brian
Title: Re: How to set up related products
Post by: samoht on May 27, 2008, 02:18:06 am
Brian,

If you look at the code you posted you can see that there is an array that has the code to call the function to search the db for the related products
Code: [Select]
$relProducts = array();
         foreach( $related_products as $relProd ) {
            $relProducts[$relProd] = $ps_product->get_field( $relProd, 'product_name');
         }
in this snippet the class ps_product is calling the get_field function to find the related products. So if you check in \administrator\components\com_virtuemart\classes\ps_product.php for the function "get_field" (mine starts around line 1035)then you can tell if you are missing the php function.

however, the related products input box also uses some AJAX - I assume that your problem is not with the php, but with the AJAX, or rather with a setting on your server that the AJAX is having trouble with. Again I am not developer, but from what you describe I think this is where your problem is.   
Title: Re: How to set up related products
Post by: Tachikoma on May 27, 2008, 06:14:50 am
Samoht,

Thanks for the help.
The bit you reference though... it gets existing related products doesn't it?

I can't even get one related product.

This is an interesting idea though, that the server's settings may be the problem... Still, I wouldn't know where to start.

Samoht, related items work for you? Do you have a function in your products module called *related*?

Again, thanks.

-Brian
Title: Re: How to set up related products
Post by: samoht on May 27, 2008, 14:44:21 pm
um, the function is "get_field"
the AJAX handles the look up of you database when you type in a word in the input box to do the search for related products. The way you described your problem - nothing happens when you type in the input box - is that correct?
Title: Re: How to set up related products
Post by: Mackelito on May 27, 2008, 14:55:11 pm
um, the function is "get_field"
the AJAX handles the look up of you database when you type in a word in the input box to do the search for related products. The way you described your problem - nothing happens when you type in the input box - is that correct?

In my case I can see the search box looking for products but the end result is nothing!  :(
Title: Re: How to set up related products
Post by: Mackelito on May 27, 2008, 15:23:53 pm
This screen flashed by and then nothing...

[attachment cleanup by admin]
Title: Re: How to set up related products
Post by: Tachikoma on May 27, 2008, 16:58:20 pm
Yes, this is the same thing that happens to me.
The (I'm assuming) AJAX popup appears when typing in some search string, or it pops up when I've changed some text, but quickly goes away without returning any results.

It's like it start to search but returns no results or something.
Title: Re: How to set up related products
Post by: paulsch on May 29, 2008, 08:28:59 am
Hi,

it seems to be a Server Configuration problem. On my Lokal installation works fine. But i have no idea how to fix the problem.
Title: Re: How to set up related products
Post by: Tachikoma on May 29, 2008, 08:44:34 am
Well, I have an installation on my own server, where it isn't working.

Ive got some sites on Siteground, and HostGator... I'm gonna try installing VM on both of those and see if related products work on either...

Maybe I'll be able to figure it out then.

I'll report in a day or two.

-Brian
Title: Re: How to set up related products
Post by: Tachikoma on May 29, 2008, 08:55:11 am
Well...
On a hostgator site, related products work just fine, and I have the same versions of Joomla and VM on either.

Tomorrow I'll see what I can do about configuring my own server to look more like HostGator.

For those of you with related prods working, what versions are your PHP, MySQL, Apache?
Title: Re: How to set up related products
Post by: Mackelito on May 29, 2008, 09:49:32 am
PHP built On: Linux 2.6.9-67.0.4.ELsmp #1 SMP Sun Feb 3 07:08:57 EST 2008 i686
Database Version: 4.1.21-standard
PHP Version: 5.2.3
Web Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a PHP/5.2.3
WebServer to PHP interface: apache2handler
Joomla! Version: Joomla! 1.0.15 Stable [ Daytime ] 22 February 2008 23:00 UTC

Relevant PHP Settings:    
Joomla! Register Globals Emulation:    OFF    
Register Globals:    OFF    
Magic Quotes:    ON    
Safe Mode:    OFF    
File Uploads:    ON    
Session auto start:    OFF    
Session save path:    /tmp
Short Open Tags:    ON    
Output Buffering:    OFF    
Open basedir:    none
Display Errors:    ON
XML enabled:    Yes
Zlib enabled:    Yes
Disabled Functions:    none
Title: Re: How to set up related products
Post by: paulsch on May 29, 2008, 11:31:11 am
Now it works for me. ;D
The Problem was the Version of the Database. My Version was 3.23.58 . I updatet the
Database to Version 4.1.22 and it works great. Now i can start with my shop.
If you make a update to an new Version be sure that you have a Backup of your Database, downgrade is not possible only if you drop the Database and import the older one again.
Title: Re: How to set up related products
Post by: samoht on May 29, 2008, 12:59:14 pm
it makes sense that the AJAX wont speak to the server (or will get stuck while connecting) if the server is running old versions of MySql and php. The developers could probably write some backwards compatible script - but it would be better for people on there local servers to update there server software.
Title: Re: How to set up related products
Post by: Mackelito on May 29, 2008, 13:58:13 pm
Problem is still there for me... I have been running Database Version: 4.1.21-standard and PHP Version: 5.2.3.

Could it be fixed by upgrading from version 4.1.21 to 4.1.22????
Title: Re: How to set up related products
Post by: Tachikoma on May 29, 2008, 17:08:05 pm
Ok, so on hostgator where related products work, I have:

Apache version 1.3.37 (Unix)
PHP version 4.4.4
MySQL version 4.1.22-standard

And on My server, where it does not, I have:

Apache/1.3.34
PHP/4.4.4
MySQL 3.23.33

Based on these alone, could it be that I need a more recent version of MySQL?
Title: Re: How to set up related products
Post by: Mackelito on May 30, 2008, 12:27:44 pm
hmmm... perhaps that could be the problem.. but it would seem strange to me that basic fuctions in VM would require such a "new" version of mysql... most of the hosts still run MySQL 4 right?
Title: Re: How to set up related products
Post by: Mackelito on May 30, 2008, 12:28:32 pm
If this is the problem.. is there a workaround if I canĀ“t get my host to update the mysql?
Title: Re: How to set up related products
Post by: Mackelito on May 30, 2008, 16:18:50 pm
perhaps not to use AJAX?
Title: Re: How to set up related products
Post by: Mackelito on June 02, 2008, 15:57:55 pm
Any ideas?
Title: Re: How to set up related products
Post by: Tachikoma on June 02, 2008, 17:55:57 pm
I didnt even touch this this weekend. Hopefully tomorrow I can have more.
Title: Re: How to set up related products
Post by: jaddi01 on June 09, 2008, 11:10:50 am
*Bump*

Any new developments?  Upgrading our SQL if that is the solution, is pretty much a no no for us.  So any other suggestions would be welcomed.
Title: Re: How to set up related products
Post by: Mackelito on June 10, 2008, 15:45:25 pm
So strange... I tried installing it on another account... same server... no problem???

This lead me to think something was wrong with the files.. perhaps an error when uploading but I re uploaded the files and still the same issue...
Title: Re: How to set up related products
Post by: Mackelito on June 11, 2008, 08:25:09 am
On the site that dont work we used CVSimproved to import from another VM shop (version 1.0)...

Could that be the problem? Perhaps some database related issue?
Title: Re: How to set up related products
Post by: maxmillion on June 11, 2008, 22:12:35 pm
Hi Guys, just wanted to share my feedback here.
I had this same issue, Related Products just wont work until I typed in the full category name ( just pick any name from your existing categories ) like Music, Speakers, etc, whatever you got!

Type in the full category name in the related products search field and it should automatically load all products available in that category for you to select. Just make sure the full name word is typed and no spelling mistakes.

I spent about 2 days banging my head here and the solution was right in front of me without any coding / debugging required.

I hope this helps!
Worked for me.
Thanks 
Title: Re: How to set up related products
Post by: Mackelito on June 11, 2008, 23:26:31 pm
tried it.. no good :(
Title: Re: How to set up related products
Post by: chrisb123 on June 23, 2008, 04:00:27 am
You're admin session may have timed out, try logging back into your admin panel and go straight to the option and try again
Title: Re: How to set up related products
Post by: pcinvent on June 25, 2008, 18:57:09 pm
Does anyone has time to look at the AJAX code which is "product.ajax_tools" in administrator/com_virtuemart/html and see if anything we can do there, thanks!

Code: [Select]
index2.php?option=com_virtuemart&page=product.ajax_tools&task=getproducts&ajax_request=1&func=&no_menu=1&only_page=1&no_html=1&product_id=17&_dc=121442792841&start=0&limit=15&query=computer%20
Title: Re: How to set up related products
Post by: arana on August 29, 2008, 16:22:34 pm
i had a situation similar to this but in my case it was regarding ASSIGNING CATEGORIES to items,
the problem in my case (couldnt see any categories to assign to my items , vm showed only the dreaded searchbox) was that the category list turns into a searchbox if you have more than 200 categories so i changed it to 1200 (yes i will have that much), maybe it is the same case for you, if you have a new installation, witha few items it works, and if you have already imported all your items (many many) then the listbox turns to searchbox?, i dont have that problem of the related items (for now) but here is what i did to fix the category assignment issue (very similar) maybe can send you to the right direction, or change that box tom a dropdown or whatever

## Edit file: /...ts/com_virtuemart/html/product.product_form.php   

## category listbox was not showing in backend category assignment
## instead replaced with searchbox

##changed:
##line 256
##       if( $number_of_categories > 200 ) {

## to
##        if( $number_of_categories > 1200 ) {

## now it shows my listbox with everything inside it, no searchboxes

so maybe try searching for something similar in your case, maybe a hardcoded limit.
Title: Re: How to set up related products
Post by: Richard King on February 24, 2009, 12:24:18 pm
OK we have looked and searched for an answer on this one, and we keep drawing blanks

In admin, when ading or modifying a product the related product AJAX search - no results in drop down

I have cloned the JSON file and renamed all the variables (to rule out a conflict) - no joy

I have disabled  all the other plugins and modules - same - no joy

We are not using the AZUL module for anything (not installed ever)
 
We have uninstalled all components other then virtuemart (JCE, ArtForms, CSV improved, JPACK) - stil the same

We have also tried typing in the category description etc..

Is there a Non AJAX version of this script (product_ajax_tools)?
Has anyone else resolved this issue?

Richard