Hello phoenix fam!
Please I need your assistance. I want to add the product description info added to product when creating it to the space above the add to cart button on the product_info.php page.
I have attached a snapshot to illustrate what I mean. I hope this can be done with ease. Your assistance is much appreciated as always.
Cheers!
Add product description above add to cart button
-
maryjane
- Member
- Posts: 18
- Joined: Wed Apr 13, 2022 5:39 am
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 2 times
Re: Add product description above add to cart button
I've tried to use the following but product description is not shown.
This is in the tpl_pi_buy_button.php file.
Code: Select all
<div class="col-sm-<?php echo $content_width; ?> cm-pi-description">
<div class="description">
<?php echo $product_description; ?>
</div>
</div>
<div class="col-sm-<?php echo $content_width; ?> pi-buy-button mt-2">
<?php
echo tep_draw_button(PI_BUY_BUTTON_TEXT, 'fas fa-shopping-cart', null, 'primary', array('params' => 'data-has-attributes="' . (($products_attributes['total'] > 0) ? '1' : '0') . '" data-in-stock="' . (int)$product_info['products_quantity'] . '" data-product-id="' . (int)$product_info['products_id'] . '"'), 'btn-success btn-block btn-lg btn-product-info btn-buy');
echo tep_draw_hidden_field('products_id', (int)$product_info['products_id']);
?>
</div>- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Add product description above add to cart button
The product_info is modular, so you can go to your admin, find modules->content, find the description-module, and give it a sort order lower than the buy button.
If you are on a version with the PI-system (1.0.7.12 has it, but I don't remember when it was introduced to core), you could make a PI-description module, which would allow you more control over the exact positioning.
It's also possible to use the tpl-file like you tried, but I don't think it's recommended. If you want to do it that way, look at includes/modules/content/product_info/cm_pi_description.php to find the correct way to get the description in your version.
//Daniel
If you are on a version with the PI-system (1.0.7.12 has it, but I don't remember when it was introduced to core), you could make a PI-description module, which would allow you more control over the exact positioning.
It's also possible to use the tpl-file like you tried, but I don't think it's recommended. If you want to do it that way, look at includes/modules/content/product_info/cm_pi_description.php to find the correct way to get the description in your version.
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
maryjane
- Member
- Posts: 18
- Joined: Wed Apr 13, 2022 5:39 am
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 2 times
Re: Add product description above add to cart button
Thanks for feedback. However, changing the sort order in admin will not work for me as my change will be reflected in other places. I want the description to appear above the add to cart button specifically on the product info page. The description is already shown at the bottom of product. I don't need this twice on the same page.Kofod95 wrote: ↑Tue Jul 11, 2023 2:18 pm The product_info is modular, so you can go to your admin, find modules->content, find the description-module, and give it a sort order lower than the buy button.
It's also possible to use the tpl-file like you tried, but I don't think it's recommended. If you want to do it that way, look at includes/modules/content/product_info/cm_pi_description.php to find the correct way to get the description in your version.
//Daniel
All I need is how to retrieve the $product_description value and place it where I want but for some reason, it's not showing there. If I comment out the description value and manually add text to test, it is displayed.
Code: Select all
<div class="col-sm-<?php echo $content_width; ?> cm-pi-description">
<div class="description">
<?php //echo $product_description; ?>
Enter product description here ...
</div>
</div>- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Add product description above add to cart button
The simplest option here which would do precisely as you need, is the advice of @Kofod95 to utilise the layout (modular) aspect of the product_info page.
Depending on what version, what version are you on, you should have a modular product_info page either already installed, or ready to install. You then need 1 extra module to show the product description in the correct place in your layout.
There is a "PRO" version of Phoenix that (I think) has lots of extra product_info layout modules, I am pretty sure that one of them is a description layout module. If PRO is not suitable at this time, you would need to make a layout module to suit your needs - not difficult, you can base it on one of the other layout modules.
Depending on what version, what version are you on, you should have a modular product_info page either already installed, or ready to install. You then need 1 extra module to show the product description in the correct place in your layout.
There is a "PRO" version of Phoenix that (I think) has lots of extra product_info layout modules, I am pretty sure that one of them is a description layout module. If PRO is not suitable at this time, you would need to make a layout module to suit your needs - not difficult, you can base it on one of the other layout modules.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Add product description above add to cart button
You would turn one module "on" and the other module "off".
This is not how coding works, sorry.All I need is how to retrieve the $product_description value and place it where I want but for some reason, it's not showing there.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
maryjane
- Member
- Posts: 18
- Joined: Wed Apr 13, 2022 5:39 am
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 2 times
Re: Add product description above add to cart button
I got it working using this:
It's all I needed. I'm not a coder or an expert like many of you nor do I seek to be one. I just need to get solutions to issues. My approach may not be your cup of tea, but I got my desired result.
Code: Select all
<div class="col-sm-<?php echo $content_width; ?> cm-pi-description">
<div class="description">
<?php echo stripslashes($product_info['products_description']); ?>
</div>
</div>