Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Questions (http://www.datafeedr.com/forums/forumdisplay.php?f=67)
-   -   Random product inside blog post (http://www.datafeedr.com/forums/showthread.php?t=9771)

raj2006 October 29th, 2013 04:29 AM

Random product inside blog post
 
My URL is:

http://aprons.buytopproducts.org/ins...r-winter-wear/

I would like to incorporate one related product in each blog post on the top left of the content (float left).

How do I implement this?

Thanks

ps: I am not able to search for earlier posts in your forum for this topic as the search function is not working. Please refer to my other forum post today on this issue.

Eric October 29th, 2013 08:57 AM

Hi,

Here's how to do that:
http://www.datafeedr.com/docs/item/184
http://www.datafeedr.com/videos/?vid...rc=yt#videotop


Eric

raj2006 October 29th, 2013 09:08 AM

Hi Eric,

Thanks for your response.

I saw your first link

Instead of embedding a specific product, if I wish to display a random product from a store category, how to implement it?

Eric October 29th, 2013 09:26 AM

Hi,

In that case you'll need to replace the Product Details module with a Product List module, change the settings of the Product List module to sort products Randomly and then pass a category ID in the shortcode like this:

[DFR:Embedded Product?c=123456] (where 123456 is the category you want to choose a product from)

Eric

raj2006 October 29th, 2013 01:24 PM

Hi Eric,

Probably I am not doing something right.

I have created a custom view, added product list module, used a 3 column template, changed sorting to random, Updated DFR in WP, added shortcode in above mentioned post.

But, product not getting displayed.

raj2006 October 29th, 2013 01:25 PM

Shop is 42595 and I added the following shortcode to my blog post

[DFR:Embedded Product?c=1202901]

Again, the blog post is:

http://aprons.buytopproducts.org/ins...r-winter-wear/

Eric October 29th, 2013 01:51 PM

Hi,

Your view is named "Random Product in Post" so your shortcode will be:

[DFR:Random Product in Post?c=1202901]

Eric

raj2006 October 30th, 2013 12:19 AM

Hi Eric,

Thanks.

How silly of me :o I didn't notice the shortcode.

Now, the products are displaying. But, unfortunately, they are showing one product below the other and not showing the correct 3-colum layout as on the home page: http://aprons.buytopproducts.org/

I am using the 3-column layout from Template 1 under Product List with the code as below. What do you think should be corrected in this code to get the 3-column layout?

Code:

<div class="pl">
  [product.each]
  <div class="t1 col3">
  <div class="bdr">
    <h2><a href="[product.link]" title="[product.name]">[product.name]</a></h2>
    <div class="thmb"><a href="[product.link]" title="[product.name]">[product.image tag='1']</a></div>
    <div class="prc">[product.currency mode='sign'][product.price]</div>
    <p class="desc">[product.description]</p>
    <div class="btns">
    <a href="[product.link]" title="View details [product.name]" class="dfbutton dforange dfmedium">Details</a>
    <a href="[product.url direct='0']" title="Buy [product.name]" class="dfbutton dfred dfmedium" rel="nofollow">Buy</a>
    </div>
    <div class="clearingdiv"> </div>
  </div>
  </div>
  [/product.each]
  <div class="clearingdiv"> </div>
</div>


raj2006 October 30th, 2013 04:05 AM

Apart from the above issue of proper display of the 3-column layout, I just need one more help.

Instead of inserting the shortcode in each blog post, I have created a php code below to automate the process. Instead of the shortcode, I have tested it with the echo statement and the php is working per se.

But, the shortcode inside the php is breaking the code. How to correct it?

Code:

<?php
$categories = get_the_category();
foreach($categories as $category) { $cat_name = $category->slug; }

switch ($cat_name)
{
        case "adult-bibs":
                [DFR:Random Product in Post?c=1222595];
                break;
        case "gloves":
                [DFR:Random Product in Post?c=1202902];
                break;
        case "kids-aprons":
                [DFR:Random Product in Post?c=1202900];
                break;               
        case "kids-bibs":
                [DFR:Random Product in Post?c=1202901];
                break;                       
        case "mens-aprons":
                [DFR:Random Product in Post?c=1202899];
                break;                       
        case "womens-aprons":
                [DFR:Random Product in Post?c=1202898];
                break;
}                       
?>


Eric October 30th, 2013 08:17 AM

Hi
Quote:

Originally Posted by raj2006 (Post 45295)
I am using the 3-column layout from Template 1 under Product List with the code as below. What do you think should be corrected in this code to get the 3-column layout?

I'm seeing 3 columns now. I assume you got this fixed...



Quote:

Originally Posted by raj2006 (Post 45297)
Apart from the above issue of proper display of the 3-column layout, I just need one more help.

Instead of inserting the shortcode in each blog post, I have created a php code below to automate the process. Instead of the shortcode, I have tested it with the echo statement and the php is working per se.

But, the shortcode inside the php is breaking the code. How to correct it?

Code:

<?php
$categories = get_the_category();
foreach($categories as $category) { $cat_name = $category->slug; }

switch ($cat_name)
{
        case "adult-bibs":
                [DFR:Random Product in Post?c=1222595];
                break;
        case "gloves":
                [DFR:Random Product in Post?c=1202902];
                break;
        case "kids-aprons":
                [DFR:Random Product in Post?c=1202900];
                break;               
        case "kids-bibs":
                [DFR:Random Product in Post?c=1202901];
                break;                       
        case "mens-aprons":
                [DFR:Random Product in Post?c=1202899];
                break;                       
        case "womens-aprons":
                [DFR:Random Product in Post?c=1202898];
                break;
}                       
?>


You need to use the PHP version of the Shortcode. So your code would look like this:

PHP Code:

<?php
$categories 
get_the_category();
foreach(
$categories as $category) { $cat_name $category->slug; }

switch (
$cat_name)
{
    case 
"adult-bibs":
        echo 
datafeedr_tag('Random Product in Post?c=1222595');
        break;
    case 
"gloves":
        echo 
datafeedr_tag('Random Product in Post?c=1202902');
        break;
    case 
"kids-aprons":
        echo 
datafeedr_tag('Random Product in Post?c=1202900');
        break;        
    case 
"kids-bibs":
        echo 
datafeedr_tag('Random Product in Post?c=1202901');
        break;            
    case 
"mens-aprons":
        echo 
datafeedr_tag('Random Product in Post?c=1202899');
        break;            
    case 
"womens-aprons":
        echo 
datafeedr_tag('Random Product in Post?c=1202898');
        break;
}            
?>

You can find out more about Shortcodes here: http://www.datafeedr.com/docs/item/185

Eric

raj2006 October 30th, 2013 08:27 AM

Hi Eric,

The shortcode problem has been resolved after I incorporated the code correction that you gave. Thanks a lot.

Regarding 3-column layout issue, you referred to the store homepage that is already fine.

But, the issue is on the blog post. At the end of the blog post content, the products are appearing one below the other. Please see the below URL for example:

http://aprons.buytopproducts.org/blog/

Please look at any of the blog posts from the above URL.

Thanks
Raj

Eric October 30th, 2013 08:29 AM

Hi,

To fix that, do this:

1. Go here: The Factory > Your Store > VIEWS > CUSTOM VIEWS > Random Product in Post > View menu > View Properties

2. Add the word view to the CSS ID field.

3. Save and update your site.

Eric

raj2006 October 30th, 2013 09:04 AM

Hi Eric,

Thank you so much.

The issues are resolved and it is working fine now.

Raj


All times are GMT -5. The time now is 01:57 PM.

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