Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 17th, 2011, 04:08 AM
sylviathewitch sylviathewitch is offline
 
Join Date: Mar 2011
Posts: 155
Default Related Products

What is the best way to show related products not by category (c=%ci), but rather by product name?

I have tried
<?php echo datafeedr_tag('related?word=%ps'); ?>
it works, but that gives very generic results
e.g. products slug is "air-optix-aqua-multifocal-188400194042529"
I'll get ALL air optix results and "aqua" or "multifocal" are ignored.
So, that does not help.

Or
<?php echo datafeedr_tag('related?word=[product.name]'); ?>
This doesnt work at all. I always get the same 4 products (??? - no idea why) on every product detail page.

What "%code" or what other placeholder do I have to use after "?word=" to get the product name?

I guess, I am missing something very simple ....

Thanks in advance
Sylvia
  #2  
Old October 17th, 2011, 08:48 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

For product name you could try this:

PHP Code:
<?php echo datafeedr_tag('related?word='.$product->name); ?>
Eric
  #3  
Old October 17th, 2011, 09:54 AM
sylviathewitch sylviathewitch is offline
 
Join Date: Mar 2011
Posts: 155
Default

Quote:
Originally Posted by Eric View Post
Hi

For product name you could try this:
<?php echo datafeedr_tag('related?word='.$product->name); ?>

Eric
Hi Eric,

I guess you meant:
<?php echo datafeedr_tag('related?word=.$product->name'); ?>
(' after name, not after word=)

... but, this isnt working.
I get the same results, when using word=[product.name] or word=.$product->name
Always the same 4 products, not related to each other and have nothing to do with the product on the product detail page.

Examples:
http://omasgeheimnisse.com/shop1/kon...0500194041277/
or
http://omasgeheimnisse.com/shop1/kon...5500623813287/

In case you need it, store id is 31521

Product detail view (1st text module)
Custom Views: aehnlicheprodukte



Thanks a lot for looking into this!
  #4  
Old October 17th, 2011, 10:49 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

This seems to work for me.

1. Add the following code to your theme's functions.php file:
PHP Code:
/**
 * This formats the product name in such a way that
 * it can be passed in the query string.  This belongs
 * in your theme's functions.php file.
 */
function dfr_get_related_product_qs_value ($product_name) {
    
$names str_word_count($product_name1);
    
$product_qs_value '';
    foreach (
$names as $name) {
        if (
strlen($name)>3) {
            
$product_qs_value .= $name '+';
        }
    }
    
$product_qs_value substr($product_qs_value0, -1);
    return 
$product_qs_value;

2. Add the following code to your Custom View where you want the product list to appear.
(NOTE that this code is for the Default Related Products custom view. You will need to change the name of the view to reflect your view's name):
PHP Code:
<!-- Related Products List -->
<?php if (function_exists('dfr_get_related_product_qs_value')) : ?>
    <?php echo datafeedr_tag('Related Products?word='.dfr_get_related_product_qs_value ($product->name)); ?>
<?php 
else : ?>
    [DFR:Related Products?c=%ci]
<?php endif; ?>
<!-- /Related Products List -->
3. Update your store's settings and you should be good to go.

Eric
  #5  
Old October 17th, 2011, 11:59 AM
sylviathewitch sylviathewitch is offline
 
Join Date: Mar 2011
Posts: 155
Default

Perfect
Thanks as always!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Related Products Not Displaying davecole212 Problems 8 May 7th, 2011 03:36 PM


All times are GMT -5. The time now is 12:53 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.