Author Topic: How to set up related products  (Read 22920 times)

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #15 on: May 24, 2008, 01:30:03 am »
Thanks for the help.
What folders are these files in?
Administrator/components/com_virtuemart?
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

samoht

  • Jr. Member
  • **
  • Posts: 104
Re: How to set up related products
« Reply #16 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
I use Joomla 1.5! and VM 1.1

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #17 on: May 24, 2008, 02:13:01 am »
Thanks, I'll try do do... uh... something with this tonight.
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

Mackelito

  • Jr. Member
  • **
  • Posts: 95
Re: How to set up related products
« Reply #18 on: May 26, 2008, 10:37:38 am »
Any news on this?

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #19 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
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

samoht

  • Jr. Member
  • **
  • Posts: 104
Re: How to set up related products
« Reply #20 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.   
I use Joomla 1.5! and VM 1.1

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #21 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
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

samoht

  • Jr. Member
  • **
  • Posts: 104
Re: How to set up related products
« Reply #22 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?
I use Joomla 1.5! and VM 1.1

Mackelito

  • Jr. Member
  • **
  • Posts: 95
Re: How to set up related products
« Reply #23 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!  :(

Mackelito

  • Jr. Member
  • **
  • Posts: 95
Re: How to set up related products
« Reply #24 on: May 27, 2008, 15:23:53 pm »
This screen flashed by and then nothing...

[attachment cleanup by admin]

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #25 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.
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

paulsch

  • Beginner
  • *
  • Posts: 4
Re: How to set up related products
« Reply #26 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.

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #27 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
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

Tachikoma

  • Jr. Member
  • **
  • Posts: 66
Re: How to set up related products
« Reply #28 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?
Joomla 1.5.4 on Siteground
Virtuemart 1.1.1

Mackelito

  • Jr. Member
  • **
  • Posts: 95
Re: How to set up related products
« Reply #29 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