Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity availability image and text Unlimited


Guest

Recommended Posts

Quantity availability image and text Unlimited

 

I have this allready installed a time ago, but I want to contribute it here so this first version is a BETA because I'm not 100% sure that I didn't forget something.

 

Please report errors and bug's.

 

-------------------------------------------------------

I wanted to show our costumers on a easy way what the stock of a product is, or the availability if not on stock.

It will show a image and text what the producktstock or availability is.

 

This contribution will show in productlisting and (if you want) on product_info page a quantity-image and text, indicating the product availabilty (or if you want) the exact stock.

You can use your own images or translate text whathever you like: (End of Life, SOLD OUT, Few days, 1 a 3 days, week, call for a price, mail for a price, 1 on stock, 2 on stock, few on stock, Expect soon (new) whathever you want ect.ect...) Just look at the included printscreen to see what I mean.

 

ATTENTION: TWO INSTALLATION INCLUDED A BASIC AND A EXTENDED (RECOMMENDED) INSTALL VERSION.

 

Installation is easy 5 a 10 minutes, just two files to edit and add translated text to every languagefiles you have, english, german, dutch included already. (So Multi Language is supported)

 

catalog/included/functions/general.php

catalog/product_info.php

 

catalog/included/languages/dutch catalog/included/languages/english

catalog/included/languages/german

 

catalog/images/ <all.images.gif>

 

Included:

Screenshots of the produktlisting and productinfo page so you can see how it look likes.

All changed files in there original OsCommerce folder

Manual for installation in case you have already have some contrib. or whatever installed.

quantity images (also some extra images and a photoshop.psd included)

Multi Language supported and included for english, german, dutch.

Link to comment
Share on other sites

Nice Contri ;)

 

If like me you want to have just 3 stock status's (in stock, limited stock, out of stock) then change includes>functions>general to :

// #################### START Qauntity images and text unlimited #############

function picto_qty($quantity=0) {

global $warning_stock ;

if (($quantity >= 500 ) and ($quantity <= 1000 )) {  $picto = tep_image(DIR_WS_ICONS.'In_Stock.gif') ;

}

elseif (($quantity >= 100 ) and ($quantity <= 499 )) {  $picto = tep_image(DIR_WS_ICONS.'Low_Stock.gif') ;

}

else  { $picto = tep_image(DIR_WS_ICONS.'Out_of_Stock.gif') ;

}

return $picto;

}

 

// #################### END Qauntity images and text unlimited ############# 

Here you can see that stock levels between 500 & 1000 will show as being in stock, 100 to 499 as limited stock & 0-99 as out of stock- you can change these to whatever you like.

Ive shown this formula in admin when editing the quantity on a product by changing admin>categories line 1000ish approx find:

          <tr>

            <td class="main"><?php echo TEXT_PRODUCTS_QUANTITY ; ?></td> 

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>

          </tr>

 

to

 

          <tr>

            <td class="main"><?php echo TEXT_PRODUCTS_QUANTITY . '<br><small>' . TEXT_PRODUCTS_STOCK_DESC1 . '<br>' .TEXT_PRODUCTS_STOCK_DESC2. '</small>'; ?></td> 

            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>

          </tr>

 

And then in admin>includes>languages>english>categories add:

define('TEXT_PRODUCTS_STOCK_DESC1', 'Stock 0 = Out of Stock <br> 100-499 = Limited Stock');

define('TEXT_PRODUCTS_STOCK_DESC2', '500-1000 = In Stock');

 

So when you change the quantity to the different status's in admin it will look like this

quantity.jpg

 

Thanks John2b

Link to comment
Share on other sites

Hi,

 

I want add this Contrubution here, instead of stock showing numers_

 

http://www.satnor.com/index.php?cPath=1_4&...38cf1b3d0171428

 

The contribution is this:

http://www.oscommerce.com/community/contributions,2507

 

I have succesfully implemented this is code in product_info:

http://www.satnor.com/product_info.php?cPa...38cf1b3d0171428

 

But i cant understand what code and what file to edit, since i want to show this stock gif with text in the product lstning aswell istead of the stadard stock numbers.

 

Its a very nice Contribution, thanks :-)

 

Regards,

Farrukh Munir

Link to comment
Share on other sites

Hi Farrukh,

 

It doesn't show up in produkt listing do you mean, that's what must happend if you have add the contrib to your:

 

catalog/included/functions/general.php

 

so go to the admin, configuration, product listing, and switch on show produkt qauntity (not 0) .

 

0= not showing

1 or other number for sorting

 

Let me known if that is the solution :-)

 

John

Link to comment
Share on other sites

getting this error:

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/synertra/public_html/store1/includes/functions/general.php:1291) in /home/synertra/public_html/store1/includes/functions/sessions.php on line 67

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/synertra/public_html/store1/includes/functions/general.php:1291) in /home/synertra/public_html/store1/includes/functions/sessions.php on line 67

 

 

on the top of the page

also my picture icons arent showing for the indicator...

 

anyone want to help me that would be great!!

 

aim-weberscloseout

yahoo-stevethecritic

[email protected]

 

[email protected]

[email protected]

 

thanks

Link to comment
Share on other sites

Is There anyone who can help me out of this now ?

 

Regards,

Farrukh Munir

 

hello,

 

i find a solution for your problem, to show up the icons instead of the numbers.

 

go to your shop folder/includes/modules/product_listing.php and find something like that:

 

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'center';

$lc_text = ' ' . $listing['products_quantity'] . ' ';

break;

 

change it to:

 

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'center';

// product image in listing hack hazwo

// original $lc_text = ' ' . $listing['products_quantity'] . ' ';

$lc_text = ' ' . picto_qty($listing['products_quantity']) . ' ';

break;

 

on my installation, this little thing works great.

 

regards,

 

hazwo

cu,

 

hazwo

Link to comment
Share on other sites

hello again,

this is the piece of code on a clean installation:

search for in folder/includes/modules/product_listing.php

 

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_quantity'] . ' ';

break;

 

replace it with:

 

// start hack

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'center';

// product image in listing hack patch

// original $lc_text = ' ' . $listing['products_quantity'] . ' ';

$lc_text = ' ' . picto_qty($listing['products_quantity']) . ' ';

break;

// eof hack

cu,

 

hazwo

Link to comment
Share on other sites

Hey!

 

I cant get product_listing.phpto work right.

It only shows a icon or the gif picture of a bar in the top of page.

There is nothing in the product listing.

I have use your hack in the file. But maybee i did something wrong?

 

Best Regards

Bengan

Link to comment
Share on other sites

Hey!

 

I cant get product_listing.phpto work right.

It only shows a icon or the gif picture of a bar in the top of page.

There is nothing in the product listing.

I have use your hack in the file. But maybee i did something wrong?

 

Best Regards

Bengan

 

 

Sorry, forgot the part of produkt_listing. See hack of Hawzo, or use the update at the contrib section.

 

Thanks to HawZo

Link to comment
Share on other sites

  • 3 weeks later...

I use STS Template System and design the product_info.php page myself depending on what values/fields i want to use.

 

Is there a way to add the quantity status image into a infobox ? cos if it is, i might be able to use this contribution together with STS Template System by adding the code into a infobox that i then include into each product description page.

 

Or is anyone else using STS with this contribution using another method?

 

Prince Tom

Link to comment
Share on other sites

  • 4 weeks later...

I would like to show actual stock numbers when a product is in stock, and the stock quantity is below a certain amout.

 

I tried in the language file, but could not get it to show the number, only the text

 

These are the lines:

 

catalog/include/laguages/english.php

define('TEXT_STOCK_FEW', '2-5' );

define('TEXT_STOCK_VERY_FEW', '1-2');

define('TEXT_STOCK_ON_STOCK', '100+');

 

The two first should show actual numbers, while the last is OK.

 

 

I have tried several possibilities, like.

define('TEXT_STOCK_VERY_FEW', quantity);

define('TEXT_STOCK_VERY_FEW', products_quantity);

 

With and without .. and ''

 

I even tried:

define('TEXT_STOCK_VERY_FEW',($listing['products_quantity']));

 

Is there any way to do this in the languagefile?

 

If not, maybee I could edit the catalog/includes/functions/general.php ?

 

I am a bitt dazzled and confused here. (please help....)

Malawi, The Fisher King

AKA Trygve Lillefosse

Link to comment
Share on other sites

Oke, let starts...

 

I will explain it detailed as possible so the everyone can use it, and tune it for his one purposses.

 

Firts you must figer out how many different stock indications you want to show.

 

EXAMPLE 1:------------------------

 

Just only a onstock image (whit text ON STOCK) and nostock image (with text NO STOCK)

 

SO you have just TWO indicators

 

ON STOCK (STOCK_ON_STOCK)

NO STOCK (TEXT_STOCK_TEMP)

 

EXAMPLE 2:------------------------

 

You want to display the following:

 

STOCK_FULL (more then 100)

STOCK_MEDIUM (6 - 99)

STOCK_FEW (3 - 5 )

STOCK_VERY_FEW ( 1 - 2)

STOCK_NO ( 0 or less)

 

In this case you have FIVE indicators

 

Look at my script to explain EXAMPLE 1:

catalog/included/functions/general.php

 

 

// ######### START Qauntity images and text unlimited #############

function picto_qty($quantity=0) {

global $warning_stock ;

if ($quantity <=0 ) { $picto = tep_image(DIR_WS_ICONS.'stock_red_6.gif', TEXT_STOCK_TEMP).'<br>'. TEXT_STOCK_TEMP ;

}

 

 

 

else { $picto = tep_image(DIR_WS_ICONS.'stock_green_6.gif', TEXT_STOCK_ON_STOCK ).'<br>'. TEXT_STOCK_ON_STOCK ;

}

return $picto;

}

 

// ######### END Qauntity images and text unlimited #############

 

So there is in this script always a beginning and a end.

 

The beginning is the IF statement

and the end is the ELSE statement

 

 

Look at my script to explain EXAMPLE 2:

catalog/included/functions/general.php

 

// ###### START Qauntity images and text unlimited #############

 

function picto_qty($quantity=0) {

global $warning_stock ;

if ($quantity <= 0 ) { $picto = tep_image(DIR_WS_ICONS.'stock_red_6.gif', TEXT_STOCK_BUY).'<br>'. TEXT_STOCK_BUY ;

}

 

 

elseif (($quantity <= 1 ) and ($quantity >= 2 )) { $picto = tep_image(DIR_WS_ICONS.'stock_red_6.gif', TEXT_STOCK_VERY_FEW).'<br>'. TEXT_STOCK_VERY_FEW ;

}

 

 

elseif (($quantity <= 3 ) and ($quantity >= 5 )) { $picto = tep_image(DIR_WS_ICONS.'stock_orange_6.gif', TEXT_STOCK_FEW).'<br>'. TEXT_STOCK_FEW ;

}

 

 

elseif (($quantity <= 6 ) and ($quantity >= 9 )) { $picto = tep_image(DIR_WS_ICONS.'stock_orange_6.gif', TEXT_STOCK_SOON).'<br>'. TEXT_STOCK_SOON ;

}

 

 

else { $picto = tep_image(DIR_WS_ICONS.'stock_green_6.gif', TEXT_STOCK_ON_STOCK ).'<br>'. TEXT_STOCK_ON_STOCK ;

}

return $picto;

}

 

// ######## END Qauntity images and text unlimited #############

 

 

 

You see that also in this case there is a beginning and a end.

 

The beginning is the IF statement

and the end is the ELSE statement

 

and for every extra statement (stock indication) you want you can cut and paste a ELSEIF between the first IF and the ELSE as many you want.

 

Just edit the two TEXT_STOCK_SOON in what you want, or use the one we have used. If you change it in whatever TEXT_STOCK_BLABLA than you must define languages also:

 

define('TEXT_STOCK_BLABLA', '2 or 5 pieces');

 

You can also use your own images, just put you images in that directory and change the name:

 

 

else { $picto = tep_image(DIR_WS_ICONS.'your_own_image.gif', TEXT_STOCK_ON_STOCK ).'<br>'. TEXT_STOCK_ON_STOCK ;

}

return $picto;

}

 

 

 

I hope it more clear now, maybe I will add this manual to the contribution with the next update of the script.

 

Any question...???

Link to comment
Share on other sites

Hello

 

I have tried to use your contribution, but, I can?t see the images. It always returns the "X" image error. I mean, when you don?t upload the images but you are indicating the image position in its stock column.

 

I?m only copying and pasting your contribution, and works fine, but it is the only problem I have, and all the images are uploaded correctly.

 

Any idea?

Edited by Csc
Link to comment
Share on other sites

Hello

 

I have tried to use your contribution, but, I can?t see the images. It always returns the "X" image error. I mean, when you don?t upload the images but you are indicating the image position in its stock column.

 

I?m only copying and pasting your contribution, and works fine, but it is the only problem I have, and all the images are uploaded correctly.

 

Any idea?

You are using the v1.0 right?

 

Did you remember to create the directory catalog\images\icons\qicons , and put the icons in there?

 

Did you remember to put the line

 

define('DIR_QUANTITY_ICONS', DIR_WS_ICONS . 'qicons/');

 

in your \catalog\includes\configure.php file?

Edited by Malawi

Malawi, The Fisher King

AKA Trygve Lillefosse

Link to comment
Share on other sites

Oke, let starts...

I hope it more clear now, maybe I will add this manual to the contribution with the next update of the script.

 

Hi.

 

Sorry for the late reply, have been working a lot(in my normal job) the last few days.

 

I think this is a litle missunderstanding.:-)

Probarbly because we both have english as a second language.:-)

quantity image is up and working at my site, and I know the bacics for adding/removing indicators and their range.

 

I had a problem with the syntax used to enter the value into the var/constant that holds the text to be shown under the image.

 

Had a fresh look at it today, and found out how to do it.

 

 

I edited the /catalog/includes/functions/general.php like this:

 

elseif (($quantity >= 1 ) and ($quantity <= 3 )) { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_1.gif', quantity).'<br>'. $quantity ;

}

elseif (($quantity >= 4 ) and ($quantity <= 7 )) { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_2.gif', quantity).'<br>'. $quantity ;

}

elseif (($quantity >= 7 ) and ($quantity <= 10 )) { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_3.gif', quantity).'<br>'. $quantity ;

}

elseif (($quantity >= 11 ) and ($quantity <= 15 )) { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_4.gif', quantity).'<br>'. $quantity ;

}

elseif (($quantity >= 16 ) and ($quantity <= 20 )) { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_5.gif', quantity).'<br>'. $quantity ;

}

else { $picto = tep_image(DIR_QUANTITY_ICONS.'stock_green_6.gif', TEXT_STOCK_ON_STOCK ).'<br>'. TEXT_STOCK_ON_STOCK ;

 

 

This means that I can remove

define('TEXT_STOCK_FEW', '2-5 pieces');

define('TEXT_STOCK_VERY_FEW', '1-2 pieces');

 

from the languag-files, as they will not be in use.

 

By doing it this way, the actual stock is shown in the listing, now the only problem is that it does not update when i put something in the basket. But I think that may be because of a contributon called "Bundled Products", witch I will continue work on installing in a few minutes.

 

BTW: It may be a good idea to include both your explanation, and this one into a later version.

Malawi, The Fisher King

AKA Trygve Lillefosse

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Nice contrib - thanks, it has improved the store no end.

 

I operate my store a little differently than many people seem to though.

 

I need 3 different states:

 

1) In Stock (where stock quantity > 0)

2) Out of stock (where stock quantity =<0)

3) On order (where products_date_available > today)

 

Is it possible for this contrib to look at the products_date_available field in the database and show the 'on order' graphic if it's on order?

 

Many thanks

 

Peter

Link to comment
Share on other sites

  • 3 weeks later...
Hi,

 

Nice contrib - thanks, it has improved the store no end.

 

I operate my store a little differently than many people seem to though.

 

I need 3 different states:

 

1) In Stock (where stock quantity > 0)

2) Out of stock (where stock quantity =<0)

3) On order (where products_date_available > today)

 

Is it possible for this contrib to look at the products_date_available field in the database and show the 'on order' graphic if it's on order?

 

Many thanks

 

Peter

 

The two first ones are quite easy, and are explained in this tread.

 

Number 3 should be possible.

 

Something like this. Do not remember the name of the present date variable, but if you play around with it, I guess you will make it work.

 

/catalog/includes/functions/general.php :

elseif (products_date_available > date ) { $picto = tep_image(DIR_QUANTITY_ICONS.'on_order.gif');

Malawi, The Fisher King

AKA Trygve Lillefosse

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I would like the ability to add a simple text message of either "In Stock" or "Out of Stock" on my product info page AND if the item is "Out of Stock", the add-to-cart button is automatically removed.

 

Is this possible? If so, can someone help with this?

 

Cheers,

Scott

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...