Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Change product Availability options to include “imidiate, 10 days etc”
 
cjpwood
Member
 
Total Posts:  55
Joined:  2008-10-24
Manchester UK
 

Hi Guys,

I list lots of products, some i have in my possession and some i order from my supplier when a customer wants them.  At the moment in magento a product can show either “in stock” or “out of stock”. if a product is out of stock then a customer cant buy it...I need to be able to let customers buy everything but also understand that some items may take longer than other.

In the back end in inventory where i choose “in stock” or “out of stock” i would rather have some more appropriate options such as “available immediately”, “available10 days” etc etc then the selection will be displayed on the front end…

can any one help? have i even described this in a way that makes sense?

many thanks!!

chris!

 
Magento Community Magento Community
Magento Community
Magento Community
 
trigem
Jr. Member
 
Total Posts:  17
Joined:  2008-05-11
 

Any solutions or workarounds to this problem? Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 

Do the following:
1) Add an attribute, say “Availability” ( type select, show on product page “Yes")
2) Set product as “In stock”, mange stock “No”
3) (optionally ) Modify /catalog/product/view.phtml or /catalog/product/addto.phtml
to display “Availability” status, for instance, near the “Add to Cart” button

 
Magento Community Magento Community
Magento Community
Magento Community
 
cjpwood
Member
 
Total Posts:  55
Joined:  2008-10-24
Manchester UK
 

hello...haha! very strange but i have just (literally yesterday) paid a developer to produce this and it should be ready for me later today...it works by editing the actual stock drop down in the front and back end

I love the solution by adjustware, ah… if only i had seen it a day ago my week would have been much cheaper!

if anyone is interested in my solution (it involves editing core magento files :( then let me know and ill get it up once i have the change log…

regards

chris

 
Magento Community Magento Community
Magento Community
Magento Community
 
DaKe
Member
 
Avatar
Total Posts:  41
Joined:  2008-04-01
São Paulo - Brazil
 
Adjustware - 28 August 2009 03:28 AM

Do the following:
1) Add an attribute, say “Availability” ( type select, show on product page “Yes")
2) Set product as “In stock”, mange stock “No”
3) (optionally ) Modify /catalog/product/view.phtml or /catalog/product/addto.phtml
to display “Availability” status, for instance, near the “Add to Cart” button

Thanks for your tip…

But can you upload a sample view.phtml ? So non-developers can setup it.
I lost on the phase 3

Thanks again

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 

>I lost on the phase 3
Add the following line in the app\design\frontend\default\default\template\catalog\product\view\type\simple.phtml (for simple products as you may already guess):
<p><?php echo $_product-getAvailabikity() ?></p>
to be read like

<?php if($_product->isSaleable()): ?>
    
<class="availability"><?php echo $this->__('Availability: In stock.'?></p
    <
p><?php echo $_product-getAvailabikity() ?></p>  <!-- new line -->
 
Magento Community Magento Community
Magento Community
Magento Community
 
very nice person
Member
 
Total Posts:  49
Joined:  2009-08-04
 
cjpwood - 28 August 2009 03:33 AM

if anyone is interested in my solution (it involves editing core magento files :( then let me know and ill get it up once i have the change log…
chris

Hi! I would greatly appreciate so see your solution!

thanks in advance,
vnp

 
Magento Community Magento Community
Magento Community
Magento Community
 
IGGY1234
Jr. Member
 
Total Posts:  24
Joined:  2009-03-29
UK
 

Our company wanted just this facility.  I have knocked up a quick and dirty solution that does the job.

Firstly, as stated by Adjustware, set ‘Manage Stock’ to ‘No’.  I will expand on adding custom messages to your catalog views.

Now create this code in your code/local folder (I put it in a further subdirectory, so the full path was code/local/ebdj/myfunctions.php

<?php function custom_messages($object,$_product)
{
        
/* to use: <?php require_once 'ebdj/myfunctions.php'; custom_messages($this,$_product); ?> */

        
$due_in_message $_product->getData('due_in_message');
        
$due_in_message_expiry $_product->getData('due_in_message_expiry');
        
$custom_message $_product->getData('custom_message');
        
$custom_message_expiry $_product->getData('custom_message_expiry');
        
$delivery_message $_product->getData('delivery_message');
        
$message_flag=0;
        
$due_in_flag=0;
        
$delivery_flag=0;
        
$custom_flag=0;
        
$prior=0;
        
        if((
$due_in_message !='') and (($due_in_message_expiry == '') or (strtotime($due_in_message_expiry) > time()) ) )
        
{$due_in_flag=1;}
        
if(($custom_message !='')  and (($custom_message_expiry == '') or (strtotime($custom_message_expiry) > time()) ) )
        
{$custom_flag=1;}
        
if($delivery_message!='')
        
{$delivery_flag=1;}

        $message_flag
=($due_in_flag or $delivery_flag or $custom_flag);
        
        if(
$message_flag)
        
{
            
echo $object->__('<div class="custom_clubhouse_messages">');
            
            
// Due In Message
            
if($due_in_flag)
            
{
                
echo $object->__('<p class="custom_due_in_message">');
                echo 
$object->__($due_in_message);
                echo 
$object->__('</p>');
                
$prior=1;
            
}
            
            
// Custom Message
            
if($custom_flag)
            
{
                
if($prior){echo $object->__('<br/>');}
                
echo $object->__('<p class="custom_promotion_message">');
                echo 
$object->__($custom_message);
                echo 
$object->__('</p>');
                
$prior=1;
            
}
            
        
            
// Delivery Message
            
if($delivery_flag)
            
{
                
if($prior){echo $object->__('<br/>');}
                
echo $object->__('<p class="custom_delivery_message">');
                echo 
$object->__($delivery_message);
                echo 
$object->__('</p>');
                
$prior=1;
            
}
            
            
echo $object->__('</div>');
        
}
}
?>

This code requires 5 attributes be created for your products in the ‘General’ section of the Attributes with the following SKU’s and field types:

due_in_message - text field
due_in_message_expiry - date field
custom_message - text field
custom_message_expiry - date field
delivery_message - text field

The purpose of due_in_message_expiry and custom_message_expiry I hope are self explanatory, after these dates the associated fields will not be displayed.  Leaving these dates blank means the associated messages will be displayed ad-infinitum.

Also remember to set all the attributes visibilities to ‘Yes’ in the appropriate section.

What remains then is to place the call to this function in the appropriate phtml files in your frontend - as my company wanted to replace altogether the ‘Out Of Stock’ messages I had to track down a number of places such as list.phtml and view/type/simple.phtml (example below).  If you are happy to have the default Out Of Stock message displayed along with the custom messages you really only need to edit the list.phtml and view.phtml files (possibly also the phtml’s associated to Wishlist and Compare) for the template you are using.

If you are unsure of which phtml files are responsible for displaying the particular view you want the messages in, activate the ‘display template hints’ under your Developer options in Magento backend.

Note in list.phtml you need to add the line in both list view and grid view.

The actual additional line is very simple, shown below denoted with ‘new code by Jason’.

File: app/design/frontend/blank/default/template/catalog/product/view/type/simple.phtml

<?php $_product $this->getProduct() ?>

<?php 
/* removed by Jason if($_product->isSaleable()): ?>
    <p class="availability"><?php echo $this->__('Availability') ?>: <span class="in-stock"><?php echo $this->__('In stock') ?></span></p>
<?php else: ?>
    <p class="availability"><?php echo $this->__('Availability') ?>: <span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; */ 
?>

<?php 
/* new code by Jason */?>
<?php 
require_once 'ebdj/myfunctions.php'custom_messages($this,$_product); ?>
<?php 
/* End new code by Jason */?>

/ebdj is a subdirectoy in my code/local folder, if you saved the myfunctions.php file directly into code/local the additional line would simply read:

<?php require_once 'myfunctions.php'; custom_messages($this,$_product); ?>

The messages have a custom css class for your own styles associated, which I hope are clear enough from the code, and I hope it’s obvious enough how to add/remove messages as required.

I’m sure this is all terrible from a system design and good coding practice standpoint, but as a quick dirty fix to this exact same problem I was presented, it does the job.

 
Magento Community Magento Community
Magento Community
Magento Community
 
DaKe
Member
 
Avatar
Total Posts:  41
Joined:  2008-04-01
São Paulo - Brazil
 

I tried this solution beside, it’s pretty simple for everyone give a shot!

http://www.magentocommerce.com/boards/viewthread/53751/

Worked very well for me…

Thanks guys

 
Magento Community Magento Community
Magento Community
Magento Community
 
oldcreekwbf
Jr. Member
 
Total Posts:  24
Joined:  2008-06-13
 

Heres a really easy and quick solution for this problem, which requires you to only change 1 line of code.

First create an attribute in the back-end (aka admin) of magento and label it availability. Set it up how ever you like.

Then in the file app/design/frontend/default/default/template/catalog/product/view/type/simple.phtml change line 36

from:

<class="availability in-stock"><?php echo $this->__('Availability:'?> <span><?php echo $this->__('In stock'?></span></p>
to:
<class="availability in-stock"><?php echo $this->__('Availability:'?> <span><?php echo $_product->getAttributeText('availability'?></span></p>

What this code change does is instead of always saying ‘In Stock’ it will simply output whatever you select for the availability attribute.

Bonus Tips:
1 - First you should create a local copy of simple.phtml as to not alter the original. But if that doesn’t make sense, then don’t worry about it
2 - This works only on simple product types. But it should be really easy to open up the other files (ex: configurable.phtml or grouped.phtml) and make the necessary changes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
vasile.baciu
Jr. Member
 
Total Posts:  2
Joined:  2009-10-30
 

Where can I find this code in Magento 1.4.0.1 ?
Thx.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 
vasile.baciu - 07 March 2010 01:49 AM

Where can I find this code in Magento 1.4.0.1 ?
Thx.

There’s an extension for this - Custom Stock Status. With it you can add custom availability (or out of stock) options and it is compatible with Magento 1.4.0.1.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sweet Gunner
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2009-02-04
 
oldcreekwbf - 28 February 2010 02:45 PM

Heres a really easy and quick solution for this problem, which requires you to only change 1 line of code.

First create an attribute in the back-end (aka admin) of magento and label it availability. Set it up how ever you like.

Then in the file app/design/frontend/default/default/template/catalog/product/view/type/simple.phtml change line 36

from:

<class="availability in-stock"><?php echo $this->__('Availability:'?> <span><?php echo $this->__('In stock'?></span></p>
to:
<class="availability in-stock"><?php echo $this->__('Availability:'?> <span><?php echo $_product->getAttributeText('availability'?></span></p>

What this code change does is instead of always saying ‘In Stock’ it will simply output whatever you select for the availability attribute.

Bonus Tips:
1 - First you should create a local copy of simple.phtml as to not alter the original. But if that doesn’t make sense, then don’t worry about it
2 - This works only on simple product types. But it should be really easy to open up the other files (ex: configurable.phtml or grouped.phtml) and make the necessary changes.

This was exactly wht i was looking for… THANKS A LOT!

 
Magento Community Magento Community
Magento Community
Magento Community
 
chadjmorgan
Sr. Member
 
Avatar
Total Posts:  252
Joined:  2010-06-04
Michigan
 

this is exactly what i was looking for, except when i change the code it just says “availability:” and then is blank.  Any help would be greatly appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
becms
Jr. Member
 
Total Posts:  3
Joined:  2010-05-25
 

Thanks for solution.

To chadjmorgan:

The correct line is this:

<class=\"availability in-stock\"><?php echo $this->__(\'Availability:\'?> <span><?php echo $_product->getavailability() ?></span></p>

Now it’s working smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
becms
Jr. Member
 
Total Posts:  3
Joined:  2010-05-25
 

You should only use this code if availability is an drop-down:

<class="availability in-stock"><?php echo $this->__('Availability:'?> <span><?php echo $_product->getAttributeText('availability'?></span></p>

If it’s a text field, use the one I mentioned above.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2