Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2017
    Location
    West Midlands, UK
    Posts
    50
    Plugin Contributions
    1

    Default YouTube Videos display for Zen Cart [Support Thread]

    Hi,
    I have just submitted a new module to allow YouTube video display on products. It is now available on Github.

    ## Overview

    This module adds YouTube video functionality to Zen Cart product pages. Store owners can easily add a YouTube video ID to any product in the admin panel, and the video will be displayed on the product's detail page in the storefront.

    ## Features

    - **Easy Admin Interface**: Add YouTube video IDs directly in the product edit form
    - **Responsive Video Display**: Videos are displayed in a responsive iframe that adapts to different screen sizes
    - **Privacy-Focused**: Uses `youtube-nocookie.com` domain to minimize tracking

    ## Requirements

    - Zen Cart v2.0.0 or higher (tested with v2.1.0)
    - PHP 7.4 or higher

    Moderators – please use the second version I submitted (v1.0.1) with the updated readme file.

  2. #2
    Join Date
    Jul 2017
    Location
    West Midlands, UK
    Posts
    50
    Plugin Contributions
    1

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Zen Cart Iframes In Product Descriptions

    The reason I developed this module was due to the limitations with CKEditor 5 – any existing iframes are removed when saving product descriptions. Essentially, iframes are no longer supported in Zen Cart 2.1.0 product descriptions.

    This module allows YouTube video iframes to be embedded on product pages – hopefully this will be helpful to some users.

  3. #3
    Join Date
    Jul 2017
    Location
    West Midlands, UK
    Posts
    50
    Plugin Contributions
    1

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Following some very helpful feedback on GitHub I have updated the module to version 1.0.3. The following changes have been made:

    1) Module has been refactored to eliminate the need for a modified main_template_vars.php
    2) The module now only requires one modified core file (tpl_product_info_display.php for the HTML) instead of two, significantly reducing upgrade conflicts and maintenance burden.
    3) Removed the need for the admin auto-loading config file

  4. #4
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Nice one!

    May I just suggest one tiny improvement? Don't force admins to "extract" the video ID - it's a waste of time and leaves room for error (by accidentally deleting a character). Allowing a copy/paste from the address bar or using the Share button on YT makes it easier and much faster for the admin... Here's a function I use on multiple sites (tested):
    Code:
    function extractYouTubeID($url) {
        // If it's already an ID (no "http" in it), return as is
        if (preg_match('/^[a-zA-Z0-9_-]{11}$/', $url)) {
            return $url;
        }
    
        // Parse the URL
        $parsedUrl = parse_url($url);
    
        // Check for short YouTube URL
        if (isset($parsedUrl['host']) && $parsedUrl['host'] === 'youtu.be' && isset($parsedUrl['path'])) {
            return ltrim($parsedUrl['path'], '/');
        }
    
        if (!isset($parsedUrl['query'])) {
            return false; // Invalid format
        }
    
        // Parse query parameters
        parse_str($parsedUrl['query'], $queryParams);
    
        // Return the video ID if it exists
        return $queryParams['v'] ?? false;
    }
    You can place it in your observer file and simply call it instead of
    Code:
    $youtube_video_id = preg_replace('/[^a-zA-Z0-9_-]/', '', $youtube_video_id);

  5. #5
    Join Date
    Jul 2017
    Location
    West Midlands, UK
    Posts
    50
    Plugin Contributions
    1

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Many thanks for your suggestion. Your right, that would be much easier for end users.

    I've updated the module to v1.0.4 incorporating your extractYouTubeID() function - users can now simply paste full YouTube URLs, short URLs or just the video ID, and the system automatically handles the extraction.

    I have sent v1.0.4 to Zen Cart for review. Your feedback is much appreciated.

  6. #6
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    984
    Plugin Contributions
    6

    Default Re: Zen Cart YouTube Videos [Support Thread]

    could this plugin be used to add videos to banners?

  7. #7
    Join Date
    Jul 2017
    Location
    West Midlands, UK
    Posts
    50
    Plugin Contributions
    1

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Quote Originally Posted by dw08gm View Post
    could this plugin be used to add videos to banners?
    Unfortunately, this mod is currently only suitable for adding YouTube videos to the product info page. However, I am currently testing a new slider & banner module. I plan to include the following functionality with the new mod:

    Standard (single) banner
    Slider (slideshow) banners
    Tile banners (grid layout of multiple banners)
    YouTube video banner (standard single video display)

    I intend to allow a YouTube video ID or URL to be entered in the admin – this would be ideal for a homepage video banner. I believe YouTube video banners can be created using third-party software such as adobe express

    Is this what you had in mind, or were you looking to add self-hosted videos or other functionality?

    If the new mod is of interest, please let me know and I will publish a copy for beta testing.

  8. #8
    Join Date
    Oct 2009
    Posts
    437
    Plugin Contributions
    0

    Default Re: Zen Cart YouTube Videos [Support Thread]

    Thanks for a great plugin richard7315!

    Installed very easily and is such a useful marketing assist on my site!

 

 

Similar Threads

  1. Square Payment Module for Zen Cart [Support Thread]
    By DrByte in forum Addon Payment Modules
    Replies: 820
    Last Post: 16 May 2026, 01:07 AM
  2. Product videos from youtube [Support Thread]
    By info1 in forum All Other Contributions/Addons
    Replies: 59
    Last Post: 3 Nov 2025, 01:08 AM
  3. WordPress® for Zen Cart® (wp4zen) [Support Thread]
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 109
    Last Post: 1 Dec 2024, 01:36 PM
  4. v154 Support Thread: AddToAny for Zen Cart (The Universal Sharing Platform)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 8 Apr 2019, 02:39 PM

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