Post by joss » Fri Nov 04, 2016 1:27 am

Hello to all,
I welcome the community of Opencart which I just started learning for the specific e-commerce platform recently.

Using VQMOD I have successfully inserted the product model instead of name in product grid.
Though, after using taxonomy, navigation filters or pagination the grid brings back the product name.

Most probable is that somewhere in javascript code requests again the product name. Does anyone know at which part of the code is that?

Thanks in advance..
Opencart 2.1.0.2 & Journal Theme

The vqmod contents are the following.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>

<modification>
	<id><![CDATA[Product Model in Category]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver><![CDATA[2.1x]]></vqmver>
	<author><![CDATA[Author]]></author>

<file name="/catalog/view/theme/journal2/template/product/category.tpl">
		<operation>
			<search position="replace"><![CDATA[<h4 class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>]]></search> 
			<add><![CDATA[<h4 class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['model']; ?></a></h4>]]>
			</add>
		</operation>
</file>	

</modification>

Newbie

Posts

Joined
Fri Nov 04, 2016 1:10 am

Post by knowband.plugins » Fri Nov 04, 2016 5:52 pm

In the same file, you might need to modify a javascript function display(view) {... }

Regards,
Knowband Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by joss » Fri Nov 04, 2016 11:49 pm

Yes but which function would be?
If you direct me to the file at least I could search which part of the code to change.

I'm new to opencart and still trying to find how this whole system works..
Thanks
knowband.plugins wrote:In the same file, you might need to modify a javascript function display(view) {... }

Newbie

Posts

Joined
Fri Nov 04, 2016 1:10 am

Post by IP_CAM » Sat Nov 05, 2016 1:26 am

There is no Script involved with this, it just misses the Model Declaration in the Array! ::)
Ernie

catalog/controller/product/category.php
OLD:

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($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);
NEW:

Code: Select all

$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'model'        => $result['model'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);
/theme/template/product/category.tpl (Basic Output Code)

Code: Select all

<div>Model: <?php echo $product['model']; ?></div>
The revised VqMod would therefore look like this: (tested with OC v.2.2.x Default Theme)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<modification>
<id><![CDATA[Product Model in Category]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[2.5.x]]></vqmver>
<author><![CDATA[Ernie - IP_CAM]]></author>
       
    <file name="catalog/controller/product/category.php">
    <operation error="log">
    <search position="after"><![CDATA[$result['name'],]]></search>
    <add><![CDATA[
       'model'        => $result['model'],
    ]]></add>
    </operation>
    </file> 
       
    <file name="catalog/view/theme/*/template/product/category.tpl">
    <operation error="log">
    <search position="after"><![CDATA[<div class="caption">]]></search>
    <add><![CDATA[
       <div>Model: <?php echo $product['model']; ?></div>
    ]]></add>
    </operation>
    </file>   
    </modification>
---
PS: And here is another VqMod, to display the Manufacturer the same way in the Category Section:
viewtopic.php?f=182&t=170072&p=645254#p645254
---
Last edited by IP_CAM on Tue Nov 08, 2016 8:58 am, edited 2 times in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by joss » Mon Nov 07, 2016 10:07 pm

Thanks for your answer but unfortunately this does not work,
the "Model" declaration was already in category.php, otherwise it wouldn't work in the first place.

It does not work in javascript reload, when we select pagination or filters.
IP_CAM wrote:There is no Script involved with this, it just misses the Model Declaration in the Array! ::)
Ernie

catalog/controller/product/category.php
OLD:

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($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);
NEW:

Code: Select all

$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'model'        => $result['model'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);
/theme/template/product/category.tpl (Basic Output Code)

Code: Select all

<div>Model: <?php echo $product['model']; ?></div>
The revised VqMod would therefore look like this: (untested, I use no Journal Themes)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<modification>
<id><![CDATA[Product Model in Category]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[2.1x]]></vqmver>
<author><![CDATA[Author]]></author>
    
<file name="catalog/controller/product/category.php">
<operation error="log">
<search position="after"><![CDATA[$result['name'],]]></search>
<add><![CDATA[
	'model'        => $result['model'],
]]></add>
</operation>
</file>  
	
<file name="catalog/view/theme/journal2/template/product/category.tpl">
<operation error="log">
<search position="replace"><![CDATA[<h4 class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>]]></search>
<add><![CDATA[
	<h4 class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['model']; ?></a></h4>
]]></add>
</operation>
</file>   
</modification>
---
PS: And here is another VqMod, to display the Manufacturer the same way in the Category Section:
viewtopic.php?f=182&t=170072&p=645254#p645254
---

Newbie

Posts

Joined
Fri Nov 04, 2016 1:10 am

Post by IP_CAM » Tue Nov 08, 2016 2:27 am

Sorry, but this has absolutely nothing to do with Pagination or Javascript
if you have placed the Model Line just below, like here,in the category.tpl file,
then, it will function, I am sure:

Code: Select all

<div class="caption">
<div>Model: <?php echo $product['model']; ?></div>
Ernie

PS. I updated the VqMod, placed further above, to make it work with a Default Themed OC v.2.2.x!
The latest Category Image further above reflects the result!
It's driven by an OC v.2.2.6.4 CC - Multi Vendor Marketplace, technically equal or > to default OC v.2.2.x, I assume:
https://github.com/Evgenii-v/clerkscart

Test Site:
http://www.jti.li/shop/index.php?route= ... 20&limit=5

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by joss » Wed Nov 09, 2016 8:53 pm

ok, thank you for all your replies.

The problem seems to be inside themes code. I'm going to ask theme creator.

Newbie

Posts

Joined
Fri Nov 04, 2016 1:10 am

Post by kinuschan » Tue Jan 10, 2017 1:07 pm

joss wrote:ok, thank you for all your replies.

The problem seems to be inside themes code. I'm going to ask theme creator.
Hi Joss,
Did you solve this issue? i would like to know how to fix and show the product model in category product grid too.
thanks.

Newbie

Posts

Joined
Sat Mar 21, 2015 9:02 pm

Post by IP_CAM » Wed Jan 11, 2017 11:24 am

I just created another OcMod, by use of OC v.2.2.x Software, and explained some more details on this:
viewtopic.php?f=190&t=149352&p=653015#p653015
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 86 guests