Page 1 of 1

Duplicate Model details (solved)

Posted: Sat Aug 01, 2015 2:23 am
by mash0028
hello I hope I get answer to my simple question.

I duplicate the model (text) to add additional details about the products than having it written in description.
[img] Screen Shot 2015-08-01 at 2.18.27 AM.png
[/img]

File from: admin/controller/catalog/product.php

if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);




if (isset($this->request->post['model'])) {
$data['model'] = $this->request->post['model'];
} elseif (!empty($product_info)) {
$data['model'] = $product_info['model'];
} else {
$data['model'] = '';


everything is okay except this error:

Notice: Undefined index: usage in /home2/berrylen/public_html/admin/controller/catalog/product.php on line 802Notice: Undefined index: bc in /home2/berrylen/public_html/admin/controller/catalog/product.php on line 810Notice: Undefined index: madein in /home2/berrylen/public_html/admin/controller/catalog/product.php on line 818

ERROR LINE IS:

if (isset($this->request->post['usage'])) {
$data['usage'] = $this->request->post['usage'];
} elseif (!empty($product_info)) {
$data['usage'] = $product_info['usage'];
} else {
$data['usage'] = '';
}

if (isset($this->request->post['bc'])) {
$data['bc'] = $this->request->post['bc'];
} elseif (!empty($product_info)) {
$data['bc'] = $product_info['bc'];
} else {
$data['bc'] = '';
}

if (isset($this->request->post['madein'])) {
$data['madein'] = $this->request->post['madein'];
} elseif (!empty($product_info)) {
$data['madein'] = $product_info['madein'];
} else {
$data['madein'] = '';
}



as written above code:

if (isset($this->request->get['product_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);


product_info is in model/catalog/product and get product_id, if I am correct. where should I put additional code in product.tpl

Hoping for your kind response about product_info or product_id. :) ;) :D ;D


I already made in it, but I got an error with product_info. :)

Re: Duplicate Model details

Posted: Sat Aug 01, 2015 4:43 am
by artcore
Did you add the columns 'usage' and 'bc' to the product table? product_info returns all the db columns for that id. If they don't exist it'll give the error.
You could use existing unused fields for this, like 'location' and perhaps 'ean' as an easier solution

Re: Duplicate Model details

Posted: Mon Oct 12, 2015 5:32 pm
by mash0028
thank you for reply, Yes I already use those extra field for my product details

Thank you

Re: Duplicate Model details

Posted: Tue Oct 13, 2015 7:32 am
by straightlight
Can you demonstrate a screenshot of your product table fields from PHPMyAdmin? For now, it looks like you created those fields only from the form but not from PHPMyAdmin. The Opencart Admin Product Model loads all the fields from the product table of the database; no exceptions.