Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default YouTube in Product Descriptions

    Thought this might help some people. It is a little mini-module that lets you add youtube videos to your product descriptions. A thumbnail of the video will be inserted. Once clicked the video is played in a lightbox type window, which is quite nice.

    Videos can be added to the product description using a bit of text like this:

    where "ADlAc-NsDng" is the youtube identifier for the video.

    It really is provided 'as is' but if a few people test it, and maybe even write some proper instructions, then it might be of use to someone. Who knows....
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2009
    Location
    UK
    Posts
    1,090
    Plugin Contributions
    0

    Default Re: YouTube in Product Descriptions

    This is handy. Would be nice to have a close button on the window as you just have to click outside of the box to close it which isnt instantly obvious.

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Re: YouTube in Product Descriptions

    Hi Nick, got this installed but can't get it to work. Any ideas?

    When I click on the video it just defaults to the shop homepage.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: YouTube in Product Descriptions

    Hi Nick,
    Are you on a development server or can I look at the page?
    Nick

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Re: YouTube in Product Descriptions

    Hi Nick, no its not on a development server. I took it off the website for now but can show you what is happening if you give me ten minutes.

    Hang fire and I'll message you back in a moment.

    Nick
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  6. #6
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Re: YouTube in Product Descriptions

    Right first things first

    Go here

    http://www.aqua-fun.co.uk/index.php?...ort=20a&page=6

    And find the product in the listing called Waboba Ball

    You will see that the you tube shortcode appears in the product listing so it appears like this

    qSWmAzpUlts

    under the listing description

    Next issue

    Go here

    http://www.aqua-fun.co.uk/index.php?...products_id=92

    Don't click on 'View Waboba Ball Videos here!' as that will take you to a page of all the videos on the site.

    Click on the thumbnail created by zentube and you will see it takes you to the homepage and puts a # in the URL.


    Cheers

    Nick
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  7. #7
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: YouTube in Product Descriptions

    OK .

    Product Listing.
    Yeah, you will probably need to strip it out of the product listing description because it won't work there and just looks a mess. Yes, the site it was built for didn't use descriptions in the product listing so I never thought of this. So you'd need to do a bit of php in product_listing.php to strip out everything between the tags

    Second problem
    Well you are loading jQuery and the scripts in the wrong order. I think this is partly due to my bad instructions in the install notes but you need to ensure that jQuery is loaded before the scripts for zentube.

  8. #8
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: YouTube in Product Descriptions

    You are looking for something like this in product_listing.php


    Code:
            $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
    and change it for something like :

    Code:
    $temp_desc =  zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);
    $id = Getbetween($temp_desc,'','');
    $get_rid_of =''.$id.'';
    $temp_desc = str_replace($get_rid_of,'',$temp_desc);
    
    
            $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' .$temp_desc. '</div>';
    completely untested but you can give it a go.

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: YouTube in Product Descriptions

    How about this:
    PHP Code:
    $temp_desc preg_replace('![video]*[/video]!','',$temp_desc); 
    preg_replace() will handle any number of pairs of [video] tags plus content rather than just one.

  10. #10
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: YouTube in Product Descriptions

    Glenn is right. That would work better. What I'd go for is:

    Code:
    $temp_desc = preg_replace('!*!','',zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']));  
    
    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes($temp_desc)), PRODUCT_LIST_DESCRIPTION) . '</div>';
    Which does the preg_replace earlier so the length of the final string won't be altered by the preg_replace.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Embedding YouTube videos on Product pages
    By ailtait in forum General Questions
    Replies: 24
    Last Post: 23 Nov 2022, 10:56 AM
  2. Product videos from youtube [Support Thread]
    By info1 in forum All Other Contributions/Addons
    Replies: 58
    Last Post: 31 May 2018, 01:54 AM
  3. v150 Include YouTube video in product page banners
    By rashidn49 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Aug 2015, 09:23 PM
  4. embed YouTube video in product description
    By ecichlid in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 1 Dec 2008, 01:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR