Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

Your shop has a few flaws...

 

It shows that telephone number is not required but when trying to make an account you must input a telephone number at least 0 characters long... This must be an error... Try putting the value as "-1" (in case it uses a greater than function"

 

Can you please set up a product with 2 attibutes and try to set stock values? This is what 3.0 is supposed to do that 2.3 could not....

 

Thanks,

Steve

Link to comment
Share on other sites

man just found few more bugs :((

 

1) first i added womens jacket the one with out of stock sign - then i added mens jacket and in shopping cart it shows out of stock sign for both items. If the first item you add to your cart is out of stock then it shows all the items as out of stock in shopping cart.

 

2) in admin pannel when i click the stock tab and change the quantity to 0 i get this error

 

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 'where products_id=157' at line 1

 

update products set products_quantity= where products_id=157

 

[TEP STOP]

 

this only happens if i have only one option like

Size : One size Fits All

but if i have more then one option like

 

size : s , m , l

and i change the quantity for S as 0 it works fine.

 

 

thankx

Link to comment
Share on other sites

hello bubbasplitshot yes its working fine but i am still testing it to look for any erros, i do have few problems so if any one can please help me out with it.

 

i am getting this error when i try to add the product to my cart

this is the code around line 135

 ? ? ?$info_box_contents[$cur_row][] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="productListing-data" valign="top"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

? ? ?$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
? ? ? ? ? ? ? ? ? ? ? ' ?<tr>' .
? ? ? ? ? ? ? ? ? ? ? ' ? ?<td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
? ? ? ? ? ? ? ? ? ? ? ' ? ?<td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

? ? ?if (STOCK_CHECK == 'true') {
? ? ?if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
?$stock_check = tep_check_stock_new($products[$i]['id'], $products[$i]['attributes'], $products[$i]['quantity']); 
}else{	
? ? ? ?$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
}
? ? ? ?if (tep_not_null($stock_check)) {
? ? ? ? ?$any_out_of_stock = 1;

? ? ? ? ?$products_name .= $stock_check;
? ? ? ?}
? ? ?}

? ? ?if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
? ? ? ?reset($products[$i]['attributes']);
? ? ? ?while (list($option, $value) = each($products[$i]['attributes'])) {
? ? ? ? ?$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
? ? ? ?}
? ? ?}

 

and this is the code on line 135

but if i remove this code

$stock_check = tep_check_stock_new($products[$i]['id'], $products[$i]['attributes'], $products[$i]['quantity']); 

 

the whole QTP works fine without any errors. so can any one please tell me if this code is important or not or how can i fix this.

 

bubbasplitshot whats the problem with your code ? if you need any help let me know.

 

thanks

 

As it stands, my problem is that if I use more than one attribute (e.g., Size, Color), everything lists on the site as "Out of Stock". :'(

Link to comment
Share on other sites

hey steve just added the colors to mens jacket and sizes to womens jacket if this is what you are talking about then yes it worked.

in my earlier post can you please take a look at the error and let me know if you also get it.

 

 

sinryder, I don't see the two attributes (size, color) on the test site.

My site is showing "Out of Stock" for all items with 2 attributes.

Link to comment
Share on other sites

sinryder,

 

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 'where products_id=157' at line 1

 

update products set products_quantity= where products_id=157

 

This error is the sql statement is returning a NULL value for the sum when all items are set to 0. You can fix this by adding this line

 

  if (is_null($summa)) {$summa = 0; }

directly below this line

 $summa=$list[summa];

 

So your final code will look like this

    $list=tep_db_fetch_array($q);
   $summa=$list[summa];
   if (is_null($summa)) {$summa = 0; }
   tep_db_query("update products set products_quantity=$summa where products_id=$VARS[product_id]");

while (!succeed) {try()};

 

GMT -6:00

Link to comment
Share on other sites

Hi

Ive just been testing 2.3/3.0 with single and multiple attributes.

 

With single attributes i get correct 'out of stock messages' in product_info, but i am allowed to checkout these products if i do not explicitly set the stock value of the attribute to zero in the admin stock page. So this is not so good, but setting zero is a workaround that should probably be good practice to do.

 

With multiple attributes, i get 'out of stock' messages in product_info for all products even when all of the attribute combinations are set correctly with stock levels in admin stock. The database table of PRODUCT_STOCK is correct - i see the attribute pairs correctly - one pair for each attribute in a comma delimited list.

 

The appropriate bit (i think) of product_info.php code looks like this:

//START get attribute stock values
? ? ? ? $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'");
? ? ? ? $attributes_stock = tep_db_fetch_array($attribute_stock_query);
? ? ? ? $option_stock = $attributes_stock['products_stock_quantity'];
? //END get attribute stock values
if ($option_stock == 0) {
? ? ? ? ? $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']);
? ? ? ? } else {
? ? ? ? ? $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
? ? ? ? }

 

In theory the query is returning a zero value for qty - but my PHP is no good yet, so can someone look at this section of code and see if it really would get a zero when the sql entry is something like 1-26,2-35  (meaning attrib option 1 is 26 and attrib option 2 is 35.

 

Ive got a php book now so im gonna try to work it out, but if anyone gets time first please help..

I assume it would be simple task to modify product_info to not display the option at all (as some people have asked for) instead of marking the attribute out of stock. In theory that should look okay if you used it in conjunction with another change that displayed a out of stock message for the product as a whole.

 

Thanks for any help on this.

Hey all. been looking at the product_info.php page and I've worked out what the problem with multiple attributes is.

 

//START get attribute stock values
       $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'");
...

 

This code would evaluate to

 

SELECT products_stock_quantity FROM products_stock WHERE products_id = '28' AND products_stock_attributes = '1-3'

 

But because of the way multiple options are put into the table the values in the column products_stock_attributes look like this: '1-3,2-6'

 

So the select statement is never going to select anything. It'll return 0 results so you'll get an out of stock message.

 

I think the query should be something like this:

 

"SELECT products_stock_quantity FROM " . TABLE_PRODUCTS_STOCK . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes LIKE '%" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "%'"

 

But I have a feeling this would give false stock counts.

 

Anyone have any comment?

 

Tim

http://www.omenwebdesign.co.uk

Link to comment
Share on other sites

Hey all. been looking at the product_info.php page and I've worked out what the problem with multiple attributes is.

 

//START get attribute stock values
? ? ? ?$attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'");
...

 

This code would evaluate to

 

SELECT products_stock_quantity FROM products_stock WHERE products_id = '28' AND products_stock_attributes = '1-3'

 

But because of the way multiple options are put into the table the values in the column products_stock_attributes look like this: '1-3,2-6'

 

So the select statement is never going to select anything. It'll return 0 results so you'll get an out of stock message.

 

I think the query should be something like this:

 

"SELECT products_stock_quantity FROM " . TABLE_PRODUCTS_STOCK . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes LIKE '%" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "%'"

 

But I have a feeling this would give false stock counts.

 

Anyone have any comment?

 

Tim

http://www.omenwebdesign.co.uk

 

 

Tim, GREAT sluthing!

I tried your mod. Works better but what I'm seeing is that if any color is missing for a given size, the interface says the whole color is out of stock. For example, I sell socks in color red, sizes 9-11,10-13,13-15. If size 9-11 is set to 0, all red socks say Out of Stock.

 

I think I'm going to have to change my interface to list:

 

Red, Size 9-11

Red, Size 10-13

Red, Size 13-15

 

I want the decrimental counter feature and don't have a lot of faith in it working with multiple attributes.

 

:(

Link to comment
Share on other sites

But I have a feeling this would give false stock counts.

 

After a little more testing, it seems that it's going to be pretty hard to set multiple options up with multiple select boxes. If you use the hack that I provided above then the Stock output will be the stock quantity of the first option it comes to.

 

ie.

Say I have options colour and size, with 2 values in each option: 'Red' and 'Blue', and 'S' and 'L'.

 

I set the option quantities to be

Red S = 20

Red L = 40

Blue S = 30

Blue L = 10

 

If you have a different select box for each option, which quantity will the query return if you try and look up the quantity for 'S'? The first one is comes to, which may not be the correct value.

 

I think the only way would be to have one select box that lists the combined options.

 

what do you all think?

 

Tim

Link to comment
Share on other sites

I think I'm going to have to change my interface to list:

 

Red, Size 9-11

Red, Size 10-13

Red, Size 13-15

 

I want the decrimental counter feature and don't have a lot of faith in it working with multiple attributes.

 

:(

 

Hey Island man,

 

I reckon thats what I'm going to have to do as well. How are you going to do it? Change the actual options or rewrite the QTPro code?

 

Tim

Link to comment
Share on other sites

sinryder,

This error is the sql statement is returning a NULL value for the sum when all items are set to 0.  You can fix this by adding this line

 

 ?if (is_null($summa)) {$summa = 0; }

directly below this line

 $summa=$list[summa];

 

So your final code will look like this

 ? ?$list=tep_db_fetch_array($q);
? ?$summa=$list[summa];
? ?if (is_null($summa)) {$summa = 0; }
? ?tep_db_query("update products set products_quantity=$summa where products_id=$VARS[product_id]");

 

 

hey Thanks Tom it worked :)

Link to comment
Share on other sites

Hey Island man,

 

I reckon thats what I'm going to have to do as well. How are you going to do it? Change the actual options or rewrite the QTPro code?

 

Tim

 

 

It's a small new site. Would take me about an hour to reenter the items. :-"

Probably a lot longer, and a lot less assured to mess with this code.

Link to comment
Share on other sites

I have installed this contribution but I have this problem:

 

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 'and products_attributes.options_id=products_options.products_op

 

select products_name,products_options_name as _option,products_attributes.options_id as _option_id,products_options_values_name as _value,products_attributes.options_values_id as _value_id from products_description, products_attributes,products_options,products_options_values where products_attributes.products_id=products_description.products_id and products_attributes.products_id= and products_attributes.options_id=products_options.products_options_id and products_attributes.options_values_id=products_options_values.products_options_v

alues_id and products_description.language_id=3 and products_options_values.language_id=3 and products_options.special=0 and products_options.language_id=3 order by products_attributes.options_values_id

 

[TEP STOP]

 

 

Somebody can help me? Thanks

Link to comment
Share on other sites

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...