Jump to content

Recommended Posts

Hi guys, hoping you can help me here.

 

I have implemented prestashop at my work but they have asked for a specific extra I can't see that exists elsewhere already.

 

They would like a tickbox on the product page that says "More than one available?" with a tickbox, featuring a red cross if quantity =1, and a green tick if quantity >1. (See pictures)

 

It would probably be placed in the same box as the short description is displayed, after a few linebreaks (where it is implemented obviously doesn't matter as the code can be moved)

 

Any help would be much appreciated!

 

 

Kind regards.

post-355303-0-59487100-1342805585_thumb.png

post-355303-0-19973700-1342805591_thumb.png

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

Hi,

 

you can manage the diponibility of your poru-duct in product.tpl file in your template directory.

 

serch the code:

           <!-- availability -->
           <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>

and adapt it to your wait

Link to comment
Share on other sites

Hi Jeckyl,

 

Thanks for your reply. I tried to edit the code (see below) but couldn't see any change in the FrontOffice?

 

 

<p id="availability_statut">

<span id="availability_label">{l s='More than 1 available?:'}</span>

<span id="availability_value" {if="" $product-="">quantity <= 0} class="warning_inline"{/if}>

{if $product->quantity >= 1}{else}{l s='NO'}{else}{l s='YES'}{/if}

</span>

</p>

 

 

I am trying to get it to say 'More than 1 available?:' then 'YES' if quantity >1 and 'NO' if Quantity <=1

 

 

Apologies as my Smarty is pretty non-existent.

Thanks in advance for any help.

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

If anyone else needs the answer to this, I have coded three solutions:

 

1) Displays whether there is more than one available (Yes or No).

<p id="morethan1">More than 1 available:
{if ($product->quantity > 1)} <span>{l s='YES'}</span>
{else} <span>{l s='NO'}</span>
{/if}</p>

 

2) Displays the available quantity (numerically)

{if isset($product->quantity)}<spanclass="new" style="text-transform:capitalize;">Quantity Available: {l s={$product->quantity[spam-filter]{/if}

 

3) Displays a Tickbox or Cross (from img directory) depending on whether quantity > 1

<p id="morethan1"><b>More than one available:</b>
{if ($product->quantity > 1)} <span><img src="{$img_ps_dir}admin/enabled.gif" alt="{l s='Yes'}" style="vertical-align:text-top;"/></span>
{else} <span><img src="{$img_ps_dir}admin/disabled.gif" alt="{l s='No'}" style="vertical-align:text-top;"/></span>
{/if}</p>

 

 

Thanks again to Jeckyl for your advice.

Bluebolt44

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

×
×
  • Create New...