Post by dev123 » Thu Aug 24, 2017 7:13 pm

Hi all,

I am new in OpenCart community. First of all thanks to opencart for making this product.

I need help from you.

I want to show an extra value when user open store site. To do this I edit feature.tpl and php page. Add column in database. But I am getting Notice: Undefined index: enquire in /catalog/controller/extension/module/featured.php in line 71 error after adding a new column and restarting opencart home page.

Here is the step that I have done :

Step 1: Added one column "enquire"(type int) in PRODUCT table.

Step 2: Update INSERT and UPDATE query of admin\model\catalog/product.php page (in addProduct($data) and editProduct($product_id, $data) function.)

Step 3: Edit admin\view\template\catalog\product_form.tpl to edit "enquire" field by admin user.

Step 4: Edit \catalog\view\theme\default\template\extension\module\featured.tpl to dispaly "enquire" field value.
<span class="fa fa-stack"><?php echo $product['enquire']; ?></span>

Step 5: Edit catalog\controller\extension\module\featured.php file to add "enquire" clolumn value in products array.

$data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $rating,
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
'enquire' => $product_info['enquire']
);

After that when I restart application it getting error in the top of the page.

Can anyone guide/help me how I get value in step 4 ($product['enquire']).

Please help.

System Information: OpenCart 2.3.0.2/ Linux 64 bit / XAMPP 5.6.20

Newbie

Posts

Joined
Wed Nov 02, 2016 3:53 pm

Post by opencartboost » Sat Aug 26, 2017 11:48 pm

You need add code in file product.php at catalog/model/catalog/product.php
Find :

Code: Select all

'model'            => $query->row['model'],
Add after :

Code: Select all

'enquire'            => $query->row['enquire'],

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by dev123 » Mon Aug 28, 2017 10:20 pm

Thank You very much,

You save my days....

its working.....

Newbie

Posts

Joined
Wed Nov 02, 2016 3:53 pm
Who is online

Users browsing this forum: 7cswinery, Bing [Bot] and 36 guests