Post by apollovs » Mon May 15, 2017 6:03 pm

Hi,
I am running a site on Opencart Version 2.3.0.2 and what i would like to do is display the measurements and weight of each product on the product page.

Is ths possible?

cheers

http://www.apollovsautograph.com/


New member

Posts

Joined
Sat Nov 01, 2014 5:17 am
Location - Buckinghamshire, England

Post by sachin6609 » Mon May 15, 2017 8:35 pm

HIi

Go to admin panel catalog->product

Add New Product or edit the exiting one

Go To data Tab and check the bottom of that tab

You can add the size and weight of that product

Thanks
Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by apollovs » Mon May 15, 2017 8:40 pm

Not sure you understand what i mean, i have already added the weights and sizes on the product page in my admin area but i would like these weights and measurements to also show on the product page and my web site so customers can view them before they buy

http://www.apollovsautograph.com/


New member

Posts

Joined
Sat Nov 01, 2014 5:17 am
Location - Buckinghamshire, England

Post by sachin6609 » Mon May 15, 2017 9:57 pm

Hii

Ok i got it

I will tell you the changes with file location and code 2marrow

Currently i just leave my laptop so i will sure tell you the solution dont warry . i know how to do this i have already done it in my localhost opencart

Thanks
Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by Gr3nT » Tue May 16, 2017 5:57 am

Weight and size are only displayed in one place for visitors.
Product comparison page and the weight may even be in the delivery way.
Or you can show it individually with development

Webáruház készítés | GrenT Média.hu


Newbie

Posts

Joined
Thu May 17, 2012 7:46 pm

Post by sachin6609 » Tue May 16, 2017 1:53 pm

Hii

it will be display on the product page just below the model,stock section

Thanks
Sachin

Attachments

weight on the product page.png

weight on the product page.png (206.89 KiB) Viewed 19211 times


Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by apollovs » Tue May 16, 2017 3:48 pm

sachin6609 wrote:
Tue May 16, 2017 1:53 pm
Hii

it will be display on the product page just below the model,stock section

Thanks
Sachin
Hi,
How do i do this as i see a screenshot but no instructions?

cheers

http://www.apollovsautograph.com/


New member

Posts

Joined
Sat Nov 01, 2014 5:17 am
Location - Buckinghamshire, England

Post by sachin6609 » Tue May 16, 2017 4:28 pm

Hii

Open the product controller file and search the below line

file location -> catalog / controller / product then open the product.php file

$data['points'] = $product_info['points'];

Then after this line add the below line

$data['weight'] = $product_info['weight'];
$data['length'] = $product_info['length'];
$data['width'] = $product_info['width'];
$data['height'] = $product_info['height'];

Then open the product.tpl file and serach for the below line

File Location-> catalog / view / theme / default or (Your_Theme_Folder_If_You_Use_any_theme) / template / product then product.tpl file

<li><?php echo $text_stock; ?> <?php echo $stock; ?></li>

just after that line add the below code

<?php if($weight) { ?>
Weight : <?php echo number_format($weight,2); ?>
<?php } ?>
<br/>
<?php if($length || $width || $height) { ?>
L x W x H : <?php echo number_format($length,2)," x ", number_format($width,2) , " x " , number_format($height,2); ?>
<?php } ?>

All The Best

Thanks
Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by apollovs » Wed May 17, 2017 1:16 am

I have done what you have put below but doesnt seem to work for me the details are not showing on the products pages?
sachin6609 wrote:
Tue May 16, 2017 4:28 pm
Hii

Open the product controller file and search the below line

file location -> catalog / controller / product then open the product.php file

$data['points'] = $product_info['points'];

Then after this line add the below line

$data['weight'] = $product_info['weight'];
$data['length'] = $product_info['length'];
$data['width'] = $product_info['width'];
$data['height'] = $product_info['height'];

Then open the product.tpl file and serach for the below line

File Location-> catalog / view / theme / default or (Your_Theme_Folder_If_You_Use_any_theme) / template / product then product.tpl file

<li><?php echo $text_stock; ?> <?php echo $stock; ?></li>

just after that line add the below code

<?php if($weight) { ?>
Weight : <?php echo number_format($weight,2); ?>
<?php } ?>
<br/>
<?php if($length || $width || $height) { ?>
L x W x H : <?php echo number_format($length,2)," x ", number_format($width,2) , " x " , number_format($height,2); ?>
<?php } ?>

All The Best

Thanks
Sachin

http://www.apollovsautograph.com/


New member

Posts

Joined
Sat Nov 01, 2014 5:17 am
Location - Buckinghamshire, England

Post by cyclops12 » Wed May 17, 2017 1:47 am

Have you gone into extensions/modifications and clicked the refresh button?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by apollovs » Wed May 17, 2017 2:52 am

cyclops12 wrote:
Wed May 17, 2017 1:47 am
Have you gone into extensions/modifications and clicked the refresh button?
Thanks works now!, you can tell i am new to this!

http://www.apollovsautograph.com/


New member

Posts

Joined
Sat Nov 01, 2014 5:17 am
Location - Buckinghamshire, England

Post by cyclops12 » Wed May 17, 2017 3:06 am

Hey no problems, happy to help :)

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by Oyekunle » Wed Aug 23, 2017 5:30 am

hello please i use opencart 3
can you guide how to go about this
thanks

Newbie

Posts

Joined
Wed Aug 23, 2017 5:27 am

Post by samee » Fri Mar 23, 2018 10:51 pm

yet another newbie

Can someone PLEASE help to achieve the same in OC3.0.2.0, I tried solution provided by sachin but just can't get it to show without decimal and weight class (ie gm). PLEASE PLEASE help

Solved... 24Mar

(1) file location -> catalog / controller / product then open the product.php file
search/find line
$data['points'] = $product_info['points'];

Then after this line add the below line
$data['weight'] = $this->weight->format(($product_info['weight'] ) , $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))

(2) File Location-> catalog / view / theme / default or (Your_Theme_Folder_If_You_Use_any_theme) / template / product then product.twig file
search/find line <li>{{ text_stock }} {{ stock }}</li>

Then after this line add the below line
<li>{{'Weight:'}} {{weight}}</li>


Now I need find way to show weight on search result page. any guidance ?

Newbie

Posts

Joined
Mon Jan 22, 2018 6:31 pm

Post by appsfinder » Tue Apr 03, 2018 12:22 am

hi ive got this working but does not display grams this is what it show weight 299 there no g on the end please advise code change so looks like this weight 299g

:) open cart 2.3.0.2 & 3.0.2.0


New member

Posts

Joined
Fri Feb 08, 2013 4:12 am

Post by jagall » Thu May 10, 2018 1:14 am

Hi I have same issue got this to display but missing the label i.e. grams or inches, etc.
thanks

New member
Online

Posts

Joined
Sat Feb 11, 2017 10:15 pm

Post by Cherice » Wed May 06, 2020 6:10 pm

Hi
Please could someone let me know how to edit this code to show the dimensions? (Opencart 3x) I got this to work with the weight, but i need to change weight to L x H x W

Thank you

Newbie

Posts

Joined
Fri Apr 05, 2019 4:57 pm

Post by speedytm » Tue Feb 13, 2024 3:08 pm

OpenCart 3

Add in file: controller/catalog/product/product.php

after

Code: Select all

$data['points'] = $product_info['points'];
this:

Code: Select all

if ($product_info['weight']>0) {
				$data['weight'] = str_replace('.00','',$this->weight->format($product_info['weight'], $product_info['weight_class_id']));
			} else {
				$data['weight'] = '';
			}
			if ($product_info['length']>0) {
				$data['length'] = str_replace('.00','',$this->length->format($product_info['length'], $product_info['length_class_id']));
			} else {
				$data['length'] = '';
			}
			if ($product_info['width']>0) {
				$data['width'] = str_replace('.00','',$this->length->format($product_info['width'], $product_info['length_class_id']));
			} else {
				$data['width'] = '';
			}
			if ($product_info['height']>0) {
				$data['height'] = str_replace('.00','',$this->length->format($product_info['height'], $product_info['length_class_id']));
			} else {
				$data['height'] = '';
			}
Next, in theme file catalog/view/theme/YOURTHEMENAME/template/product/product.twig
after

Code: Select all

<li>{{ text_stock }} {{ stock }}</li>
:

Code: Select all

{% if length %}
	<li>{{'Размеры (ДхШхВ):'}} {{length}} x {{width}} x {{height}}</li>
{% endif %}
Have a nice day!

Newbie

Posts

Joined
Mon Jun 27, 2022 3:31 pm
Who is online

Users browsing this forum: No registered users and 53 guests