Post by clau777 » Sat Mar 16, 2013 8:04 am

Hello!
How can i show the weight and unit in category view?

Thank you!

Newbie

Posts

Joined
Sat Mar 16, 2013 8:02 am

Post by straightlight » Mon Mar 18, 2013 8:29 am

In catalog/controller/product/category.php file,

find:

Code: Select all

'reviews'     => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
add right below:

Code: Select all

'weight'      => sprintf($this->weight->format($result['weight'], $result['weight_class_id']), $this->language->get('text_product_weight')),
In catalog/language/english/product/category.php file,

find:

Code: Select all

$_['text_quantity']
add right below:

Code: Select all

$_['text_product_weight'] = 'Weight: %s';
In your catalog/view/theme/<your_theme>/template/product/category.tpl file,

find:

Code: Select all

<?php foreach ($products as $product) { ?>
    <div>
add where you see fit in your template with this object:

Code: Select all

<?php if ($product['weight']) { ?>
    <?php echo $product['weight']; ?>
<?php } ?>
before the next ending:

Code: Select all

</div>

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

Post by Flysan » Fri Jul 10, 2015 1:51 am

How to make it work on OC 2.x?

New member

Posts

Joined
Tue Apr 28, 2015 6:25 pm

Post by straightlight » Fri Jul 10, 2015 11:45 pm

Flysan wrote:How to make it work on OC 2.x?
For v2.0x releases, in catalog/controller/product/category.php file,

find:

Code: Select all

'rating'      => $result['rating'],
add below:

Code: Select all

'weight'      => sprintf($this->weight->format($result['weight'], $result['weight_class_id']), $this->language->get('text_product_weight')),
Then, in catalog/view/theme/<your_custom_template>/template/product/category.tpl file,

find:

Code: Select all

<?php foreach ($products as $product) { ?>
        <div class="product-layout product-list col-xs-12">
Add where you see fit:

Code: Select all

<?php if ($product['weight']) { ?>
    <?php echo $product['weight']; ?>
<?php } ?>
before the next ended:

Code: Select all

</div>
The rest of the insructions above for v1.5x can be followed as is.

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

Post by IP_CAM » Sat Jul 11, 2015 2:47 am

For those, possibly less interested in modifying OC Code, here is a simple VqMod, tested with OC v.1.5.6.5_rc

Display Product Weight in Category Sections, Single Language Edition VqMOD for Opencart v.1.5.6.x
I will add it into the Extension Section, as well as a Version v.2.x, soon.

needs to be changed here:

Code: Select all

<span>Weight: <?php echo $product['weight']; ?>
if other Single-Language is required.

Download:
http://www.ipc.li/os/weight_in_category_156.zip

Good Luck ;)
Ernie
PS: I just added a OC v.2.0.3.x Text Version XML to the ZIP, wich I cannot test by myselfs!
If it don't work, check for required WHITESPACE , they have to match exactly to, what you have,
on whitespace, INSIDE/WITHIN OF SUCH LINES, existing in your Source Files, related to the Task, to make
the VqMod work.
Whitespace Sample:

Code: Select all

'rating'      => $result['rating'],
see the many EMPTY individual SPACES, or TAB's!

The Result can be seen here, momentarely, multi Theme tested:
http://www.hitline.info/shop/index.php? ... path=20_26

My Github OC Site: https://github.com/IP-CAM
5'600 + 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 Flysan » Sun Jul 12, 2015 3:46 am

Thank you very much it works perfectly!!

New member

Posts

Joined
Tue Apr 28, 2015 6:25 pm

Post by IP_CAM » Sun Jul 12, 2015 5:08 am


My Github OC Site: https://github.com/IP-CAM
5'600 + 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 egyshow » Fri Jul 17, 2015 3:02 pm

i have this problem after i used this extension
Fatal error: Class 'Controllerproductproduct' not found in /home/souqkz/public_html/vqmod/vqcache/vq2-system_modification_system_engine_action.php on line 62

can you help me plz
my oc language is arabic

New member

Posts

Joined
Mon May 25, 2015 11:53 pm

Post by IP_CAM » Sat Jul 18, 2015 8:26 am

'Controllerproductproduct'
would be equal:
controller/product/product.php
but a product file is not even called by anything, related to this Mod !
You did not mention your Version either, how in the World do you expect someone to assist you ?
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + 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 egyshow » Sat Jul 18, 2015 1:28 pm

sorry version is 2.3.1

New member

Posts

Joined
Mon May 25, 2015 11:53 pm

Post by opencartboost » Wed Sep 23, 2015 2:41 pm

egyshow wrote:sorry version is 2.3.1
I have one
http://www.opencart.com/index.php?route ... on_id=2937

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am
Who is online

Users browsing this forum: No registered users and 11 guests