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');
Code: Select all
$this->data['entry_video'] = $this->language->get('entry_video');
Code: Select all
$this->data['keyword'] = '';
}
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'] = '';
}
Find Line 32
Code: Select all
$_['entry_keyword'] = 'SEO Keyword:';
Code: Select all
$_['entry_video'] = 'Related Video:';
Find Line 3
Code: Select all
public function addProduct($data) {
Code: Select all
stock_status_id = '" . (int)$data['stock_status_id'] . "',
Code: Select all
video = '" . $this->db->escape($data['video']) . "',
Find Line 98
Code: Select all
public function editProduct
Code: Select all
stock_status_id = '" . (int)$data['stock_status_id'] . "',
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>
find line 137
locate
Code: Select all
$this->data['text_qty'] = $this->language->get('text_qty');
Code: Select all
$this->data['text_video'] = $this->language->get('text_video');
Code: Select all
$this->data['model'] = $product_info['model'];
Code: Select all
$this->data['video'] = $product_info['video'];
Find Line 3
Code: Select all
public function getProduct($product_id) {
Code: Select all
ss.name AS stock FROM
Code: Select all
ss.name AS stock, video FROM
Find line 21
Insert after
Code: Select all
$_['text_video'] = 'Related Video';
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
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