Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Scotty:

 

What you describe is not what happens on my site. The top of my installation.html files reads:

QTPRO 2.1 Update for osCommerce 2.2 MS2 ONLY

**** BY IBWO ***** 08/12/2003

 

I add products using only the stock page. I have many products with multiple options as you described. When a customer checks out, the correct quantity from that specific attribute is decremented and then the product total on the product page reflects this. If I only have 2 of a given attribute. Only 2 products with that attribute can be purchased.

 

How do you have stock configured in the admin? I have the following:

 

Check stock level - true

Subtract stock - true

Allow Checkout - false

 

If you have the above configured the same as I do, then something is not correct with how qtpro is installed. Your store should not be allowing customers to check out when stock is not available for a given attribute. I am 100% certain that my store behaves correctly as I would be in big trouble if it did not :o


-MichaelC

Share this post


Link to post
Share on other sites
Scotty:

 

What you describe is not what happens on my site.  The top of my installation.html files reads:

QTPRO 2.1 Update for osCommerce 2.2 MS2 ONLY

**** BY IBWO ***** 08/12/2003

 

Check stock level - true

Subtract stock - true

Allow Checkout - false

 

I have the exact same information and setup as you've mentioned here. But as freezehell points out, I think there are some bugs associated with this attribute.

 

Thank you and I'll be watching this thread for update info. Meanwhile, if anyone else suffers from the same situation or has a solution for this problem, it will be great to share them with us.

Cheers,

 

Scotty

Share this post


Link to post
Share on other sites

Firstly - thanks to all who have contributed to this feature - its awesome and should be a standard feature of MS3 - I've been waiting for a functional MS2 version for a while !!

 

I had the problems discussed above except that it was totally sporadic - when logged in with the cart it showed out of stock and then didn't - then allowed checkout, then didn't - ditto when not logged in - showed O.O.S. then didn't -weeiiiiirdd !!!

 

I've been reviewing the code for two days now and (crossing himself for fear of hexing the fix!) I have narrowed it down to the issue of minimum quantity for Zero attributes <=> 0 being recognised in the cart and tep_stock_check_new in general.php requesting out of stock response on multiple attribute items for less thanzero.

 

I have tested the following hack twenty-twelve ways from Sunday and as far as i can see it deducts stock by attribute stock level correctly, shows out of stock when individual attribute product level is at zero, and will adapt when you increment the stock level in the cart (ie order more than the one final product left) and stops checkout process etc etc as its supposed to.

 

I have a heavily modded SEC2.2 www.webmakers.com (thanks a mill Ajeh !!) with many, many additional attribute classes and functions and it works for all of them, regardless.

 

I have not touched any other area of this contrib other than below, to fix it for me !

 

Deprecate the code as shown and Enter the following hack in general.php until Freezehell gets a chance to fix it proper-like !

 

If it works for you then great - If its a seriously bad code hack then please post here and call me a numpty !

 

Changes in Red Green & Blue below (Coz I'm a colorful type of guy !).

 

// BOF: QTPro 2.1 - Amended for attributes inventory - JEB

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

{

global $languages_id;

$products_id = tep_get_prid($products_id);

$arr1=array();

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

asort($products_attibutes);

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

{

$arr1[]=$v1;

}

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

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

while($rec=tep_db_fetch_array($q))

{

$special[$rec[products_options_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 " . TABLE_PRODUCTS_STOCK . " where products_id='". (int)$products_id . "' and products_stock_attributes='$attr'");

 

// Old deprecated code - BOF: JEB hack for query to fix out of QTY in cart - if (tep_db_num_rows($q)>0)

 

// New code establishing less than and equal to parameter for multiple attributes for out of stock calc in cart -

 

if (tep_db_num_rows($q)>=0)

 

// Eof Hack for cart out of stock fix - JEB

 

 

{

$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;

}

// EOF: QTPro 2.1 - Amended for attributes inventory - JEB

 

 

Hope this works for everyone !

 

Really Great Contrib !

 

Good Luck !!

 

 

 

 

 

Jeremy

Share this post


Link to post
Share on other sites

Oh yes - and this hack also returns a "0" value for all attributes that are out of stock, in the admin - categories/products - product "Stock" screen.

 

Whereas before the items just did not appear in the list, of individual attributes in or out of stock !

 

 

 

 

JB

 

 

PS. Anybody watched "Young Adam" with Ewan Macgreggor yet ?? - whassallthataboutthen - a bit deep methinks !!!

 

Ah well, off to take the medication !

Edited by jbretel

Share this post


Link to post
Share on other sites

Hey Jeremy,

Thanks for the detailed reply. However, I could not clearly understand a portion of your posting which says:

 

"Enter the following hack in general.php"

 

I have 2 general.php files located at the following locations:

 

/catalog/admin/includes/functions/

 

/catalog/includes/functions/

 

Since my site is live and has high traffic, I can not afford to have a downtime for long. Would you mind letting me know if I should insert the code in both general.php files or only in one (which one?).

 

Also, does it matter where in the file body the code is inserted?

 

Thanks pal for both the e-mail and the posting.

Keep up the good work.

 

Scotty

Share this post


Link to post
Share on other sites

The mod is in the catalog/includes/functions/general.php

 

 

Remember - deprecate old code rather than deleting it.

 

And comment contributions and changes all the way !

 

I hope this works for you !

 

 

 

JB

 

PS - get a copy of Beyond Compare from www.scootersoftware.com - its not free but its the best $30 you'll spend this year (compares contribution files to your shop files so you can see all changes to code !) - they have a 30 day trial for free so give it a whirl - I've no affiliation to the product or group but it makes life a whole lot simpler !

Share this post


Link to post
Share on other sites

HI, I have installed QTPRO on a Virgin Oscommerce MS2.2.

 

Now I have also installed easypopulate, and it seems okay..

 

But can I enter QTPRO details via easypopulate from excel? please let me know..

 

I am trying to run a Clothing Store and i want to be able to do the following :

For example

 

ITEM NO. ABC

 

[DROP DOWN LIST-1]

SIZE :M, X, XL XXL

 

[DROP DOWN LIST-2]

COLOR : BLUE, RED, GREEN, YELLOW

 

But for example SIZE XL may not be available RED or SIZE M may not be available in M.. so it should not display in the drop down list.. I.E the user has to select The Size first and then the corresponding Colors which are available will be displayed... I was hoping QTPRO can do this... Or is it better to use master products...

 

 

And I want to input all of this using Easy Populate instead of doing it manually, I have the data, over 600 records worth, so I cannot sit there and do this by hand.

 

If you visit nordstoms.com website and select a pc of clothing you will see how it is suppsoe to be done..

 

Looking for some help.

Tks

Ricky

Share this post


Link to post
Share on other sites

Hi,

 

great job everyone...

 

Jeremy...

I added your script, and now whenever I add something to my cart, in or out of stock in the attributes it marks it as out of stock!

 

-Can you please figure out whats wrong... I am clueless when it comes to php or whatever the heck it is

 

Also,

the return of a "0" instead of deleting the product/attribute from being displayed from the product stock page, doesn't work....

 

Hope it will though I really need it to!

Edited by mijman2

Share this post


Link to post
Share on other sites

Hmm - works well on my store but I do have heaps of mods and contributions !

 

You must have deprecated the previous code

 

if (tep_db_num_rows($q)>0)

 

by putting two forward slashes in front of it like this : -

 

// if (tep_db_num_rows($q)>0)

 

and replace it with this

 

if (tep_db_num_rows($q)>=0)

 

alternatively just add the = to the formula like this

 

if (tep_db_num_rows($q)>=0)

 

If this fails I'm not sure what your store is doing that is different to mine.

 

Does anyone else encounter problems like steve's after this mod ?

 

Regards

 

 

 

 

JB

Share this post


Link to post
Share on other sites

hellfreeze,

could you try to get an update out that fixes the bugs in this version?

 

These are what I have run into... Items dissapear from the stock part of your cart when they have 0 as the item number set...

When there are multiple attributes, after you add an item to cart, it wont display Out of stock if it is really out of stock...

 

And JB...

What other attributes do you have installed?

My cart still doesnt work...

Share this post


Link to post
Share on other sites
thERE IS ACONTRIBUTION low stock report v1.1extra

WHICH PRODUCES THIS REPORT

I have downloaded and installed the Stock Report mod but it does not handle stock reports for attributes attached to a product.

 

Is there a contribution, or some hidden files from QTPro that allows us to generate a stock report based on the attributes of a product - eg...

 

01.? ?'Amatrice' Custom Tee -- 0

----> Small: 0

----> Medium: 0

----> Large: 0

----> Extra Large: 0

 

?02.? ?'Carrera' Shorts -- 0

----> Small: 0

----> Medium: 0

----> Large: 0

----> Extra Large: 0

 

That kind of thing. I'm not looking for a way to change the stock levels from within the stock report - but like the current v1.1 stock report does, is simply link to the product - all I want to do is be able to list the product stock details for each attribute as associated with QTPro. It MUST be do-able, because that's how it works out stock anyway - am I right?

 

Hmmm, maybe something to look into.

 

Anyone know of anything or have any modded code?

 

Thanks all.

 

Craig

 

:)

Share this post


Link to post
Share on other sites

Hi,

 

I entered some products stock through attributes... Then delted all of the attributes and renamed them to make them easier to browse... The old stock is still up, and i want to take them down, but I cant enter a quanity of 0 because the attributes titles are different how do i delete them?

Share this post


Link to post
Share on other sites

bump...

 

Please help... How do I delete attributes stock with out using the online attributes stock manager

Share this post


Link to post
Share on other sites

Re-execute this part of stock.sql

 

 

 

drop table if exists products_stock;
create table products_stock (
 products_stock_id int(11) not null auto_increment,
 products_id int(11) default '0' not null ,
 products_stock_attributes varchar(255) ,
 products_stock_quantity int(11) default '0' not null ,
 PRIMARY KEY (products_stock_id, products_id),
 KEY idx_products_stock_attributes (products_stock_attributes)
);


while (!succeed) {try()};

 

GMT -6:00

Share this post


Link to post
Share on other sites

Thanks for all your help everyone...

Its all worked out, and every thing works great !

 

(i think) :D

Share this post


Link to post
Share on other sites

So,

I got it all working, but now it wont subtract stock from each attribute that is bought...

 

What do i do to have it auto subtract stock?-I have the option checked...

Share this post


Link to post
Share on other sites

is there a solution that automatically subtracts stock that I dont know about? I have the one in configuration all checked in the correct fasion...

Share this post


Link to post
Share on other sites

Steve,

 

I do not know why your contribution is not deducting the stock,

 

Mine is working fine after the one small modification I mentioned previously.

 

Download the latest contribution - go to www.scootersoftware.com and download the free trial of the "Beyond Compare - software comparison tool" - you will end up buying it - it's invaluable.

 

Compare the downloaded files to your files and amend any anomolies.

 

After that there should be no rational reason why stock is not being automatically calculated !

 

Best of luck !

 

 

 

 

JB

Share this post


Link to post
Share on other sites

I've done all that, and I still don't think it works right...

 

Is there a specific line that subtracts the stock quantitiy?

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

×