Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Specify product quantity for an attribute


Guest

Recommended Posts

Posted

I have a site that sells shoes. Each shoe has many sizes and each size has a different quantity in stock. I need to know if there is a modification out that does this already or at least a starting point to modifying oscommerce to accomodate this need.

Posted

It would be a very useful feature!

There have been attempts to do this - search on QTPro for more information (the author's site no longer exists so that probably tells you something).

I don't think anything works with recent versions of oscommerce. Linda's new SEC could be a starting point as it adds some useful attribute features and will allow you to use different shipping weights for the different sizes but will not keep track of the stock by attribute. Maybe you can get group of people together to have this developed. It seems to be a more major undertaking that you might expect and the codebase changes make it hard to maintain.

Posted

I know that this is linda's plan eventually to have stock by attributes obviously there are a lot of changes that have to be made to accomdate it be patient it will get there i know that linda will have this eventually in the mean time i would definately suggest using the sec contribution it rocks!

 

- kevin

Posted

qtpro 2.1 patch is a good start. I installed it on 2.2MS1 and it works but not perfect.

 

Bug fixed: Check for product attributes in Checkout_payment.php so that out of stock product attributes are not allowed to be checkout.

 

Plan fix: Update both the products_stock and product tables when items are checkout. ==> deduct the quantity in both tables.

 

Limit: qtpro currently only works accurately if out of stock checkout is disabled. If out of stock checkout is enabled, the overall product quantity is depleted and therefore other attributes quantities are not correctly represented.

 

View my sample site here: http://inbox.webhop.net

look for kung fu uniform and check out large quantity in any of the sizes and you will see that you will not be allowed to check out if it is out of stock.

 

I need to fix that stock are deducted from the products_stock table.

 

cheers

Posted

I see what you mean - no error message or out of stock message, just simply ignores the request to checkout (or is that just on my computer?)

Posted

I will be attempting the qtpro 2.1 patch relatively soon and will tell you what happens.

 

Thanks for the tip!

Posted

Paul

 

How did you get the attributes as a pull down instead of the radio buttons in QTPro?

 

I also have a problem with the attribute name not displaying if other standard attributes are assigned to the same product. Have you come across that?

 

Thanks

 

Del

Posted

afte installing the QTpro on My MS1 snaphot...it refuse to pass the checkout point ....i keep getting this error

 

"ERROR_NO_CONDITIONS" seen in a red bar atop the checkout_payment.php page

 

"i reach the checkout_confirmation.php ok, but when i click "the "CONFIRM ORDER" button it takes me back to the "Checkout_payment.php" page...and the cycle just continue

 

yourt help please

Posted

DEL

 

I have no problem with multiple attributes. I also installed the Attributes Manager to easily apply attributes to a product. But, it is still a pain to update stock quantity of multiple attributes product!!!

 

To get the pull down menu, dont use the product info that comes with qtpro. Just use the original MS1 product_info.php.

 

Any idea on how to easily update multiple attributes product. i am thinking using the excel contributions. Any idea? How about the Quick Product Update contributions. Has anyone tried on multiple attributes??

 

paul

Posted

Paul

 

Thanks for getting back - the only downside with using the existing product_info.php is that you don't get any stock control - it shows everything in the attribute array whether in or out of stock, whereas the radio button version checks stock before displaying.

 

Any idea on how to easily update multiple attributes product. i am thinking using the excel contributions. Any idea? How about the Quick Product Update contributions. Has anyone tried on multiple attributes??

 

Yes, I've just uploaded 900 products with 414 various attribute options and 14,000 existing users to a new OSC system on MySQL from a Cold Fusion based MSSQL system with different table layouts.

 

First off I used a piece of software called MySQL2Excel to dump the whole OSC database structure into an Excel Spreadsheet. It creates a different worksheet for each table and names the head of each column as the database row name.

 

I then filled the spreadsheet with the data from the old database adding attributes, stock levels, descriptions etc etc. I got the old database contents from Enterprise Manager.

 

Then I used a Excel2MySQL to reverse the process and create a full MySQL dump of all the tables/worksheets I had updated. Edited to the .sql file to remove any "drop" statements leaving only "inserts" and pushed the sql file back to the database via phpmyadmin.

 

It worked perfectly.

 

The conversion software is only $25 and well worth it!! You get it from http://www.convert-in.com

 

Let me know if you know how to do the stock control element in the old product_info.php

 

Cheers

 

Del

Posted

Del

 

Thanks for the great tips! At least, now i can sleep better instead of thinking how to update thousands of product attributes.

 

You are right, the pull down menu displays all product attributes regardless of stock status. However, customer will know when he or she adds item to the cart! :)

 

I think the qtpro radio results can be easily displayed into the pull down menu. There is a TEP function for pull down menu but i dont know how to use it yet.

Posted

Everton

 

I tried e-mailing you but your address is returning invalid.

 

Sorry but I dont' have time to install QTPro for you, I'm just too busy. I hardley have time to help these good chaps install it themselves!

 

If you need help or suggestions, feel free to e-mail me or post to this thread and I'll help where I can.

 

Paul S.

Nothing Unreal Exists

Posted

Well,

 

I installed qtpro and found that it added a lot of functionality, but did not update the quantity for a particular attribute. I think it may be a rather simple fix, but that defect and that the program does not display the attributes in a drop down menu when viewing a product are the only things that need improvement. Seems to be a good patch.

  • 2 weeks later...
Posted

Anyone made changes to checkout_confirmation to perform tep_check_stock_new and tep_check_stock?

 

If my product has stock controlled attributes then I can't enter a master product quantity any more in the admin side under edit product. I get a stock but to click instead which takes me toi the QT Pro stock screen.

 

So....I need to do te_check_stock_new in checkout_confirmation otherwise most things show up as out of stock.

 

Anyone done this yet?

 

Del

Posted

If anyone has a fix for this contribution I would really like to know how it was done.

I finally managed to get the admin stock section working by removing the attributes it listed and doing them under the regular attributes screen. The only difference is I have to go back into a product after I have entered it to update the stock.

And since I have been unable to checkout a product because of the ERROR_NO_CONDITIONS warning, I wouldn't know if it were updating stock levels or not. lol It does not matter if I have stock or if my settings allow for no stock purchases or not. (I actually need to allow for no stock purchases.)

Any help in this matter would be greatly appreciated.

 

Thanks,

Laurie

 

P.S. If anyone has managed to get the Order Processing Module V0.8 working, I'd like to hear about that as well. :)

Posted

Did you download the QTPro from http://www.msu.edu/~sloughwi/QTPro_2.1.zip

 

Sloughwi made QTPro work and he also uses it with order processing as do I. Try installing his patches first and see how you go from there.

 

I kinda have the order processing working but they want $50 for the full version now and I'm not sure how much better it will be.

 

Del

Posted

Del,

It is that version that I am working from now. There isn't much difference from the 2.0 version though. Maybe the snapshot I installed won't work with it. It is from 5-26 or so. It seems mostly the same....

At least with my version of QTPro, I can add products. :) The first thing I get with the 2.1 version is:

 

Fatal error: Call to undefined function: tep_get_uploaded_file() in /home/chameleo/public_html/admin/categories.php on line 582

 

That was also the same thing I got with 2.0. Hence my changes.

As far as the OP mod goes, I briefly considered purchasing their "working" version but after the previous non-working versions, (I have tried 2) I couldn't justify spending $50 for something that may not work....

So, I am back to still needing some help with the mods. :cry:

 

Thanks,

Laurie

Posted

Change the tep_get_uploaded_file references to new upload for example in categories.php...

 

if ($products_image = new upload('products_image', DIR_FS_CATALOG_IMAGES)) {

 

I also just remembered that Paul gave me a new products_attributes to use. email or PM me and I'll mail it over to you. You can always do a file compare on it and see if you think it will help.

 

Del

Posted

WORKS WITH 2.2CVS and MS1

I finally got qtpro to work perfectly. When SPECIAL is set to YES, stock check is done from the original stock table. This is needed if you dont track inventory based on the main product. Eg. memory upgrade and so on.

 

When SPECIAL is set to NO, stock check is done from PRODUCT_STOCK table.

 

Checkout_Shipping is also modded so that if you disallow out of stock checkout, it will redirect back to shopping cart even for attributes products.

 

PERFECT!!! well almost...

 

Check it out here: http://wire.homeip.net:8880/catalog/

Check out the Uniform and canon fx3 fax supplies.

 

Most important MOD:

// Check if the required stock is available

// If insufficent stock is available return an out of stock message

function tep_check_stock_new($products_id, $products_attibutes, $products_quantity)

{

if (preg_match("/^(d+)/",$products_id,$m)) $products_id=$m[1];

ksort($products_attibutes);

$arr1=array();

while(list($v1,$v2)=each($products_attibutes))

{

$arr1[]=$v1;

}

$arr1=implode(",",$arr1);

$q=tep_db_query("select products_options_id as id,special from products_options where products_options_id in ($arr1) and language_id='".(int)$languages_id."'");

while($rec=tep_db_fetch_array($q))

{

$special[$rec[id]]=$rec[special];

}

$attr=array();

reset($products_attibutes);

while(list($v1,$v2)=each($products_attibutes))

{

if (!$special[$v1]) $attr[]="$v1-$v2";

 

}

$attr=implode(",",$attr);

 

$q=tep_db_query("select products_stock_quantity as quantity from products_stock where products_id='". (int)$products_id . "' and products_stock_attributes='$attr'");

if (tep_db_num_rows($q))

{

$rec=tep_db_fetch_array($q);

$quantity=$rec[quantity];

}

else

{

$quantity = tep_get_products_stock($products_id);

}

$stock_left=$quantity-$products_quantity;

$out_of_stock = '';

if ($stock_left < 0) {

$out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';

}

return $out_of_stock;

}

////

Posted
DEL

 

I have no problem with multiple attributes. I also installed the Attributes Manager to easily apply attributes to a product. But, it is still a pain to update stock quantity of multiple attributes product!!!

 

To get the pull down menu, dont use the product info that comes with qtpro. Just use the original MS1 product_info.php.

 

Any idea on how to easily update multiple attributes product. i am thinking using the excel contributions. Any idea? How about the Quick Product Update contributions. Has anyone tried on multiple attributes??

 

paul

But i have some problems with this.

I have attributes for sell more than one.

My customer can selekt 1 or 2, or 5 pieces as attributes, but

in the request must the first one (1). The Price who displayed is for 1 and not for 5 pieces. What must i do to change the display of attributes. Is here a hack for them?

 

There is a example http://oberhexe.com/product_info.php/products_id/46

Posted

ibwo , I'm not sure what is going wrong here but it still ignores the checkout button on your site when the item is in stock. All the other buttons seem to work ok.

Posted

radders,

i checked my site and checkout button seems OK to me. Please check for me again.

 

Anyway, to all that interested in attributes stock tracking. Qtpro doesn't work with multiple attributes. For e.g. A shirt with color and size options. It cant match the product_stock_attributes during checkout_process. But it can check the stock. Funny.... here is what i did to the checkout process:

 

// Stock Update - Joao Correia

if (STOCK_LIMITED == 'true') {

$products_attributes = $order->products[$i]['attributes'];

if (DOWNLOAD_ENABLED == 'true') {

$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

FROM " . TABLE_PRODUCTS . " p

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

ON p.products_id=pa.products_id

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

ON pa.products_attributes_id=pad.products_attributes_id

WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

if (is_array($products_attributes)) {

$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

}

$stock_query = tep_db_query($stock_query_raw);

} else {

if (is_array($products_attributes)) {

$products_stock_attributes_array = array();

For($k=0, $n3=sizeof($products_attributes); $k<$n3; $k++){

if ($products_attributes[$k]['special'] == 0) {

$products_stock_attributes_array[] = $products_attributes[$k]['option_id']."-".$products_attributes[$k]['value_id'];

}

}

$products_stock_attributes=implode(",",$products_stock_attributes_array);

$attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

if (tep_db_num_rows($attributes_stock_query) > 0) {

$attributes_stock_values = tep_db_fetch_array($attributes_stock_query);

$attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];

if ($attributes_stock_left < 1) {

tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '0' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

$actual_stock_bought = $attributes_stock_values['products_stock_quantity'];

}else{

tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

$actual_stock_bought = $order->products[$i]['qty'];

}

}else{

$actual_stock_bought = $order->products[$i]['qty'];

}

}else{

$actual_stock_bought = $order->products[$i]['qty'];

}

$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

if (tep_db_num_rows($stock_query) > 0) {

$stock_values = tep_db_fetch_array($stock_query);

// do not decrement quantities if products_attributes_filename exists

if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

$stock_left = $stock_values['products_quantity'] - $actual_stock_bought;

} else {

$stock_left = $stock_values['products_quantity'];

}

tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

}

 

I didnt want to set the product status to 0 when out of stock even though i dont allow out of stock checkout cos i want my customer to see what i sell. So, i remove the set status part .....

 

Request help from expert programmer, how do i query multiple attributes so that it can match and deduct stock from products_stock table? The above only works for a single attribute product.

 

thanks in advance

Posted

I finally got this contrib to update the stock, using the code ibwo posted, but now I have a new problem. If all the items attributes are in stock, it works perfectly, but once one attribute is sold out the product is reset to out of stock, even though other attributes still have stock. If you then go into admin & reset it to green the stock levels are listed correctly, but it wont let you checkout with that product, the checkout just loops back to the basket.

See what I mean here. This product has one attribute out of stock.

 

HELP!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...