Jump to content

string concatenate available_for_order


Recommended Posts

Hi, I need to give to product list "Available" e "Available for order", so I copied the code from product.tpl in the product_list.tpl changing -> whit the dot (.) you can see the code below:

 

  {* BEGIN STRCT AVAILABLE *}
  <p id="availability_statut"  style="color:#4040ff;"{if ($product.quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order|cat:"ciao" OR $PS_CATALOG_MODE} style="display: none;"{/if}>
<span id="availability_label">{*l s='Availability:'*}</span>
<span id="myavailability_value"{if $product.quantity <= 0} class="warning_inline"{/if}>
 {if $product.quantity <= 0}{if $allow_oosp}{$product.available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product.available_now}{/if}
</span>
  </p>
 {*END STRCT AVAILABLE*}

 

Then I would like to put a hiperlink (info) near the "Available for order" whit multilanguage code:

<a href="#">

 {l s='info'} 

</a>

 

I tried few times and methods.

 

Someone can help me whit the right syntax

Thanks to all.

Link to comment
Share on other sites

Hi,

first of all, you can't put the "style" attributes two times in a tag, so that's one issue. That's just a tag problem thoug. After that you have this stuff:

 

!$product.available_for_order|cat:"ciao"

 

This means "If the available for order string plus 'ciao' doesn't exist". So that will always be true unless you have something like: "Disponibileciao".

 

Therest looks ok. I'd do it this way:

 

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

 

of course you can use inline styles instead of classes. With this code you can also have sentences for other statuses than "available" and "not available" such as "available later" or "with different options".

 

------------

 

 

Dato che mi sembri italiano lo scrivo pure così, non si sa mai.

 

Sostanzialmente, all'inizio del codice ripeti due volte il tag style, cosa che non puoi fare. Dovresti lasciare aperto il primo prima dell'if, quindi aggiungere solo lo style che ti serve. Così:

 

<p id="availability_statut"  style="color:#4040ff; {if ($product.quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order OR $PS_CATALOG_MODE} display: none;"{/if}>

 

Ho rimosso l'aggiunta di "ciao", perchè in tal modo la condizione sarebbe sempre vera, visto che significa "se non esiste la frase $product_available_for_order con aggiunto ciao. Qualcosa come "Disponibileciao". Per il resto, io lo farei come il codice sopra. naturalmente puoi usare gli stili inline invece che le classi, ma è una scelta. Con il codice sopra visualizzi anche frasi del tipo "disponibile con altre combinazioni".

 

Spero di esserti stato utile.

 

Regards

Link to comment
Share on other sites

  • 3 weeks later...

Hi, thanks for your help

 

this is my code, I used it to put a different format and a different link when in my products list I have a product.available_for_order.

 

The remaining issue is that I need to set my product.quantity to 999999 for a avaiable product and set to -1 the products available_for_order.

but all products available_for_order will be set to 1 on the field product.available_for_order

I hope to be clear ( Maccaroni-Italian-Language )

 

Another question PS can allow to sell product set 0 in available_for_order mode?

 

 

<p id="availability_statut" {if ($product.quantity <= 0 && !$product.available_later && $allow_oosp) OR ($product.quantity > 0 && !$product.available_now) OR !$product.available_for_order OR $PS_CATALOG_MODE} {/if}>
{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
	<span class="availability {if ($product.allow_oosp || $product.quantity > 0)}classname{/if}">
			{if ($product.quantity > 0)}
					{l s='Disponibilita immediata'}
			{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
					{l s='Product available with different options'}
			{else if $product.allow_oosp && $product.quantity == 0}{l s='Disponibile'}
			{else}
					<a href="#" target="_self" class="myavailability" title="{l s='Info title'}">{l s='Out of stock'} (Info)</a>
			{/if}
	</span>
{/if}
</p> 

 

-------------------------------------------------------------------------------------------------------------------------------------

 

Ciao, grazie per il vostro aiuto

 

questo è il mio codice, l'ho usato per mettere un formato diverso e un collegamento diverso quando nella mia lista di prodotti c'e' un prodotto available_for_order.

 

Il problema che rimane è che ho bisogno di impostare il mio product.quantity a 999999 per un prodotto disponibile e a -1 i prodotti available_for_order.

ma tutti i product.available_for_order saranno impostati a 1 sul campo product.available_for_order

Spero di essere stato chiaro

 

Un altra domanda, PS puo' mettere in vendita i prodotti settati a 0 nel campo available_for_order?

 

Grazie ancora

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