Post by Kria » Thu Dec 31, 2009 4:36 am

Hello, so i have a question.
How to add new tab in product page? i need a page with tag functions like description tab.

Thank you =)

Newbie

Posts

Joined
Wed Dec 09, 2009 5:28 pm

Post by lhuman » Fri Jan 01, 2010 3:23 am

This is an example to show how the tab works.

Code: Select all


<div class="tabs">
<a tab="#tab_one"><?php echo "One"; ?></a>
<a tab="#tab_two"><?php echo "Two"; ?></a>
<a tab="#tab_three"><?php echo "Three"; ?></a>
</div>

<div id="tab_one" class="page">
    <table class="form">
      <tr>
        <td width="25%"><?php echo "This is the First Tab"; ?></td>
      </tr>
    </table>     
</div>

<div id="tab_two" class="page">
    <table class="form">
      <tr>
        <td width="25%"><?php echo "This is the Second Tab"; ?></td>
      </tr>
    </table>     
</div>

<div id="tab_three" class="page">
    <table class="form">
      <tr>
        <td width="25%"><?php echo "This is the Third Tab"; ?></td>
      </tr>
    </table>     
</div>

<script type="text/javascript"><!--
$.tabs('.tabs a'); 
//--></script>

Newbie

Posts

Joined
Sun Dec 20, 2009 9:49 pm

Post by Kria » Sat Jan 02, 2010 5:50 pm

Nice =) Thank you =)
Some problems with adding data in this tab, but not in creating few tabs. I create ne tab, with custom name, create new field in admin panel and create new field in DB, but "Undefined index:
customname in /home5/savenavi/public_html/admin/model/catalog/product.php on line 93 "
and i can't find way to define this. So help please =)

Code: Select all

92) foreach ($data['product_description'] as $language_id => $value) {
93) $this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', customname = '" . $this->db->escape($value['customname']) . "'");
94) }

Newbie

Posts

Joined
Wed Dec 09, 2009 5:28 pm

Post by lhuman » Sat Jan 02, 2010 6:30 pm

Remember to add your additional info where and if required to

admin/controller/catalog/product.php

Code: Select all

$this->data['text_customname'] = $this->language->get('text_customname');

$this->data['entry_customname'] = $this->language->get('entry_name');

$this->data['column_customname'] = $this->language->get('column_customname');

and where and if required

admin/language/english/catalog/product.php

Code: Select all


// Entry
$_['text_customname']                 = 'Custom Name';

// Column
$_['column_customname']                = 'Custom Name';

// Entry
$_['entry_customname']                 = 'Custom Name:';

and where ever you want to use it in

catalog/view/theme/default/template/product/product.tpl

Newbie

Posts

Joined
Sun Dec 20, 2009 9:49 pm

Post by Kria » Sat Jan 02, 2010 8:07 pm

Thanks for help =) when i try to submit apear this things

Code: Select all

Notice: Undefined index: customname in /home5/savenavi/public_html/admin/model/catalog/product.php on line 93
Notice: Undefined index: customname in /home5/savenavi/public_html/admin/model/catalog/product.php on line 93
Notice: Undefined index: customname in /home5/savenavi/public_html/admin/model/catalog/product.php on line 93
Warning: Cannot modify header information - headers already sent by (output started at /home5/savenavi/public_html/admin/index.php:59) in /home5/savenavi/public_html/system/engine/controller.php on line 22
all what i need it's to send data from admin panel to my DB. =(

In DB table product_description I create field customname, and i try to insert in this field data, the same mathod like description field.

Newbie

Posts

Joined
Wed Dec 09, 2009 5:28 pm

Post by lhuman » Sat Jan 02, 2010 9:33 pm

You also have to add the new information in

admin/model/catalog/product.php

Find the affected MySQL queries in the addProduct public function addProduct - will most likely be the INSERT INTO queries but also could include the UPDATE queries.

From the error message, make sure that "customname" is defined and retrace your changes to you controller file, this is giving you the headers already sent error.

Use one of the existing fields and make sure you duplicate an change it in all you files to "customname"

Newbie

Posts

Joined
Sun Dec 20, 2009 9:49 pm

Post by Kria » Sat Jan 02, 2010 10:22 pm

You also have to add the new information in
admin/model/catalog/product.php
This is line 93

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', customname = '" . $this->db->escape($value['customname']) . "'");
Find the affected MySQL queries in the addProduct public function addProduct - will most likely be the INSERT INTO queries but also could include the UPDATE queries.
From the error message, make sure that "customname" is defined and retrace your changes to you controller file, this is giving you the headers already sent error.
Explane please how to define this customname
Use one of the existing fields and make sure you duplicate an change it in all you files to "customname"

Newbie

Posts

Joined
Wed Dec 09, 2009 5:28 pm

Post by lhuman » Sun Jan 03, 2010 6:05 pm

I do not know how to explain this to you unless you understand the basics - it seems that you want to do something that is way above your level of expertise.

A good place for your to start will be http://php.net/manual/en/function.define.php

I unfortunately do not have the time to go trough your code to sort it out for you.

Newbie

Posts

Joined
Sun Dec 20, 2009 9:49 pm

Post by Kria » Mon Jan 04, 2010 5:11 am

Thank You for help, this new tab "customname" it's duplicate of "description" tab.
I create "customname" field in the same DB table "product_description" where is "description" field.
I already createa a tab in catalog dirrectory, and already create fields in admin category.
I can modify this filds by modifing data in DB admin panel. But i cant modify this field from admin panel in OC.
When i write some data in OC admin panel "customname" field i recieve note about undifine index.
So i understand that i need to define.
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', customname = '" . $this->db->escape($value['customname']) . "'");


Please say me how to make this thngs work right. Or say me please in which file are defined description field, by my opinion all what i need to do it's to duplicate this define function.

Thanks alot for help.

Newbie

Posts

Joined
Wed Dec 09, 2009 5:28 pm

Post by brandonyim » Mon Aug 16, 2010 9:48 pm

Hi,

Want to ask, how do I add a tab on every page? Currently I have "Home", "Log in", "Account", "Basket", "Checkout" and now I want to add a "Forum" tab. Once click on the "Forum" tab, it will link to the forum I installed in my hosting.

Hope someone can help here.

Thanks,
Brandon.

http://www.bigcurve.my
http://www.facebook.com/bigcurve
http://www.lelong.com.my/brandonyim
http://www.mudah.my/bigcurve
http://brandslife.blogspot.com


Newbie

Posts

Joined
Sun Nov 01, 2009 12:49 pm

Post by webvet » Mon Aug 16, 2010 10:12 pm

Check in
catalog/view/theme/YOURTHEME/template/common/header.tpl

in v1.4.8b lines 63-68 or so.

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by silvermarbles » Mon Sep 12, 2011 5:29 pm

Would this post still apply to version 1.5.0

User avatar
New member

Posts

Joined
Thu Jun 17, 2010 4:06 am
Location - Telford, Shropshire
Who is online

Users browsing this forum: No registered users and 28 guests