Jump to content

(Solved) Module mail alerts show only products out of stock


Recommended Posts

Hi friends,

 

Have a lot of posts because this problem with module mail alert (prestashop official), about as show only product out of stock:

 

Insert this code in line 450 more or less:

 

<!-- Out of stock hook -->
{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
<div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
</div>
{$HOOK_PRODUCT_OOS}
{/if}
 
I use prestashop 1.6.0.9
Link to comment
Share on other sites

regarding to

 

 

Rules specific to the "Free modules" forum

This forum is not about the functionalities that are included for free in PrestaShop, but about the modules that you might give away to the Community for free.

All topics here should start with an answer, not a question.
You can use (almost) all other sections of the forum to ask for help or anything you need related to PrestaShop, but here you're the one who gives us tips and good practices.

 
Any module you may provide should be attached directly in your post 
Meaning: not with a link to an external website. The modules you are posting here are 100% free. Thus, you can share them just by attaching the ZIP file to the topic. Posts with an external link will be moderated and taken down.
 
Please use your common sense to make this section pleasant for everyone (respect others, be benevolent).

i moved this topic to proper forum section.

with regards,

Milos

Link to comment
Share on other sites

  • 2 months later...

mltcorp, your solution look good But It dosen't work on my site (1.6.13). If i Even I just write {$HOOK_PRODUCT_OOS} there is no any information then i allow out of stock products ordering.

 

 

 

Hi friends,

 

Have a lot of posts because this problem with module mail alert (prestashop official), about as show only product out of stock:

 

Insert this code in line 450 more or less:

 

<!-- Out of stock hook -->
{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
<div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
</div>
{$HOOK_PRODUCT_OOS}
{/if}
 
I use prestashop 1.6.0.9

 

Link to comment
Share on other sites

  • 2 years later...

The solution above do not display Mailalert when oosp is allowed

In my case I would like to hide mail alert when oosp is refuse, and show it when it's allowed.

 

I only added ! to line 465 in mailalerts.php module (before Product::isAvailableWhenOutOfStock )

 

public function hookActionProductOutOfStock($params)
{
if (!$this->customer_qty ||
!Configuration::get('PS_STOCK_MANAGEMENT') ||
!Product::isAvailableWhenOutOfStock($params['product']->out_of_stock))
return;
Link to comment
Share on other sites

  • 1 month later...

I tested again and adding ! before the function Product::isAvailableWhenOutOfStock correctly reverse display.

 

But now that I activated cache, I have a problem with variable $product->available_for_order  in TPL

It's only working one time after flush cache... then no more.

 

So I added the condition into mailalert.php : || ($params['product']->available_for_order) == 0

It look like to work :rolleyes:

Edited by Nicko500 (see edit history)
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...