Jump to content

Add a "Pre-Order" button for out of stock products that are allowed to order?


Recommended Posts

How do add "Pre-Order" button  only for the products that out of stock and have option "Allow orders" selected. I cant enable "Allow ordering of out-of-stock products" for all products because i want to enable pre-orders only for selected items

 

hSmD4k0.jpgI managed to change button in product-list.tpl but i can't make it workt on the product page.

Prestashop 1.5.5, custom theme

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

Tried and it changes button to Pre-Order but also changes buttons for products that in stock . Do i need to add one more if statement?

			<!-- availability -->
            {assign var=non value=none1}
			<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}      {assign var=non value=none} 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>{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
					<span id="availability_label" {if ($non!=none)} class="hidden"{/if}>{l s='Availability:'}</span>
                (<span id="quantityAvailable">{$product->quantity|intval}</span>
				<span  {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span>
				<span   {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span>)
                
			</p>

			{/if}
            
                        		<p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
				<span id="availability_date_label">{l s='Availability date:'}</span>
				<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
			</p>



	

			<p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p>
		</div>

		<div class="content_prices clearfix">
                          {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
                <script type="text/javascript">
				$('#mailalertt:hidden').fadeIn(600);
				</script>
			{/if}
				<p id="add_to_cart"  {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
					<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
				</p>
			
        


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

products in stock? it's not possible, this code display pre-order when product is not in stock

perhaps you mean products that are allowed to order when they are out of stock ?

maybe i did it wrong. Which code part should i replace in my previous post?

Link to comment
Share on other sites

products in stock? it's not possible, this code display pre-order when product is not in stock

perhaps you mean products that are allowed to order when they are out of stock ?

 

I have played around with code in product.tpl and made it work so

When product out of stock - it displays no button

When product out of stock and available for order - displays "Pre-Order" button

When product in stock - displays "Add to cart" button

 

just worried my edit can cause some issues, does it look fine?

<div class="content_prices clearfix">
                          {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}
                <script type="text/javascript">
				$('#mailalertt:hidden').fadeIn(600);
				</script>
				
			{/if}
				<p id="add_to_cart"  {if ($product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
					<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
				</p>
				<p id="add_to_cart"  {if (!$allow_oosp) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
					<input type="submit" name="Submit" value="{l s='Pre-Order'}" class="exclusive" />
				</p>
Edited by fishordog (see edit history)
Link to comment
Share on other sites

  • 9 months later...

How do add "Pre-Order" button  only for the products that out of stock and have option "Allow orders" selected. I cant enable "Allow ordering of out-of-stock products" for all products because i want to enable pre-orders only for selected items

 

hSmD4k0.jpgI managed to change button in product-list.tpl but i can't make it workt on the product page.

Prestashop 1.5.5, custom theme

 

How did you do this in product-list.tpl?

i cannot get the add to cart button to change to pre-order on 0 stock and allowed.

Link to comment
Share on other sites

  • 1 year later...

 

you can try with this:

{if $product->quantity > 0}
<span>{l s='Add to cart'}</span>
{else}
<span>{l s='Pre Order'}</span>
{/if}

Use this code instead of simple

<span>{l s='Add to cart'}</span>

Thank you vekia! Perfect solution to product page but unfortunately doesn't work with product-list.tpl.

 

If I change it there, all products will have Pre Order button. Not just the ones which are out of stock.

 

Using Prestashop 1.6.1.10

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

×
×
  • Create New...