Jump to content

How to use displayProductPriceBlock correctly?


Astolfo

Recommended Posts

I'm using Prestashop 1.7

public function install()
    {

      include(dirname(__FILE__).'/sql/install.php');

        return parent::install() &&
            $this->registerHook('header') &&
            $this->registerHook('backOfficeHeader') &&
            $this->registerHook('displayProductPriceBlock');
    } - registering hook;

public function hookDisplayProductPriceBlock($params)

{

return $this->display(__FILE__, 'display_product_price_block.tpl');

} - hook function

<form action='../modules/wishlist/addtowishlist.php' method='POST'>

<input type='text' value='' style='display:none'>

<button type='submit'>&#128420;</button>

</form> - tpl file

Output:

image.png.76ef8d36b1d3a35752e5ffa03bb4657c.png

Link to comment
Share on other sites

Hello, After investigate many things. i found that if we hook it in  hookDisplayProductPriceBlock then it show multiple times. we need to add some kind of condition to limit it. It show after before price one time.

 

if ( $hookName == 'displayProductPriceBlock' && $params['type'] != 'before_price') {
            return false;
            }

I suggest you to use this in new hook  displayProductListReviews then you are able to use this nicely, It used same way how review show. Normally the possition it using css. I have put the css with template for you. Bellow is screen shot how it will show after we do this.

 

https://pscreenshot.com/i/APaS18

 

<style type="text/css">
.product-list-wishlist {
    border: 1px solid red;
    position: absolute;
    top: -26px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 0;
}
</style>
<div class="product-list-wishlist">
<form action='../modules/wishlist/addtowishlist.php' method='POST'>

<input type='text' value='' style='display:none'>

<button type='submit'>&#128420;</button>

</form>
</div>

 

Hope your issue will sovled.

 

Thank you

Classy Devs Team

Edited by ClassyDevs (see edit history)
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...