Hi,
I'm trying to display the weight of a product on the product page and it's got me going around in circles. Following advice from other threads I added the following to /catalog/controller/product/product.php
$this->data['length'] = $product_info['length'];
$this->data['width'] = $product_info['width'];
$this->data['height'] = $product_info['height'];
$this->data['weight'] = $product_info['weight'];
And added the following to /catalog/view/theme/default/template/product/product.tpl
<?php echo $length; ?>
<?php echo $width; ?>
<?php echo $height; ?>
<?php echo $weight; ?>
It displays length, width, height, but not weight!
I've checked and re-checked everything and I'm stumped.
Could anyone help me with why it is not displaying weight? I have weight in the product details and I can see it in the database. I followed some advice on showing weight on category pages and that works, just not on the product page. Any help greatly appreciated!
Thanks!
I'm trying to display the weight of a product on the product page and it's got me going around in circles. Following advice from other threads I added the following to /catalog/controller/product/product.php
$this->data['length'] = $product_info['length'];
$this->data['width'] = $product_info['width'];
$this->data['height'] = $product_info['height'];
$this->data['weight'] = $product_info['weight'];
And added the following to /catalog/view/theme/default/template/product/product.tpl
<?php echo $length; ?>
<?php echo $width; ?>
<?php echo $height; ?>
<?php echo $weight; ?>
It displays length, width, height, but not weight!
I've checked and re-checked everything and I'm stumped.
Could anyone help me with why it is not displaying weight? I have weight in the product details and I can see it in the database. I followed some advice on showing weight on category pages and that works, just not on the product page. Any help greatly appreciated!
Thanks!
it would also take some additional Content in the MODEL File, but it's MUCHO easier, to use one of the nice free
Extensions, shown as first and second Mod on the Extension Page, the:
Product Display Settings vqmod or the very comprehensive Advanced Product Display Settings, I also use,
and as shown on the Product Page image:
https://www.opencart.com/index.php?rout ... load_id=33
Good Luck
Ernie
---
Extensions, shown as first and second Mod on the Extension Page, the:
Product Display Settings vqmod or the very comprehensive Advanced Product Display Settings, I also use,
and as shown on the Product Page image:
https://www.opencart.com/index.php?rout ... load_id=33
Good Luck
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.
Hi Ernie,
Thanks for your reply.
I installed the Advanced Product Display Settings module and I got this error:
Parse error: syntax error, unexpected ',' in /home/mysite/public_html/vqmod/vqcache/vq2-catalog_model_catalog_product.php on line 56
I didn't install the other one as it doesn't say it's compatible with my version of Open Cart.
I don't really need to display the weight of each product. I would only like to access the weight of the product to use in a calculator I embed on the page where my customer can calculate the weight of an order based on the amount of product they need. So if they need 50 of the product the calculator tells them the total weight. As I said it works for the other dimensions just not weight.
Could you say what I need to do to the Model file?
Thanks.
Thanks for your reply.
I installed the Advanced Product Display Settings module and I got this error:
Parse error: syntax error, unexpected ',' in /home/mysite/public_html/vqmod/vqcache/vq2-catalog_model_catalog_product.php on line 56
I didn't install the other one as it doesn't say it's compatible with my version of Open Cart.
I don't really need to display the weight of each product. I would only like to access the weight of the product to use in a calculator I embed on the page where my customer can calculate the weight of an order based on the amount of product they need. So if they need 50 of the product the calculator tells them the total weight. As I said it works for the other dimensions just not weight.
Could you say what I need to do to the Model file?
Thanks.
what OC Version do you use ?
Ernie
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.
It's OpenCart 1.5.6.4
By the way I found some forum topics on this and applied the steps above and steps to show on the category page. I can see the weight variable on the category page using the advice/code from those posts but not on the product page where I need it. It suggests to me that the weight attribute is there someplace I just can't access it or display it.
Thanks!
By the way I found some forum topics on this and applied the steps above and steps to show on the category page. I can see the weight variable on the category page using the advice/code from those posts but not on the product page where I need it. It suggests to me that the weight attribute is there someplace I just can't access it or display it.
Thanks!
Parse error: syntax error, unexpected ',' in /home/mysite/public_html/vqmod/vqcache/vq2-catalog_model_catalog_product.php on line 56
---
Sorry for delay. If you use an unmodified Default Theme, and no other Extension, inserting some Code into the catalog/model/catalog/product.php
it has to work. Check if your model/catalog/product.php file looks the same as shown on the image, to make sure, the VqMod Content will be added in the right spot, and no second Comma, where no Comma should be.
But I would NOT have mentioned the other Extension, if it would not work, at least in my OC v.1.5.6.5_rc
Good Luck
Ernie
---
Sorry for delay. If you use an unmodified Default Theme, and no other Extension, inserting some Code into the catalog/model/catalog/product.php
it has to work. Check if your model/catalog/product.php file looks the same as shown on the image, to make sure, the VqMod Content will be added in the right spot, and no second Comma, where no Comma should be.
But I would NOT have mentioned the other Extension, if it would not work, at least in my OC v.1.5.6.5_rc
Good Luck
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.
Hi Ernie,
I appreciate your help, thank you. I am averse to installing the extension again as it is a live site and I cannot afford any more downtime trying to fix it. I don't want to take the risk.
I'm not sure that the extension would address my problem. It might show the weight in the product description, but I need access to the value on each product page for a calculation.
I can't understand why it isn't working on the product page but it does on the category page. The model file looks correct and it calls for the weight attribute from the database. I'm at a loss. Any insight would be great thanks again.
BTDavid
I appreciate your help, thank you. I am averse to installing the extension again as it is a live site and I cannot afford any more downtime trying to fix it. I don't want to take the risk.
I'm not sure that the extension would address my problem. It might show the weight in the product description, but I need access to the value on each product page for a calculation.
I can't understand why it isn't working on the product page but it does on the category page. The model file looks correct and it calls for the weight attribute from the database. I'm at a loss. Any insight would be great thanks again.
BTDavid
Hi Ernie,
I took another look at this and found something unusual.
In catalog/view/theme/xx/template/product/product.tpl I have
<?php echo $height; ?>
On the product page it will display 1.6cm which is correct.
As a test I tried changing catalogue/controller/product/product.php
I changed:
$this->data['height'] = $product_info['height'];
to:
$this->data['height'] = $product_info['length'];
but I saved everything and the product page still shows 1.6cm not the length with is 20cm
This suggests to me that the .tpl is getting the value for the dimensions from some other .php file but I cannot find it anyplace.
Can you offer any suggestions?
Thanks
David
I took another look at this and found something unusual.
In catalog/view/theme/xx/template/product/product.tpl I have
<?php echo $height; ?>
On the product page it will display 1.6cm which is correct.
As a test I tried changing catalogue/controller/product/product.php
I changed:
$this->data['height'] = $product_info['height'];
to:
$this->data['height'] = $product_info['length'];
but I saved everything and the product page still shows 1.6cm not the length with is 20cm
This suggests to me that the .tpl is getting the value for the dimensions from some other .php file but I cannot find it anyplace.
Can you offer any suggestions?
Thanks
David
Oh yeah didnt read that properly sorry..
BTW i just tried your code on a default 1.5.6.1 and it works fine
I added to the catalog/controller/product/product.php
Directly underneath
Then in the product.tpl file i added
Directly underneath
Just to make sure it works and it does, all i done was refreshed the browser once code was added
BTW i just tried your code on a default 1.5.6.1 and it works fine
I added to the catalog/controller/product/product.php
Code: Select all
$this->data['length'] = $product_info['length'];
$this->data['width'] = $product_info['width'];
$this->data['height'] = $product_info['height'];
$this->data['weight'] = $product_info['weight'];
Code: Select all
$this->data['product_id'] = $this->request->get['product_id'];
$this->data['manufacturer'] = $product_info['manufacturer'];
$this->data['manufacturers'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
$this->data['model'] = $product_info['model'];
$this->data['reward'] = $product_info['reward'];
$this->data['points'] = $product_info['points'];
Code: Select all
<?php echo $length; ?><br />
<?php echo $width; ?><br />
<?php echo $height; ?><br />
<?php echo $weight; ?>
Code: Select all
<div class="description">
<?php if ($manufacturer) { ?>
<span><?php echo $text_manufacturer; ?></span> <a href="<?php echo $manufacturers; ?>"><?php echo $manufacturer; ?></a><br />
<?php } ?>
<span><?php echo $text_model; ?></span> <?php echo $model; ?><br />
<?php if ($reward) { ?>
<span><?php echo $text_reward; ?></span> <?php echo $reward; ?><br />
<?php } ?>
<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
Attachments
extras.JPG (16.5 KiB) Viewed 7329 times
No problem at all, I really just appreciate any help.
I am trying to debug it a bit by changing the product.php like I did, but it doesn't change the variable like it would by default.
This says to me that the variables are assigned from the database in another file, other than default.
It's a big enough website that I am trying to add functionality to, so I would really like to be able tofigure it out.
I am trying to debug it a bit by changing the product.php like I did, but it doesn't change the variable like it would by default.
This says to me that the variables are assigned from the database in another file, other than default.
It's a big enough website that I am trying to add functionality to, so I would really like to be able tofigure it out.
Hi,
I thought about that last night so I checked, and there it was! There was a vqmod installed that was why changing the product.php file didn't change the dimensions.
I changed it to include adding the weight and it worked. The file was:
xml/displaydimensions-for-1551.xml
Thanks
I thought about that last night so I checked, and there it was! There was a vqmod installed that was why changing the product.php file didn't change the dimensions.
I changed it to include adding the weight and it worked. The file was:
xml/displaydimensions-for-1551.xml
Thanks
Who is online
Users browsing this forum: No registered users and 37 guests