I have an issue on PS 1.7; I’m trying to display {$product.availability_message} (shipping delay message) depending on stock on cart and order confirmation. It works well on cart but doesn’t display on order-confirmation (order-confirmation-table.tpl). Any idea to make this work ?
Here is my code :
{if (isset($product.quantity_all_versions) && $product.quantity_all_versions < 0)}
<div>
<span class="red icon--pulsing"></span>
<span class="msg">{$product.availability_message}</span>
</div>
{else}
<div>
<span class="icon--pulsing"></span>
<span class="msg">Available</span>
</div>
{/if}
2
Answers
You’d need to override
PaymentModule::validateOrder
.In this part of the code:
https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/classes/PaymentModule.php#L434
There’s an array of products.
Krystian Podemski’s answer is absolutely correct. I used the same approach before. However I used different product’s properties than you and I was not able to reproduce it using the
quantity_all_versions
andavailability_message
properties. I usedquantity_available
andavailable_later
properties instead.Anyway you have to create a new file
PaymentModule.php
inoverrideclasses
folder.There you have to create a new class
PaymentModule
with the functionvalidateOrder
.Then find the array
$product_var_tpl
and add the properties you need. In my case:Then you can display the
available_later
message in your/themes/<your theme>/templates/checkout/_partials/order-confirmation-table.tpl
like this: