Post by Estu » Fri Sep 15, 2017 9:35 pm

Hello,
I'm using Opencart Version 3.0.2.0, and need to display model number/reference on category page.

Tray to change file ...\catalog\controller\product\category.php
after

Code: Select all

'name'        => $result['name'],
add

Code: Select all

'model'       => $result['model'],
and change file .... \catalog\view\theme\default\template\product\category.twig

after

Code: Select all

<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>
<p>{{ product.description }}</p>
add

Code: Select all

<p>{{ text_model }} {{ model }}</p>
but nothing hapend ! ???

Anyone?

User avatar
Newbie

Posts

Joined
Fri Jul 28, 2017 8:26 pm

Post by yodapt » Fri Sep 15, 2017 10:31 pm

catalog/model/catalog/product.php, line 60

Where it starts with

Code: Select all

$sql = "SELECT p.product_id,
Add p.model

Code: Select all

$sql = "SELECT p.model, p.product_id,
Didn't test it.

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by Estu » Sat Sep 16, 2017 4:53 am

yodapt wrote:
Fri Sep 15, 2017 10:31 pm
catalog/model/catalog/product.php, line 60

Where it starts with

Code: Select all

$sql = "SELECT p.product_id,
Add p.model

Code: Select all

$sql = "SELECT p.model, p.product_id,
Didn't test it.
Thank you but unfortunatly it doesn't work.

User avatar
Newbie

Posts

Joined
Fri Jul 28, 2017 8:26 pm

Post by yodapt » Sat Sep 16, 2017 5:25 am

You probably didnt refresh your theme cache in admin.

Attachments

example.png

example.png (38.08 KiB) Viewed 12400 times


Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by opencartboost » Sat Sep 16, 2017 8:51 am

On file category.twig, try change your code from

Code: Select all

<p>{{ text_model }} {{ model }}</p>
To

Code: Select all

<p>{{ text_model }} {{ product.model }}</p>
Don't forget to clear cache too.

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by Estu » Sat Sep 16, 2017 2:50 pm

yodapt wrote:
Sat Sep 16, 2017 5:25 am
You probably didnt refresh your theme cache in admin.
Thank you so much, you are genius :)

User avatar
Newbie

Posts

Joined
Fri Jul 28, 2017 8:26 pm

Post by Estu » Sat Sep 16, 2017 2:50 pm

opencartboost wrote:
Sat Sep 16, 2017 8:51 am
On file category.twig, try change your code from

Code: Select all

<p>{{ text_model }} {{ model }}</p>
To

Code: Select all

<p>{{ text_model }} {{ product.model }}</p>
Don't forget to clear cache too.
Thank you

User avatar
Newbie

Posts

Joined
Fri Jul 28, 2017 8:26 pm

Post by raconul » Fri Jun 28, 2019 5:29 pm

I want to do the same thing, but it does not work. Can someone help me? Maybe I am missing something. Thanks!

OpenCart 3.0.2.0 - Customized Default Theme
changed catalog/model/catalog/product.php, line 60 like this:

Code: Select all

$sql = "SELECT p.model, p.product_id,
in \catalog\controller\product\category.php I have added:

Code: Select all

'model'       => $result['model'],
in \catalog\view\theme\default\template\product\latest.twig and featured.twig added:

Code: Select all

<p>{{ text_model }} {{ model }}</p>
also have tried:

Code: Select all

<p>{{ text_model }} {{ product.model }}</p>
Cleared the theme cache, but nothing happens :(

My store: creeps.ro

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by letxobnav » Fri Jun 28, 2019 6:15 pm

if you want to add the model to latest.twig and featured.twig you need to alter the corresponding controllers:

catalog/controller/extension/module/latest.php

add

Code: Select all

'model'        => $result['model'],
after

Code: Select all

'name'        => $result['name'],
catalog/controller/extension/module/featured.php

add

Code: Select all

'model'        => $product_info['model'],
after

Code: Select all

'name'        => $product_info['name'],
(shame they use different array names)

then you can display it in the twig files with:

Code: Select all

<p>{{ text_model }} {{ product.model }}</p>

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by raconul » Fri Jun 28, 2019 7:37 pm

Thanks for your reply letxobnav,
I've made a mistake. Instead of \catalog\controller\product\category.php I did mean to say:
catalog/controller/extension/module/latest.php
and
catalog/controller/extension/module/featured.php

And still does not work :( Could it be something else? In the inspect element console all I get is <p> </p>

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by letxobnav » Fri Jun 28, 2019 8:48 pm

you cleared your theme cache right?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by raconul » Fri Jun 28, 2019 8:58 pm

letxobnav wrote:
Fri Jun 28, 2019 8:48 pm
you cleared your theme cache right?
Yes. The model does not show :(

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by letxobnav » Fri Jun 28, 2019 9:07 pm

first of all, don't do this:

$sql = "SELECT p.model, p.product_id,

there is no need as both modules use the getproduct function which gets all product fields already.

where does the model not show, latest or featured?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by raconul » Fri Jun 28, 2019 9:25 pm

letxobnav wrote:
Fri Jun 28, 2019 9:07 pm
first of all, don't do this:

$sql = "SELECT p.model, p.product_id,

there is no need as both modules use the getproduct function which gets all product fields already.

where does the model not show, latest or featured?
Ok. I have removed the "p.model" from $sql =
Cleared again the cache. It still does not work.
It does not show in both: latest and featured - on my homepage

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by letxobnav » Fri Jun 28, 2019 9:47 pm

ok, tell me exactly what you did to which file.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by raconul » Fri Jun 28, 2019 11:31 pm

letxobnav wrote:
Fri Jun 28, 2019 9:47 pm
ok, tell me exactly what you did to which file.
in catalog/controller/extension/module/latest.php
added the second line:

Code: Select all

					
'name'        => $result['name'],
'model'       => $result['model'],
in catalog/controller/extension/module/featured.php
added the second line:

Code: Select all

'name'        => $product_info['name'],
'model'        => $product_info['model'],
and in Admin Dashboard > Design > Theme editor >
extension/module/latest
added the second line:

Code: Select all

        
<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>
 <p>{{ text_model }} {{ product.model }}</p>
Admin Dashboard > Design > Theme editor >
extension/module/featured
added the second line:

Code: Select all

<h4><a href="{{ product.href }}">{{ product.name }}</a></h4>
<p>{{ text_model }} {{ product.model }}</p>
+Cleared the Cache theme

I also have a friend who is a php developer, and he tried (by screen share) to follow the "model" from the database.... and at some point he could not find through which file it is going... and said he could not help me. And gave up :(

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by letxobnav » Sat Jun 29, 2019 8:50 am

ah, the theme editor, don't use that, IMO it's a fragile piece of junk.

either directly edit your twig files or use ocmod.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by xxvirusxx » Sat Jun 29, 2019 5:47 pm

raconul wrote:
Fri Jun 28, 2019 11:31 pm
+Cleared the Cache theme
First refresh ocmod modifications, vqmod (if you have), then clear Theme cache, SASS cache.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by raconul » Thu Jul 11, 2019 6:36 pm

Unfortunately, {{ text_model }} and {{ product.model }} does not work in the twig. Other strings like {{ product.description}} {{ product.name }} works just fine. The model does not reach the twig file. Something is missing.
And it's frustrating because Estu has the same version, and he managed to get it to work. Hmmm.

User avatar
New member

Posts

Joined
Thu May 18, 2017 1:54 am

Post by straightlight » Thu Jul 11, 2019 6:37 pm


Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot] and 114 guests