Jump to content

Available_now & Available_later in Product-list.tpl


Nicklaenen

Recommended Posts

Dear all,

 

I would like to be able to show the values Available_now and Available_later in the product-list.tpl.

Right now it is telling me 'In stock' or 'Not in Stock'.... (as text)

 

Code is:

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}

 

I tried:

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{$product.available_now}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{$product.available_later}{/if}</span>{/if}

 

But it won't show the correct text... I think I do need to change catergoy.php (or use the override function), can please somebody help me with this?

Link to comment
Share on other sites

try this: (assuming 1.4.x)

-Back Office > Tools > Translations

-select front office translations and the target language, i.e. English

-click expand all

-ctl f and find 'out of stock' for example

--change it to what you want it to say

-scroll to the very bottom and save it

Link to comment
Share on other sites

  • 1 month later...

Thank you Elpatron,

 

I have already found the answer... The problem was I was using the layered navigation block module on the productlistassign, so I changed that module and everything is working fine.

 

Thanks anyway...

 

Could you give more detailed information on your solution to this problem? I am trying to do exactly the same thing, however, I don't know what to change in layered navigation module. Thanks in advance.

Link to comment
Share on other sites

OK, I figured it out.

 

in blocklayered.php on line 2291 change SELECT so that it contains 'pl.available_now':

 

SELECT p.id_product, p.on_sale, p.out_of_stock, p.available_for_order, p.quantity, p.minimal_quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`,
p.ean13, pl.available_now, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend,  m.name manufacturer_name, p.condition, p.id_manufacturer,
DATEDIFF(p.`date_add`,
DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new

 

after that, you can use this code in product-list.tpl (provided by Nicklaenen) and you will see availability statuses you have written to each product:

 

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{$product.available_now}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{$product.available_later}{/if}</span>{/if}

 

Enjoy

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hi guys!

 

I was also trying to show product availability in product-list.tpl but

it's displaying only 'In stock' even if there are some products not in stock.

I am not using layered navigation block module, could you tell me please what is wrong?

 

Thanks in advance!

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...