Page 1 of 1

Display Model in Category Grid/list View

Posted: Thu Jul 23, 2015 5:48 pm
by longcount
Hello

I am using Opencart Version 2.0.3.1 and the Journal 2.5.4 theme.

I want to display model number/reference on category grid and list view under product image and description.

I wondered if this is possible?

Thanks in advance :)

Re: Display Model in Category Grid/list View

Posted: Thu Jul 23, 2015 8:55 pm
by Kenberne1965
Anything is possible ;)

Im not sure how advanced you are? but you would need to edit the catalog/controller/product/category.php file and look for the

Code: Select all

$data['products'][] = array(); 
and insert

Code: Select all

'model' 	  => $result['model'],
after the product_id variable assignment.

it can then be accessed in the category.tpl file as

$product['model'] anywhere after the $products foreach statement.

Hope that Helps

Re: Display Model in Category Grid/list View

Posted: Thu Jul 23, 2015 9:01 pm
by longcount
Kenberne1965 wrote:Anything is possible ;)

Im not sure how advanced you are? but you would need to edit the catalog/controller/product/category.php file and look for the

Code: Select all

$data['products'][] = array(); 
and insert

Code: Select all

'model' 	  => $result['model'],
after the product_id variable assignment.

it can then be accessed in the category.tpl file as

$product['model'] anywhere after the $products foreach statement.

Hope that Helps
Thank you very much for your help :)

I will give this a try and report back.

Re: Display Model in Category Grid/list View

Posted: Thu Jul 23, 2015 9:10 pm
by viethemes
I have made a VQMOD extension to do that. You can download it here: https://www.dropbox.com/s/njh8ligmordw2 ... t.xml?dl=0.
No need to modify core files directly :)

Re: Display Model in Category Grid/list View

Posted: Thu Jul 23, 2015 9:34 pm
by longcount
Thank you to both of you :)

Re: Display Model in Category Grid/list View

Posted: Fri Jul 24, 2015 7:12 am
by Kenberne1965
viethemes wrote:I have made a VQMOD extension to do that. You can download it here: https://www.dropbox.com/s/njh8ligmordw2 ... t.xml?dl=0.
No need to modify core files directly :)
VQmod is great and it is the way to do it properly, but its also good to know how the code works ;D

Re: Display Model in Category Grid/list View

Posted: Fri Feb 19, 2016 2:55 am
by michael2820
Viethemes: thank you very much. And the visitor (and I) can search "model" in the main search function, great.

Re: Display Model in Category Grid/list View

Posted: Sat Oct 08, 2016 5:04 am
by dharam81
Hi All.

i am trying to implement this but getting error for my category grid/list product page:

Notice: Undefined index: model in template/product/category.tpl on line 147

any suggestion to fix this please?

My Ver is 2.3.0.2

Re: Display Model in Category Grid/list View

Posted: Sat Oct 08, 2016 7:40 am
by opencartboost
dharam81 wrote:Hi All.

i am trying to implement this but getting error for my category grid/list product page:

Notice: Undefined index: model in template/product/category.tpl on line 147

any suggestion to fix this please?

My Ver is 2.3.0.2
Please make sure you are add code

Code: Select all

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

Code: Select all

$data['products'][] = array(

Re: Display Model in Category Grid/list View

Posted: Sat Oct 08, 2016 2:46 pm
by dharam81
catalog/controller/product/category.php

$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'model' => $result['model'],

catalog/view/theme/journal2/template/product/category.tpl

<div class="product-details">
<div class="caption">
<h4 class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>
<h5 class="model">&nbsp;<?php echo $product['model']; ?></h5>
<p class="description"><?php echo $product['description']; ?></p>

Front End Error :
Notice: Undefined index: model in
catalog/view/theme/journal2/template/product/category.tpl on line 147

Re: Display Model in Category Grid/list View

Posted: Sat Oct 08, 2016 4:00 pm
by opencartboost
Try clear cache. If still doesn't work please contact theme developer. Should be easy for him.

Re: Display Model in Category Grid/list View

Posted: Sat Oct 08, 2016 4:25 pm
by dharam81
Thanks its working now i think it was cache issue post change

cheers

Re: Display Model in Category Grid/list View

Posted: Sat Oct 22, 2016 2:43 pm
by hassanpk
Same issue Journal theme
Any Solutions some body help me

Re: Display Model in Category Grid/list View

Posted: Sat Nov 12, 2016 1:39 pm
by hassanpk
Thanks My issue solved I have only change Journal theme version and code.

Thanks again everybody

Re: Display Model in Category Grid/list View

Posted: Tue Jan 10, 2017 4:53 pm
by kinuschan
hassanpk wrote:Thanks My issue solved I have only change Journal theme version and code.

Thanks again everybody
Can you advice how to solved and change the Jornal theme version/code ?
thanks

Re: Display Model Number in categorized Grid + List View Sec

Posted: Wed Jan 11, 2017 6:39 am
by IP_CAM
Look at this little image: :laugh:
http://www.openshop.li/downloads/Model_ ... stings.jpg
and if you like, what you see, download this sectionwise built + so easy to handle OcMod:
http://www.openshop.li/downloads/show_m ... .ocmod.zip
Thanks to Viethemes, for the input!
---
To make it possibly work for (some) JOURNAL Files, in the OcMod Extension File,
find this (OC-2 Default Theme) OcMod Anchor Tag LINE , one of a few, in the Theme-Template
related lower Sections of the OcMod:

Code: Select all

<search><![CDATA[<div class="caption">]]></search>
and replace all those lines, as shown above, with:
EITHER this Line: (J.v.2.2.x)

Code: Select all

<search><![CDATA[<div class="description"><?php echo $product['description']; ?></div>]]></search>
OR then, this Line: (J.v.2.5.x)

Code: Select all

<search><![CDATA[<p class="description"><?php echo $product['description']; ?></p>]]></search>
depending on the Theme Version you use.
Whereby, the plain OcMod ANCHOR LINK TAG CODE, TO CHANGE, is:
<div class="description"><?php echo $product['description']; ?></div>
or:
<p class="description"><?php echo $product['description']; ?></p>
everything else is just part of the OcMod-Routine itself ! ;)

You can first crosscheck, by example in your ... theme ... /template/product/category.tpl, wich
one exists, probably either starting/ending with a <p ...>...</p> , or then a <div ...>...</div>
and if not, if at least some rather similar Line exists, then to be used as valid OcMod Anchor Tag Line,
by searching for:

Code: Select all

class="description"><?php echo $product['description']
In addition, and depending of, if you want to have the MODEL Display before the Description
Display, change in ALL the sections, in the xxx.tpl file-related OcMod Sections:
from:
<add position="after">
to:
<add position="before">
and you could even add an OFFSET-Value, like
<add position="before" offset="2"> (2 written or empty! lines up from the 'anchor-tag-line')
<add position="after" offset="2"> (2 written or empty! lines down from the 'anchor-tag-line')
to move it up or down one or more lines, to look and match better.
Just be careful, to so not 'inserting' it into another routine, section, or somewhere, possibly active
only under certain conditions...! 8)
Then, it should work! But you will find out, I'm sure !

And NEVER forget, if you work on VqMods or OcMods, EVERY empty (White-)SPACE / GAP
is 'handled' like/as a piece of CODE, a SEARCH Routine may never find something, if it suddently
contains anything different from what it's exactly looking for, from the beginning [ to the end ]]
<search><![CDATA[123456 654654 aabbbc qrtz]]></search>, and if you do it like this:
<search><![CDATA[ 123456 654654 aabbbc qrtz]]></search>, it can possibly never be found.
Basic Rule Number ONE!

By Nature of things, you could remove some xxx.tpl - related sections,
from <file ... > to </file> , in the OcMod, if you don't want to have the Model
Number visible on screen, where it exists by OcMod-Default !

More similar 'Functions' could be enabled, if one uses Modules, displaying other 'Selections'
of Products, but basically working the same way - by just adding one (adapted) Routine each
to the .../controller/... and the .../template/... Section of the OcMod, just to mention this.

Journal-untested, good Luck ! ;)
Ernie
Can be seen here momentarely:
http://www.jti.li/shop/

Re: Display Model in Category Grid/list View

Posted: Wed Jan 11, 2017 12:40 pm
by kinuschan
Dear IP CAM,

Thanks for your kindly reply. :)
I have installed your extension. its perfectly running on OC 2.3.0.2 and J.v.2.8.5 :good:
Thanks ;)

Re: Display Model in Category Grid/list View

Posted: Wed Jan 11, 2017 1:19 pm
by IP_CAM
Good for you !
Take Care... ;)
Ernie