I've created some products in opencart, but the default theme doesn't show the dimensions or weight of the product that I've entered? Is there a simple way to add this information to the product page or description? Or do I need a different theme? Or something else?
Thanks for any information provided.
Thanks for any information provided.
This has been asked and answered before:
viewtopic.php?t=184213
viewtopic.php?t=184213
For quick, professional OpenCart support please email info@antropy.co.uk
Guru Member
Thanks, I've edited the php & twig files, but I now get an error. When I open the php file it states there's a syntax error (unexpected T_VARIABLE).
Code Line reads:
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
Any suggestions? Thanks for your assistance so far.
Code Line reads:
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
Any suggestions? Thanks for your assistance so far.
If you don't want to make custom edits, the easiest way to do this is to just use product attributes to enter that data. You'll have to enter it twice for every product, but that will show up automatically on the product page, and wouldn't require any editing. The only downside is you can't choose where to display it, since it will show up in the area where attributes are listed.
You have searched on Marketplace?
https://www.opencart.com/index.php?rout ... n_id=36820
https://www.opencart.com/index.php?rout ... n_id=36820
My converted modules | Buy me a beer | Opencart upgrade service
Thanks Jonathan & xxvirusxx,
I'll look into both options. I'm happy to edit stuff, but just need help with the errors. Still getting the parse error explained before....
Thanks.
I'll look into both options. I'm happy to edit stuff, but just need help with the errors. Still getting the parse error explained before....
Thanks.
Using OC Version 3.0.3.2
We don't know what you changed, where you changed and code you used...to tell you how to fix the error/errors.
My converted modules | Buy me a beer | Opencart upgrade service
Thanks, as I previously mentioned, I followed the instructions in the linked email. The copied parts all seem ok, but the following line is the one generating the parse error. That line of code reads:
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
Can you see anything wrong with it? Thanks.
I also tried downloading the extension you mentioned, but after unzipping & trying to upload it in Extensions, OpenCart stated that the .xml file was an invalid file type. That was the only file in the folder? So not sure what to do there? But thanks for the suggestion.
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
Can you see anything wrong with it? Thanks.
I also tried downloading the extension you mentioned, but after unzipping & trying to upload it in Extensions, OpenCart stated that the .xml file was an invalid file type. That was the only file in the folder? So not sure what to do there? But thanks for the suggestion.
OK, extension now uploaded & installed properly 'I think!'. I was trying to upload the file rather than the folder.
But still getting the parse syntax error on the line of code in my previous post.
Thanks.
But still getting the parse syntax error on the line of code in my previous post.
Thanks.
Using OC Version 3.0.3.2
What instructions?ihateusernames wrote: ↑Mon Jul 29, 2019 4:58 pmThanks, as I previously mentioned, I followed the instructions in the linked email.
Now need to unzip, just install as it is (blabla.ocmod.zip) and that tell you clear on extension page....
1. Go to Extensions-->Installer
2. Click on Upload and chose the file product_dimensions_and_weight.ocmod.zip
3. Refresh Ocmod
My converted modules | Buy me a beer | Opencart upgrade service
Here is the instructions as guided by the first guy who responded to this post.
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 } ?>
Thanks.
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 } ?>
Thanks.
And you have converted this code for 3.x?ihateusernames wrote: ↑Mon Jul 29, 2019 5:31 pm<?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 } ?>
My converted modules | Buy me a beer | Opencart upgrade service
Sorry, I copied the wrong post! This is the correct data I inserted. (apologies....)
(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>
Thanks.
(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>
Thanks.
Try with thisihateusernames wrote: ↑Mon Jul 29, 2019 5:58 pm$data['weight'] = $this->weight->format(($product_info['weight'] ) , $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))
$data['weight'] = $this->weight->format(($product_info['weight'] ) , $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'));
And use
Code: Select all
<li>{{'Weight:'}} {{ weight }}</li>
My converted modules | Buy me a beer | Opencart upgrade service
Thanks , parse error now gone & product pages all loading fine.
However, still no weight or dimensions showing on the product page? If I use the attributes it looks like they show up in the specifications tab rather than on the product itself (as per Jonathan's suggestion). I'd rather they showed up on the product tab or info. Is this possible?
Thanks.
However, still no weight or dimensions showing on the product page? If I use the attributes it looks like they show up in the specifications tab rather than on the product itself (as per Jonathan's suggestion). I'd rather they showed up on the product tab or info. Is this possible?
Thanks.
Using OC Version 3.0.3.2
You have refreshed ocmod? Cleared SASS cache, theme cache?
Code work just fine
Code work just fine
My converted modules | Buy me a beer | Opencart upgrade service
Thanks, the refresh ocmod extension did the trick. I guess that is standard procedure in OpenCart after an install.
Apologies as I'm still finding my way around all the intricacies of this app. The layout & use is not what I was expecting, but hopefully I'll get there in the end
I've just noticed the weight is now shown twice, above & below the Dimensions.....!
Apologies as I'm still finding my way around all the intricacies of this app. The layout & use is not what I was expecting, but hopefully I'll get there in the end

I've just noticed the weight is now shown twice, above & below the Dimensions.....!
Using OC Version 3.0.3.2
Then disable my extension....or remove that code and use my extension.ihateusernames wrote: ↑Mon Jul 29, 2019 6:54 pmI've just noticed the weight is now shown twice, above & below the Dimensions.....!
My converted modules | Buy me a beer | Opencart upgrade service
OK, if I disable your ext & remove the lines of code I inserted previously, everything reverts back to 'as before'.
If I insert the lines of code, the weight & dimensions still don't show up at all?
If I remove the lines of code & enable your ext, then the weight is shown twice & the dimensions once?
Any suggestions? Thanks.
If I insert the lines of code, the weight & dimensions still don't show up at all?
If I remove the lines of code & enable your ext, then the weight is shown twice & the dimensions once?
Any suggestions? Thanks.
Using OC Version 3.0.3.2
OK, clearing SASS & theme caches did the trick for the ext.
Thanks.....
Thanks.....
Using OC Version 3.0.3.2
Who is online
Users browsing this forum: donesmarcos and 18 guests