Jump to content
surfalot

[Contribution] Availability

Recommended Posts

Abstract:

 

Availability contribution allows you to set an unique message to

display on each product relating to the availability of the item.

Two messages can be set, one for in-stock and another for out of stock.

Includes convenient admin tool to add and modify the messages

menu on the product edit page. Allows you to include the actual

stock quantity in the message.

 

An attempt was made to maintain multi-language awareness.

 

You can set one product, when in-stock, to display:

"Availability: in stock, usually ships in 2-3 days"

and when the stock runs out, "Availability: temporarily out-of-stock"

Another product may be set to display:

"Availability: made to order, usually ships in 7-10 days"

 

Get it here

Edited by surfalot

Share this post


Link to post
Share on other sites

Hi Tod,

 

Do you have any idea how your contribution is different from Product Availability Options

http://www.oscommerce.com/community/contri...ch,availability


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
Hi Tod,

 

Do you have any idea how your contribution is different from Product Availability Options

http://www.oscommerce.com/community/contri...ch,availability

sorry sure don't. from the look of the last post description, the other isn't setup correctly to handle multipule languages. The description doesn't mension assigning a different message for each in-stock and to out-of-stock.

Share this post


Link to post
Share on other sites
sorry sure don't. from the look of the last post description, the other isn't setup correctly to handle multipule languages.

In my multi-language shop it is working, but I don't remember if I had to fix things or not.

The description doesn't mension assigning a different message for each in-stock and to out-of-stock.

Ah, yes, ofcourse, that makes yours unique and so much better, guess I'll have to compare and cross-upgrade to yours then ;)


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites

Hello i have the admin-part working. But get an message in the catalog part:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''4' at line 1

select count(*) as total from products p, products_description pd where p.products_status = '1' and p.products_id = '188' and pd.products_id = p.products_id and pd.language_id = '4

[TEP STOP]

 

I tried to change the language_id field in the DB but all without any result. Hope you can help me.

 

I already changed all the language_id records from 1 to 4 (dutch) in the data part of the availability table

Edited by Bacoman

Share this post


Link to post
Share on other sites
Hello i have the admin-part working. But get an message in the catalog part:

 

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

Share this post


Link to post
Share on other sites
the only place I can see that being used is at the top of product_info.php. This contribution doesn't change that line, so compare to an original product_info.php for the correct code there. this is the line in an unchanged shop:

 

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Thanks, now it works, i was forget to change one line.

Share this post


Link to post
Share on other sites

Hello,

 

I am trying to install the contribution - the one I was expected the most :-)))

 

So, I have also the http://www.oscommerce.com/community/contributions,2283 Wolfen products. And I note the only overlaping difference is in the catalog\admin\categories.php file.

 

From the contribution the lines are :

 

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

 

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$product = tep_db_fetch_array($product_query);

 

// BOF: Availability: Added: , availability_id_in_stock, availability_id_out_of_stock --and-- , '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, availability_id_in_stock, availability_id_out_of_stock, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

// EOF: Availability

 

$dup_products_id = tep_db_insert_id();

 

 

And my file is with the Wolfen contribution :

 

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

 

// BOF Wolfen featured sets

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, products_featured, products_featured_until, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$product = tep_db_fetch_array($product_query);

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_featured, products_featured_until, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_featured'] . "', '" . (int)$product['products_featured_until'] . "', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

 

$dup_products_id = tep_db_insert_id();

 

 

 

So I don't know how to do ? Should I keep those 2 contribution instruction side by side ? Should I remove wolfen for this file ? Or merge lines ?

 

thank you in advance for your support,

 

:rolleyes:

Share this post


Link to post
Share on other sites
Hello,

 

I am trying to install the contribution - the one I was expected the most :-)))

 

So, I have also the http://www.oscommerce.com/community/contributions,2283 Wolfen products. And I note the only overlaping difference is in the catalog\admin\categories.php file.

 

From the contribution the lines are :

 

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

 

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$product = tep_db_fetch_array($product_query);

 

// BOF: Availability: Added: , availability_id_in_stock, availability_id_out_of_stock --and-- , '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, availability_id_in_stock, availability_id_out_of_stock, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

// EOF: Availability

 

$dup_products_id = tep_db_insert_id();

And my file is with the Wolfen contribution :

 

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

 

// BOF Wolfen featured sets

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, products_featured, products_featured_until, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$product = tep_db_fetch_array($product_query);

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_featured, products_featured_until, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_featured'] . "', '" . (int)$product['products_featured_until'] . "', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

$dup_products_id = tep_db_insert_id();

So I don't know how to do ? Should I keep those 2 contribution instruction side by side ? Should I remove wolfen for this file ? Or merge lines ?

 

thank you in advance for your support,

 

:rolleyes:

always merge. I provided the specific changes in the BOC line for Availability:

 

// BOF: Availability: Added: , availability_id_in_stock, availability_id_out_of_stock --and-- , '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

 

it says you are adding:

, availability_id_in_stock, availability_id_out_of_stock

to the first half of the statement.

and:

, '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

to the second half of the statement.

 

my example chose the placement after the "products_quantity" as you can see. so place those segments after the products_quantity in the first half and second half of that SQL statement.

 

each "half" is divided by the "values" word. the order of the first half much match the order in the second half.

Edited by surfalot

Share this post


Link to post
Share on other sites
always merge. I provided the specific changes in the BOC line for Availability:

 

// BOF: Availability: Added: , availability_id_in_stock, availability_id_out_of_stock --and-- , '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

 

it says you are adding:

, availability_id_in_stock, availability_id_out_of_stock

to the first half of the statement.

and:

, '" . tep_db_input($product['availability_id_in_stock']) . "', '" . tep_db_input($product['availability_id_out_of_stock']) . "'

to the second half of the statement.

 

my example chose the placement after the "products_quantity" as you can see. so place those segments after the products_quantity in the first half and second half of that SQL statement.

 

each "half" is divided by the "values" word. the order of the first half much match the order in the second half.

 

Thank you a lot.

Share this post


Link to post
Share on other sites
Hi,

 

great contrib, thanks,

 

one question please, can i delete the after install and config the file availability_configurer.php ?

yes.

Share this post


Link to post
Share on other sites
yes.

 

 

Hello,

 

what may happen, when select :

 

Choose the setup option and click Run Configuration Utility to setup your database.

Please, please backup your database before performing this operation.

Normal Update

Force Configuration Defaults

Remove All

 

 

the contribution doesn't show up the langage choice in the admin menu. So it doesn't shows availability by langage.

 

i don't know how to fix that. Then i think that an database update could be a solution.

 

regards.

Share this post


Link to post
Share on other sites

Hello,

 

I don't see the langage choice, so the contribution doesn't work as option are not related to langage option.

 

Where should I have to look for ?

 

Thank you in advance for the support,

Share this post


Link to post
Share on other sites
Hello,

I don't see the langage choice, so the contribution doesn't work as option are not related to langage option.

Where should I have to look for ?

Thank you in advance for the support,

 

when you click "Insert New Option" you language choice should appear as such:

 

avail.jpg

Share this post


Link to post
Share on other sites
when you click "Insert New Option" you language choice should appear as such:

 

avail.jpg

 

Thank you for your reply,

 

please see the admin side :

availability.jpg

 

i don't have langage to choose on the right side of the screen. I guess I have a misfunction here.

 

Thank you in advance for your support,

 

Best Regards.

Share this post


Link to post
Share on other sites
Thank you for your reply,

please see the admin side :

i don't have langage to choose on the right side of the screen. I guess I have a misfunction here.

Thank you in advance for your support,

 

what I see in your image is that you have not clicked "Insert New Option" as directed.

Share this post


Link to post
Share on other sites
what I see in your image is that you have not clicked "Insert New Option" as directed.

 

Thank you, it works but I have still 2 difficulties :

 

- Flags for Langage are not shown

- The two colomns in the product edit page are on the top of the page, not below the product quantity field as explained in the install.txt.

 

Thank you again for this great contribution which is critical for our customers.

 

Best regards.

Share this post


Link to post
Share on other sites
Thank you, it works but I have still 2 difficulties :

 

- Flags for Langage are not shown

- The two colomns in the product edit page are on the top of the page, not below the product quantity field as explained in the install.txt.

 

Thank you again for this great contribution which is critical for our customers.

 

Best regards.

1) your DIR_WS_CATALOG_LANGUAGES in the admin/includes/confirgure.php is not set correctly. This contribution uses that constant to find the language flags.

2) I would suggest you recompare your changes to admin/categories.php. You have made a mistake in placing the code for the product edit page.

hope that helps

Share this post


Link to post
Share on other sites

Hi,

 

I have some comments to the contributions:

 

1. To do the code more universal you should replace in your queries name of the tabele (availability) to TABLE_AVAILABILITY.

Ofcourse this constant should be defined in database_tables.php (both in admin and catalog includes)

2. There is small bug in the availability_options.php around line 37

switch ($action) {
     case 'insert':
    if ($HTTP_POST_VARS['availability_id'] == 'new') {
	  $availability_query = tep_db_query("select max(availability_id) as avail_id from " . TABLE_AVAILABILITY . "");
	}
	$availability = tep_db_fetch_array($availability_query);

but it should be in that way:

switch ($action) {
     case 'insert':
    if ($HTTP_POST_VARS['availability_id'] == 'new') {
	  $availability_query = tep_db_query("select max(availability_id) as avail_id from " . TABLE_AVAILABILITY);
                         $availability = tep_db_fetch_array($availability_query);
	}

 

I think that my suggestions are right. Great contrib.

Share this post


Link to post
Share on other sites
Hi,

 

I have some comments to the contributions:

 

1. To do the code more universal you should replace in your queries name of the tabele (availability) to TABLE_AVAILABILITY.

Ofcourse this constant should be defined in database_tables.php (both in admin and catalog includes)

2. There is small bug in the availability_options.php around line 37

switch ($action) {
     case 'insert':
    if ($HTTP_POST_VARS['availability_id'] == 'new') {
	  $availability_query = tep_db_query("select max(availability_id) as avail_id from " . TABLE_AVAILABILITY . "");
	}
	$availability = tep_db_fetch_array($availability_query);

but it should be in that way:

switch ($action) {
     case 'insert':
    if ($HTTP_POST_VARS['availability_id'] == 'new') {
	  $availability_query = tep_db_query("select max(availability_id) as avail_id from " . TABLE_AVAILABILITY);
                         $availability = tep_db_fetch_array($availability_query);
	}

 

I think that my suggestions are right. Great contrib.

thanks for that input.

Share this post


Link to post
Share on other sites

Hi!

 

I have following problems with this contribution. It doesn't update both language. Language what i using admin area that's work great but other language just show blank in products info page. When i changed webshop language.

When i changed other language than english in admin area. Works great but english products shows then blank after Availability:

 

I hope somebody understand what i try explain here.

Share this post


Link to post
Share on other sites
Hi!

 

I have following problems with this contribution. It doesn't update both language. Language what i using admin area that's work great but other language just show blank in products info page. When i changed webshop language.

When i changed other language than english in admin area. Works great but english products shows then blank after Availability:

 

I hope somebody understand what i try explain here.

works fine for me. have you inserted the other languages in the admin? show me a screen-shot of your Availability admin screen with all your languages added and a link to a misfunctioning product.

Share this post


Link to post
Share on other sites

Hi,

 

thank you for this great contrib!

 

I have an error in the admin-tool: If I try to add a new languge to an existing availability-id I get the following error-message:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/database.php on line 100

Warning: Cannot modify header information - headers already sent by (output started at /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/database.php:100) in /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/general.php on line 20

 

Any idea where I have to search for the problem?

 

Regards

Nick

Share this post


Link to post
Share on other sites
Hi,

 

thank you for this great contrib!

 

I have an error in the admin-tool: If I try to add a new languge to an existing availability-id I get the following error-message:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/database.php on line 100

Warning: Cannot modify header information - headers already sent by (output started at /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/database.php:100) in /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/general.php on line 20

 

Any idea where I have to search for the problem?

 

Regards

Nick

 

/Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/database.php line 100 /Library/Apache2/htdocs/satnam/catalog/backstage/includes/functions/general.php on line 20

 

that error means you have inserted a space or something that is being outputed before the entire shop system is loaded. check those files/line numbers for that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×