AbanteCart Community
Shopping Cart Operations => Support => General Support => Topic started by: MLCS on July 30, 2012, 09:49:09 AM
-
Hi. How can I make it so the products show their Length, Width and Height on the Product Information?
-
hi.
you can add something like this in your product.tpl file
<?php echo "width:".$product_info['width']; ?>
<?php echo "height:".$product_info['height']; ?>
<?php echo "length:".$product_info['length']; ?>
i see that we forgot to add length unit name in $product_info var. We'll add this into new version.
You can do this manually. Open file storefront/model/catalog/product.php method getProduct (29 line)
and replace
$query = $this->db->query(
"SELECT DISTINCT *, pd.name AS name, m.name AS manufacturer, ss.name AS stock_status " .
$this->_sql_join_string() .
" WHERE p.product_id = '" . (int)$product_id . "'
AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'
AND p.date_available <= NOW() AND p.status = '1'");
by this
$query = $this->db->query(
"SELECT DISTINCT *, pd.name AS name, m.name AS manufacturer, ss.name AS stock_status, lcd.unit as length_class_name " .
$this->_sql_join_string() .
"LEFT JOIN " . DB_PREFIX . "length_class_descriptions lcd
ON (p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('storefront_language_id') . "')
WHERE p.product_id = '" . (int)$product_id . "'
AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'
AND p.date_available <= NOW() AND p.status = '1'");
Thank you.
-
Thankyou so much!
The actual writing on the product.tpl was a bit different...
Maybe you can help so if I change the measurement it automatically changes on the page aswell.
This is what Ive put in
<tr>
<td><b><?php echo "Length:"; ?></b></td>
<td><?php echo $product_info['length'] . "mm"; ?></td>
</tr>
<tr>
<td><b><?php echo "Width:"; ?></b></td>
<td><?php echo $product_info['width'] . "mm"; ?></td>
</tr>
<tr>
<td><b><?php echo "Height:"; ?></b></td>
<td><?php echo $product_info['height'] . "mm"; ?></td>
</tr>
As you can see Ive wrote . "mm"; ?>
How can I change that so if one of the measurements in is cm then it would change
-
Thank you so much!
The actual writing on the product.tpl was a bit different...
Maybe you can help so if I change the measurement it automatically changes on the page aswell.
This is what Ive put in
<tr>
<td><b><?php echo "Length:"; ?></b></td>
<td><?php echo $product_info['length'] . "mm"; ?></td>
</tr>
<tr>
<td><b><?php echo "Width:"; ?></b></td>
<td><?php echo $product_info['width'] . "mm"; ?></td>
</tr>
<tr>
<td><b><?php echo "Height:"; ?></b></td>
<td><?php echo $product_info['height'] . "mm"; ?></td>
</tr>
As you can see Ive wrote . "mm"; ?>
How can I change that so if one of the measurements in is cm then it would change
MLCS, please look at my post above again.
I propose to change model and gets "length_class_name" from $product_info array.
After that you need write <?php echo $product_info['height'] . $product_info['length_class_name']; ?>
-
Thankyou so much! This has solved everything :)
Ill lock this for you :)
-
Another related question
Is there any chance I can set it so if I dont include a value for Length, Width or Height that it doesnt show them on the Product Information?
Also. Showing Weight?
-
anybody???
-
Yes,
You need to put conditional check around each display section in the same tpl file
Example:
<?php if ( $product_info['height'] ) { ?>
<tr>
<td><b><?php echo "Height:"; ?></b></td>
<td><?php echo $product_info['height'] . "mm"; ?></td>
</tr>
<?php } ?>
-
Yes,
You need to put conditional check around each display section in the same tpl file
Example:
<?php if ( $product_info['height'] ) { ?>
<tr>
<td><b><?php echo "Height:"; ?></b></td>
<td><?php echo $product_info['height'] . "mm"; ?></td>
</tr>
<?php } ?>
That didnt work. It still shows "Height: 0.00mm"
Also, displaying weight?!?!
-
This boils down to selecting the right test. The problem with the example test provided is that it just tests to see if the variable exists, which it does, while the actual need is to test whether it exists and is not NULL.
Check PHP documentation for the specifics of correct conditionals.
David
-
If you need PHP coding help. Please post code extract you have now
-
Showing the height (in product.tpl)
<?php if ( $product_info['height'] ) { ?>
<tr>
<td><b><?php echo "Height:"; ?></b></td>
<td><?php echo $product_info['height'] . $product_info['length_class_name']; ?></td>
</tr>
<?php } ?>
Edit:
Found out where the error was
Just had to do:
<?php if($product_info['height']>'0'){?>
So thats that bit sorted
I still need to get the weight showing
Any help?