Jump to content

How to use a true/false value for showing product availability on screen?


Recommended Posts

Hi everyone, I asked this already in another forum but since is more related to development, i decided to move it here as well. 

 

So. 

I disabled stock management totaly, because I am not able to upload quantitues for different attributes without a module, anyway, thing is that I do not use that anymore. No warehouse, no stock, no quantities whatsoever - for now. But still, I would like to be able to show on screen if a product is available or not, and I thought choosing another value, like on_sale - which i do not use otherwise - would do the trick. I need your help in this. We are at product.tpl. The code below is meant to decide if avilability is shown on product page or not:

 

<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} style="display: none;"{/if}>
<span id="availability_label">{l s='Availability:'}</span>
<span id="availability_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> 

Since there is no more quantity, i would like to use product ->on_sale to show availability instead of quantity, since on_sale has only two values, 0 and 1. Then i`d be able to upload these values in bulk by csv.

 

Question is: how to modify the above code so it will display availability based on on_sale value, REGARDLESS of the attributes?

 

(I want this to take its value only from ps_product, not ps_product_attribute or whatever table is using)

 

All I want is to add a two value swich wich will display on screen one of the two values: in stock (if on_sale=1) or available for order (if on_sale =0)

 

Please someone help me do this before christmas. Thank you

 

PS: any other solution is wellcome for this issue...

Edited by Salus (see edit history)
Link to comment
Share on other sites

Thanks for the reply, I already thought of this, but unfortunately that is no solution. See, I have 1350+ products, and 40-50% of these have more than a dozen attributes, or attribute combinations. if I enable stock management, then quantities will be applyed to every single combination - been there, done that. I do not want to upload anything manually, that would take ages. My goal here is to be able to upload availability data by csv without any external module, which is impossible right now using current upload possibilities given by prestashop. Or am I missing something? do you know a way of uploading quantities for attributes? in table ps_product_attributes

 

Please see my original problem here (no solution yet):

http://www.prestashop.com/forums/topic/387356-how-to-list-products-that-have-attributes/

Edited by Salus (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...