Post by vinhpk » Fri Dec 07, 2018 4:02 pm

Hi, I got trouble while try to display SKU on product page.

In \catalog\controller\product\product.php
after

Code: Select all

$data['model'] = $product_info['model'];
added

Code: Select all

$data['sku'] = $product_info['sku'];
In \catalog\view\theme\journal2\template\product\product.tpl
after

Code: Select all

<li class="p-model"><?php echo $text_model; ?> <span class="p-model" itemprop="model"><?php echo $model; ?></span></li>
added

Code: Select all

<li class="p-model">SKU: <span class="p-model" itemprop="sku"><?php echo $sku; ?></span></li>
But I still got this error:

Code: Select all

Notice: Undefined variable: sku in..... 
I tried this with another site and everything ok, but with journal2 theme, I can not add any other variable to product, category , cart, ..... page. Can some one help me? Thanks!

New member

Posts

Joined
Sat Dec 29, 2012 12:13 pm

Post by xxvirusxx » Fri Dec 07, 2018 11:59 pm

You have added here ...?

Code: Select all

$data['products'][] = array(
Also you can use an extension or to download to make an ideea

https://www.opencart.com/index.php?rout ... n_id=23901
https://www.opencart.com/index.php?rout ... n_id=15258

Attachments

sku.png

sku.png (20.73 KiB) Viewed 177 times


Free converted extensions


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by vinhpk » Sat Dec 08, 2018 11:01 am

xxvirusxx wrote:
Fri Dec 07, 2018 11:59 pm
You have added here ...?

Code: Select all

$data['products'][] = array(
Also you can use an extension or to download to make an ideea

https://www.opencart.com/index.php?rout ... n_id=23901
https://www.opencart.com/index.php?rout ... n_id=15258
I tried this but nothing change, I wil try above extensions and let you know, thanks you!

Code: Select all

$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'sku'	      => $sku,
					'mpn'	      => $mpn,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $rating,
					'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
				);

New member

Posts

Joined
Sat Dec 29, 2012 12:13 pm

Post by xxvirusxx » Sat Dec 08, 2018 4:31 pm

You have refreshed ocmod?

Free converted extensions


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by vinhpk » Sun Dec 09, 2018 11:04 pm

xxvirusxx wrote:
Sat Dec 08, 2018 4:31 pm
You have refreshed ocmod?
God damn it, I forgot, they are all set, thanks you!

New member

Posts

Joined
Sat Dec 29, 2012 12:13 pm
Who is online

Users browsing this forum: Mike Guenther and 78 guests