Jump to content

Modify availability value in cart and product list page


Recommended Posts

I set up my shop to allow ordering out of stock products indicating (in the quantity page in BO) the estimate time of shipping for out of stock products (let's say, for example, "Shipped in 7 days").

 

Now the funny thing on FO:

 

In product list page, the product is shown as "Available"

In product page, the product is shown as "Shipped in 7 days"; <-- TRUE

In the cart the product is shown as "Out of stock".

 

How do I allow to show always the same (and true) availability value?? (the one I set in the BO)

 

Link to comment
Share on other sites

  • 5 weeks later...
  • 2 weeks later...
  • 4 weeks later...

Ok, I was able to partially solve the problem. Still not perfect but better than before (at least for my needs).

If someone is interested this is what I did:

 

In product-list.tpl, at line 141 changed this:

{if ($product.allow_oosp || $product.quantity > 0)}

into this:

{if $product.quantity > 0)}

In the same file, added this at line 149:

 

{elseif ($product.allow_oosp || $product.quantity <= 0)}
         <span class="available_later"> {l s='Backorder'}</span>
(not deleted or modified anything, just added those lines before {else}.....)
 
Now, if a product is out of stock but can be orderd, you'll have a label "Backorder" instead than "Available". You can also translate the label in your translation page (your theme, frontend) where you'll find a new field.
 
To give this label a different color, I added the following section in product-list.css:
 
ul.product_list .availability span.available_later {
  display: inline-block;
  color: #fe9126;
  font-weight: bold;
  padding: 0px;
  margin-bottom: 5px;
  margin-top:5px; }
Please note that I'm using a custom theme so your values may differ. Basically, I copied the "ul.product_list .availability span" section changing just the color value.
 
Now, in the shopping cart I simply removed the availability column (will try to show the availability values as soos as I'll have a little time to investigate it).
In shopping-cart.tpl, removed lines 86->88:
{if $PS_STOCK_MANAGEMENT}
<th class="cart_avail item">{l s='Avail.'}</th>
{/if}

and in shopping-cart-product-line.tpl removed lines 34->36:

{if $PS_STOCK_MANAGEMENT}
<td class="cart_avail" >{if $product.quantity_available > 0}<span class="label label-success">{l s='In Stock'}</span>{else}<span class="label label-warning">{l s='Out of Stock'}</span>{/if}</td>
{/if}

If someone has a better solution he's welcome.

Link to comment
Share on other sites

I am not able to modify thes files right now to test it but maybe you can answer me question:

I need Prestashop to set the product (that is not in stock but has allowed backorders) to be available in a certain amount of days from when it is ordered by a customer. Because in my XML feed for a partner it shows availability immediately (0 days) as it were in stock. Your solution does not solve my problem, right?

Link to comment
Share on other sites

×
×
  • Create New...