Post by SXGuy » Mon Aug 02, 2010 6:47 pm

Here are the instructions on how to create the mod.

This is for version 1.4.8b but should work for any previous version providing you follow the correct folder structure.
This was made created originally by me for 1.3.2 and updated to 1.4.8b

PLEASE PLEASE PLEASE BACK UP EVERYTHING YOU MODIFY BEFORE ADDING THIS MOD

I will not be responsible for anything you mess up while adding this modification.

Edit mysql database 'oc_product' table

insert new column after 'stock_status_id'

Name new column 'video'

i.e

Code: Select all

ALTER TABLE oc_product ADD video VARCHAR(60) AFTER stock_status_id;

/admin/controller/catalog/product.php

Find Line 493

Code: Select all

$this->data['entry_keyword'] = $this->language->get('entry_keyword');
Add underneath

Code: Select all

$this->data['entry_video'] = $this->language->get('entry_video');
Find Line 690

Code: Select all

$this->data['keyword'] = '';
}
Add after the closing bracket (Line 692)

Code: Select all

if (isset($this->request->post['video'])) {
         $this->data['video'] = $this->request->post['video'];
      } elseif (isset($product_info)) {
         $this->data['video'] = $product_info['video'];
      } else {
         $this->data['video'] = '';
      }
/admin/language/english/catalog/product.php

Find Line 32

Code: Select all

$_['entry_keyword']          = 'SEO Keyword:';
Add underneath

Code: Select all

$_['entry_video']            = 'Related Video:';
admin/model/catalog/product.php

Find Line 3

Code: Select all

public function addProduct($data) {
Locate

Code: Select all

stock_status_id = '" . (int)$data['stock_status_id'] . "',
Insert after the comma

Code: Select all

video = '" . $this->db->escape($data['video']) . "',

Find Line 98

Code: Select all

public function editProduct
Locate

Code: Select all

stock_status_id = '" . (int)$data['stock_status_id'] . "',
Insert after comma

Code: Select all

video = '" . $this->db->escape($data['video']) . "',

/admin/view/template/catalog/product_form.tpl

Find </tr> on line 159

insert after

Code: Select all

<tr>
     <td><?php echo $entry_video; ?></td>
     <td><input type="text" name="video" value="<?php echo $video; ?>" /></td>
</tr>
catalog/controller/product/product.php

find line 137

locate

Code: Select all

$this->data['text_qty'] = $this->language->get('text_qty');
insert after

Code: Select all

$this->data['text_video'] = $this->language->get('text_video');
find Line 238

Code: Select all

$this->data['model'] = $product_info['model'];
insert after

Code: Select all

$this->data['video'] = $product_info['video'];
catalog/model/catalog/product.php

Find Line 3

Code: Select all

public function getProduct($product_id) {
Locate

Code: Select all

ss.name AS stock FROM
replace with

Code: Select all

ss.name AS stock, video FROM
catalog/language/english/product/product.php

Find line 21

Insert after

Code: Select all

$_['text_video']        = 'Related Video';
catalog/view/theme/YOURTHEME/template/product/product.tpl

Find </table> on line 108

insert after

Code: Select all

<?php if ($video) { ?>
         <div align="center"><?php echo $text_video; ?><br>
        <object width="425" height="350"><param name="movie" value="<?php echo $video; ?>"></param><param name="wmode" value="transparent"></param><embed src="<?php echo $video; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
</div>
    <?php } ?>

Now login to the admin side of opencart, go to Catalog Tab > Products > Data Tab
Go down to Related Video and paste a youtube link, or any other video link for example: http://www.youtube.com/v/PMJmqxl_eqM

You should now have related video for your product

Image

Q&A

Q: My video doesnt load why?

A: Some youtube links forbid embedding video, please check the link you are using.

Q: Ive checked the youtube link and it does allow embedding, but it still doesnt show, why?

A: Make sure you have followed every step, it is very easy to forget a section.

Q: Ive installed a new template but i have lost the related video.

A: You will need to replace the file located at catalog/view/theme/YOURTHEME/template/product/product.tpl
with the one included in this mod located at catalog/view/theme/default/template/product/product.tpl

I hope this helps all of you who have been messaging me over the last few months asking for the how to.
If anyone has problems, do not hesitate to contact me, but please make sure you follow all steps first, and check you have done everything correctly.


I have also attached the files needed should you be lazy :)

Attachments

Related Video Mod for OC 1.4.8b


Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by musicofthehart » Mon Aug 02, 2010 11:41 pm

Works perfectly, Thanks!!!

New member

Posts

Joined
Fri Jul 16, 2010 3:42 pm

Post by OSWorX » Tue Aug 03, 2010 12:08 am

Great enhancement and very good work!
But could be also easily achieved if instead the standard editor CKeditor the TinyMCE is used.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by SXGuy » Tue Aug 03, 2010 3:34 pm

Yes TinyMCE could be used instead, but correct me if im wrong, that would mean dropping a video into each and every product descripton right?

I would bet that its far more easier and quicker to use an input box under every data tab for each product.

You could go even further by just editing your mysql database and dropping links into the video collumn rather than having to sit on the admin panel doing it all waiting for each page to load, doing this method using the product description would take so much longer due to all the other code surrounding it.

I would love to see someone adapt this to be used with some kind of video download cart, you could easily replace the product image with the video to preview your download. that would be kinda cool.

EDIT: please let me know if you guys think it would be of benifit to have a custom width and height setting for each related video alongside the input box for the url link, if you feel this would be of benifit, i will add that to the how to for you all

Then you could have a default size to be dropped into the embedded code, or change the size should you wish.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by OSWorX » Tue Aug 03, 2010 3:53 pm

As said, this can be a great addition!
And well done and the displayed howto - kudos!

But it needs to adopting the core which can be avoided with the editor TinyMCE - and not everybody knows how to edit files.
And about that 'I would bet that its far more easier and quicker to use an input box under every data tab for each product': the editor is on per default and there is no extra tab needed.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by qahar » Tue Aug 03, 2010 4:46 pm

OSWorX wrote:And about that 'I would bet that its far more easier and quicker to use an input box under every data tab for each product': the editor is on per default and there is no extra tab needed.
i thinks its true..
but, however, it still cool stuff. I've been added to collection links
Last edited by qahar on Wed Aug 04, 2010 7:18 am, edited 1 time in total.

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by SXGuy » Tue Aug 03, 2010 6:24 pm

Ok fair point guys :)

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by lpoolfan » Wed Aug 18, 2010 9:55 pm

Hi guys

New here, great mod by the way :) i seem to be having a problem, where do i find the oc_product file to edit it, ive searched my cPanel for hours and can't seem to find it :(, and i'm getting this error.

Error: Unknown column 'video' in 'field list'
Error No: 1054
SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, video FROM product p LEFT JOIN product_description pd ON (p.product_id = pd.product_id) LEFT JOIN product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.product_id = '52' AND pd.language_id = '1' AND p2s.store_id = '0' AND ss.language_id = '1' AND p.date_available <= NOW() AND p.status = '1'

Any help would be great :)

Newbie

Posts

Joined
Wed Aug 18, 2010 9:38 pm

Post by cmebd » Sat Aug 21, 2010 5:52 pm

ALTER TABLE oc_product ADD video VARCHAR(60) AFTER stock_status_id;
I think you will find that the reference to oc_ is the prefix to the tables within the dbase.

You need to either remove oc_ if you didn't set up a prefix for your tables OR change the query to "[yrprefix_]product"

HTH

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by SXGuy » Sat Aug 21, 2010 7:25 pm

cmebd wrote:
ALTER TABLE oc_product ADD video VARCHAR(60) AFTER stock_status_id;
I think you will find that the reference to oc_ is the prefix to the tables within the dbase.

You need to either remove oc_ if you didn't set up a prefix for your tables OR change the query to "[yrprefix_]product"

HTH
Correctamondo

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by silanli_53 » Wed Sep 01, 2010 9:44 pm

SQL sorgusu:

ALTER TABLE product ADD video VARCHAR( 60 ) AFTER stock_status_id

MySQL çıktısı: Belgeler
#1060 - Duplicate column name 'video'

Cafe Koltuk Çeşitleri

Laptop Sırt Çantası


User avatar
New member

Posts

Joined
Fri Feb 19, 2010 8:54 am


Post by cavus34 » Thu Sep 02, 2010 8:12 pm

PHP myadmin problem



SQL sorgusu:

ALTER TABLE oc_product ADD video VARCHAR( 60 ) AFTER stock_status_id

MySQL çıktısı: Belgeler
#1146 - Table 'derde.oc_product' doesn't exist

Newbie

Posts

Joined
Thu Sep 02, 2010 8:01 pm

Post by SXGuy » Mon Sep 06, 2010 3:15 pm

cavus34 wrote:PHP myadmin problem



SQL sorgusu:

ALTER TABLE oc_product ADD video VARCHAR( 60 ) AFTER stock_status_id

MySQL çıktısı: Belgeler
#1146 - Table 'derde.oc_product' doesn't exist
Its telling you the problem if you just read the error?

Either your table name isnt called oc_product or you did something wrong, my guess would be to look at "derde.oc_product"

Is THAT the name of your product table??? if not, then change the sql query to match the table name ::)

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Gilmore » Tue Sep 28, 2010 12:49 pm

HI SXGuy,
I made a little edit in a few files.
  • catalog/view/theme/YOURTHEME/template/product/product.tpl
    catalog/controller/product/product.php
    catalog/language/english/product/product.php
I added the http://www.youtube.com/v/ link to template code. Now you only have to add the YouTube video ID number instead of the embed link in the products Admin data tab.
If the YouTube link is... http://www.youtube.com/watch?v=PMJmqxl_eqM
Then the YouTube ID code is PMJmqxl_eqM

In catalog/view/theme/YOURTHEME/template/product/product.tpl
Find:

Code: Select all

<?php if ($video) { ?>
         <div align="center"><?php echo $text_video; ?><br>
        <object width="425" height="350"><param name="movie" value="<?php echo $video; ?>"></param><param name="wmode" value="transparent"></param><embed src="<?php echo $video; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
</div>
    <?php } ?>
Replace with:

Code: Select all

    <?php if ($video) { ?>
             <div align="center"><?php echo $text_video; ?><br>
            <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/<?php echo $video; ?><?php echo $youtube_products; ?>"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/<?php echo $video; ?><?php echo $youtube_products; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
    </div>
        <?php } ?>
In catalog/language/english/product/product.php I added the YouTube extension, ?fs=1&hl=en_US&rel=0
FInd:

Code: Select all

$_['text_video']        = 'Related Video';
and after that add:

Code: Select all

$_['youtube_products']  = '?fs=1&hl=en_US&rel=0';
Now in catalog/controller/product/product.php
Find:

Code: Select all

    $this->data['text_video'] = $this->language->get('text_video');
And after that add:

Code: Select all

   $this->data['youtube_products'] = $this->language->get('youtube_products');
I hope everyone enjoys!

Gil

User avatar
Active Member

Posts

Joined
Thu Aug 12, 2010 7:33 am

Post by SXGuy » Tue Sep 28, 2010 3:22 pm

Cool addition.

I left it the full link originally because i wasnt sure if there were any other video hosting websites which work in a similar way, which then could be used instead of a youtube link.

But if people purely want it for youtube, then your modification makes it easier for them :)

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by aras » Mon Dec 13, 2010 9:58 pm

great work, I am too new to this so i'll wait a bit before trying this . this does not work with the latest version of opencart, right ??

Newbie

Posts

Joined
Mon Dec 13, 2010 6:01 am

Post by SXGuy » Mon Dec 13, 2010 11:27 pm

as far as im aware it should work with any latest version of opencart, process should be the same, unless the model files have been changed, which i dont think they have.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by LadyRagefist » Fri Dec 24, 2010 2:25 am

Thank you for this mod, it was more helpful than the actual support team. Go figure.

Newbie

Posts

Joined
Thu Dec 23, 2010 3:02 am

Post by pixel » Wed Jan 26, 2011 1:42 am

Add player to this mod. Add projekktor player.
create a folder in default theme folder, named :: js :: (not :: this are only to see better)
download projekktor player from http://www.projekktor.com/
copy the projekktor.min.js, jarisplayer.swf files and the folder maccaco to the :: js :: folder
add this to the product.tpl
<script type="text/javascript" src="catalog/view/theme/default/js/projekktor.min.js"></script> <!-- load projekktor -->
<link rel="stylesheet" href="catalog/view/theme/default/js/minimum/style.css" type="text/css" media="screen" />
at the end of the page,

and this code

<video id="demoplayer" class="projekktor" title="plaster session" poster="image/data/logo.png" src="http://www.youtube.com/v/<?php echo $video; ?>" type="video/youtube" width="425" height="350" controls>
</video>

<script type="text/javascript">
$(document).ready(function() {
projekktor('#demoplayer', {plugin_logo: {logo:"image/data/logo.png"}});
})
</script>

Image


Modules: Facebook Slide Likebox 3 in 1 module for opencart 1.5 Page Peel for Opencart 1.5 Maintenance countdown for opencart 2 in 1 facebook and twitter slidebox

Themes: Pets theme for opencart 1.5 Wood theme for opencart 1.5 Glamor theme for opencart

and more at pixel store


New member

Posts

Joined
Fri Oct 01, 2010 11:35 am
Location - Romania

Post by SXGuy » Wed Jan 26, 2011 5:34 am

nice addition cheers.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am
Who is online

Users browsing this forum: No registered users and 17 guests