Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

Sorry, for some reason the BBS would not let me edit my own post, so here it goes again a little more calmly explained.

 

I guess my only problem as far as I can tell is the whole update thing. The problem also is that freezehell's version was not commented as far as where the changes he ammended are, so I may have not moved all the code from the QTpro categories.php to the online categories.php one, which unfortunately I had to do manually...

 

Do you suppose that the problem is in the categories.php page?....I thought so, but the code for the Update form is in the stock.php page...I get the feeling that somehow when I submit the form, even though it shows up, the quantity VAR is not getting through...

 

Oh, I AM RUNNING teh Register_globals = off version that is floating around..so I do not have register_globals, if that matters or counts

 

man o man

Edited by canary100
Link to comment
Share on other sites

Oh, I AM RUNNING teh Register_globals = off version that is floating around..so I do not have register_globals, if that matters or counts

 

That's the problem alright. I was just writing a post to that effect when your above comment showed up. I wouldn't be surprised if all kinds of problems pop up with other contributions as well if you are running with register_globals off. To fix stock.php add $action=$VARS['action'] right up top after the $product_id assignment you already added. No guarantees on any of the code elsewhere in this contribution though.

 

What register_globals on does is automatically turns everything on the query string or in the form post into PHP variables. e.g stock.php?action=Update&product_id=1&quantity=50 automatically sets PHP variables $action='Update', $product_id=1 and $quantity=50. Not a good thing security-wise if you are lazy about initializing variables. So if you are trying to track down a problem with a contribution with register_globals off, take a look at your query string and search the code for the parameter names to see if your find them with just a $ in front of them instead of $HTTP_GET_VARS[...] For pages that use post instead of get you'll need to do a little sleuthing to figure out what the post variables are. A good browser add in that shows them is nice for this - I use Firefox with the Web Developer extension. You can also track them down by displaying the source in your browser of the page that does the posting and looking at the HTML for the form. Once you find them, fix the code to use $HTTP_GET_VARS[...] or set $... at the top of the code. This doesn't completely address the security issue - especially setting $... at the top of the code but thats a topic for another forum.

Link to comment
Share on other sites

I guess my only problem as far as I can tell is the whole update thing. The problem also is that freezehell's version was not commented as far as where the changes he ammended are, so I may have not moved all the code from the QTpro categories.php to the online categories.php one, which unfortunately I had to do manually...

 

Yeah, he didn't do much in the way of comments. Use a compare program. A lot of people on the forums recommend Beyond Compare. It looks great but it does cost money. I use the open source kdiff3 and have been pretty happy with it. You give it the base osCommerce code, your current modified version (say with 3 or 4 contributions already applied) and a new contribution version you want to apply. It shows you side by side the mods from the 2 modified versions and you choose what to add to the output version. Its nice even for commented contributions. You can get it at

 

kdiff3.sourceforge.net

 

Also, it looked you you were using version 2.3 or earlier of QTPro from a bug in that small fragment of code (= instead of ==) I fixed in the version 3.1 version I posted. The bug doesn't cause any problems unless you switch to post instead of get for the form, but if you plan on setting up products with more than one option (like color & size) you really need to use the 3.1 version.

Link to comment
Share on other sites

Ralphday:

 

Thanks so much man. Yes, I did figure out fater my post yesterday that the whole register globals was probably what was happening after running a bunch of tests. I am so gald you post it a solution, as on my own I would have take me days to figure that one out.

 

Now, here is an enverosing admission. Ready?

 

I have been doing PHP projects for about two years, complex ones too. NEVER had it ever ocurred to me that MAYBE there ws a program that would compare code for me, so every mod I ever done to a PHP script was...yes.....visually...looking at the code, copying, pasting, etc. Now, here comes the worst/funniest part; I use BBedit...and never once I thought to look if see if BBedit had a function like that..AND IT DOES. So, while figuring out the whole QTPro thing was creat, realizing I was doing things the VERY HARD way...and I don not have to anymore is freaking priceless.

 

A by the way, I am using the QTPro version 3.1....

 

Thanks so much again.

Link to comment
Share on other sites

hello guys my qtp is not deducting the quantity of the products

like for

red shirt

small 5

medium 4

large 6

 

if a customers buyes 1 small shirt , the quantity stays the same for Small

 

can any one please tell me if they had the similar problem and how they fixed it.

 

thankx

Link to comment
Share on other sites

hello guys my qtp is not deducting the quantity of the products

like for

red shirt

small 5

medium 4

large 6

 

if a customers buyes 1 small shirt , the quantity stays the same for Small

 

can any one please tell me if they had the similar problem and how they fixed it.

 

thankx

Stock will not be subtracted if download is enabled or limit stock is disabled. If both of these are set correctly check that the changes to checkout_process.php were properly applied.

Link to comment
Share on other sites

hey , thankx for replying. The download is set to False , and check stock level is set to true.

If a customers uses moneyorder/check as their payment method then the quantity gets subtracted but if they use paypal then it stays the same.

Sounds like a common problem over on the Payment Modules forum even without this contribution. A problem with the Paypal module is stopping execution of checkout_process.php before it gets to the stock decrement. You'll need to look on that forum for help. I saw lots of suggestions to use the Paypal IPN contribution instead of the stock Paypal module as well. Supossedly that contribution forum is pretty active and can get you up and running with Paypal.

Link to comment
Share on other sites

at the top  of the low stock report I get this...

HEADING_TITLE Thursday 08 July, 2004 

TABLE_HEADING_PRODUCTS TABLE_HEADING_QUANTITY TABLE_HEADING_PRICE ?

 

What am I missing?

 

Well, his bump comes about six months too late. Anyway. I run into this very same problem , but I do not see anyone ever answered mijman. In my case I tried to track it down, but I am officially lost. I even looked at other files with similar type of headers. and the particular piece of code is pretty standard code all throughout osc. I have the register_globals = off contribution, but I do not think it affects this as there are no forms or POST/GET Vars.

 

So somehow the definitions are not making it through, or ..Am I missing a language file somewhere?..I tripled checked all the files that came with QTpro 3.1, looked at the structure of other similar files....nothing.

 

I guess I can hard code it, but it bugs me that I can get it to work just right.

 

Any guidance would be great

 

Thanks

Link to comment
Share on other sites

So somehow the definitions are not making it through, or ..Am I missing a language file somewhere?..I tripled checked all the files that came with  QTpro 3.1, looked at the structure of other similar files....nothing.

 

I guess I can hard code it, but it bugs me that I can get it to work just right.

 

Any guidance would be great

 

Thanks

 

It looks to me like the low stock attribute report is a bit of a mess.

 

As for mijman and your specific problem, stats_low_stock_attrib.php is missing a requires statement for a language file that is also missing. If you don't want to hard code the titles you'll need to make a language file (admin/includes/language/english/stats_low_stock_attrib.php) and add a requires statement in stats_low_stock_attrib.php to include the language file just below the requires for application_top.php.

 

At a quick glance I see a few other problems with the report:

 

Doesn't appear to check against the low stock threshold it just dumps everything.

 

It replicates all of the attribute combinations underneath each option.

 

It replicates products multiple times, once for each language

 

It probably sorts multiple attributes goofy

 

It doesn't ignore "special" attributes

 

 

If you only have one language setup and are only using a single attribute per product it looks like it may work OK except for the titles and dumping everything. I'll see if I can clean this report up when I get a chance.

Link to comment
Share on other sites

hello all , any one got qtp work with paypal ipn . the only problem i am having is , its not subtracting the quantity if a customers uses paypal as their payment method.

i am trying to add the qtp checkout_process.php code in paypal ipn checkout_process.php file , both files are totaly different and i am not sure where to add the qtp code.

Can any one please help me out or if they can send me this file below

/public_html/catalog/includes/modules/payment/paypal/checkout_process.php

 

thankx

Edited by sinryder
Link to comment
Share on other sites

hello all , any one got qtp work with paypal ipn . the only problem i am having is , its not subtracting the quantity if a customers uses paypal as their payment method.

i am trying to add the qtp checkout_process.php code in paypal ipn checkout_process.php file , both files are totaly different and i am not sure where to add the qtp code.

Can any one please help me out or if they can send me this file below

/public_html/catalog/includes/modules/payment/paypal/checkout_process.php

 

thankx

In the PayPal_Shopping_Cart_IPN contribution the code for checkout_process.php has been split up. The part of it that is modified by QT Pro is in catalog\includes\modules\payment\paypal\classes\osC\Order.class.php

Link to comment
Share on other sites

hey i dont have this file in my papal ipn contribution

this is what i have catalog\includes\modules\payment\paypal\

 

dont have classes\osc

 

:(

Which contribution are you using? A link to the download page would help. There are a couple of flavors of Paypal IPN I've seen out there and I can't find one with catalog/includes/modules/payment/paypal/checkout_process.php in it

Link to comment
Share on other sites

It looks to me like the low stock attribute report is a bit of a mess.

 

As for mijman and your specific problem, stats_low_stock_attrib.php is missing a requires statement for a language file that is also missing.  If you don't want  to hard code the titles you'll need to make a language file (admin/includes/language/english/stats_low_stock_attrib.php) and add a requires statement in stats_low_stock_attrib.php to include the language file just below the requires for application_top.php.

 

At a quick glance I see a few other problems with the report:

 

Doesn't appear to check against the low stock threshold it just dumps everything.

 

It replicates all of the attribute combinations underneath each option.

 

It replicates products multiple times, once for each language

 

It probably sorts multiple attributes goofy

 

It doesn't ignore "special" attributes

If you only have one language setup and are only using a single attribute per product it looks like it may work OK except for the titles and dumping everything.  I'll see if I can clean this report up when I get a chance.

 

Dude, thanks a bunch. You truly rock.

 

Which makes me wonder the following:

 

Ralphday, do you, or anyone like you, do PHP mods for a fee? (osc or any other PHP projects)..Honestly, while this whole forum things works out, I see two set backs. For one thing I feel awfully bad that one person has to answer all this replies and gets nothing in return. I really do. Heroic in my opinion. Also, I find somewhat counter-productive to ..place and answer...wait..get an answer..modify it from this end. Wouldn't it be better to say...Hey ralph....fix this..modify that...send me teh final file and an invoice?....

 

If you, or anyone like, is interested, i have a handful of ongoing PHP projects for clients I would not mind outsourcing some of the harder PHP mods to another person, pass on the "savings" (sarcasm) to the client on the final bill.

 

Just wondering

Link to comment
Share on other sites

hey ralph , it was paypal ipn v2.3 , but i dont see it in contribution section any more.

Do you have catalog/includes/modules/payment/paypal/catalog/checkout_update.php? From some change notes for Paypal IPN it looks like that might be where you need to apply the QT Pro changes. If not, search the files for products_quantity to try to track down where the stock reduction is.

Link to comment
Share on other sites

do you, or anyone like you, do PHP mods for a fee? (osc or any other PHP projects)..

They are out there if you look around. The forum rules don't allow commercial advertising so you'll need to follow web site links in sig lines from postings on the forums or do some googling to find them.

 

Personally, I'm not interested. My wife is going to open a store that needs this contribution and I'm working to get it beefed up to where she'll be happy with it and she won't have problems. And my day job won't allow me to take on the outside work. So I'm happy to answer questions as I have time - it helps me find the bugs in the code as I'm enhancing it.

Link to comment
Share on other sites

Ralphday:

I have been doing PHP projects for about two years, complex ones too. NEVER had it ever ocurred to me that MAYBE there ws a program that would compare code for me, so every mod I ever done to a PHP script was...yes.....visually...looking at the code, copying, pasting, etc.s doing things the VERY HARD way........

 

This is exceptionally good advice for newbies.

 

Seek out Kdiff3 for a good time. http://kdiff3.sourceforge.net/

 

gags

Link to comment
Share on other sites

I just downloaded the 3.1 version of this Contribution to install on a store. I was disappointed when there were only install instructions for virgin osCommerce stores. Does anyone have step by step changes for the install of this Contribution? The PHP files included in the download were not even commented properly so you could tell where to make changes in the files. I have been going through and just trying to compare the fiels side by side, but as we all know this can easily lead to mistakes. I would hate for others to have to go through this. Thanks...

 

-Aaron

Link to comment
Share on other sites

I just downloaded the 3.1 version of this Contribution to install on a store. I was disappointed when there were only install instructions for virgin osCommerce stores. Does anyone have step by step changes for the install of this Contribution? The PHP files included in the download were not even commented properly so you could tell where to make changes in the files. I have been going through and just trying to compare the fiels side by side, but as we all know this can easily lead to mistakes. I would hate for others to have to go through this. Thanks...

 

-Aaron

Try the Quick Install Files for QT Pro 3.1. It has find/replace instructions thanks to Philip Hennessey. As someone else just posted, take a look at KDiff3. I find it the only way to go for messy installs where a module has multiple modifications applied to it.

Link to comment
Share on other sites

I am using paypalipn 2.6a i believe...

Take out the part where it subtracts stock in the catalog/includes/modules/payment/paypal/catalog/checkout_update.inc

 

Then in the catalog/includes/modules/payment/paypal/catalog/checkout_proccess.inc.php

Change line 119 (and delete the lines below it until the

"//------insert customer choosen option to order-------"

to the following...

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// 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'];
                 } 
             } 
             asort($products_stock_attributes_array);
             reset($products_stock_attributes_array);
             $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']) . "'");
         if (($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false')) {
             tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
         } 
     } 
 } 

 $sql_data_array = array('orders_id' => (int)$this->orders_id,
                         'products_id' => tep_get_prid($order->products[$i]['id']),
                         'products_model' => $order->products[$i]['model'],
                         'products_name' => $order->products[$i]['name'],
                         'products_price' => $order->products[$i]['price'],
                         'final_price' => $order->products[$i]['final_price'],
                         'products_tax' => $order->products[$i]['tax'],
                         'products_quantity' => $order->products[$i]['qty']);

 tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

 $order_products_id = tep_db_insert_id();

Link to comment
Share on other sites

hello , Thankx for helping me out.

i have tried what you guys said and its still not working. It subtracts the quantity from total but not from the size.

like if a customer buys red tshirt in Small size , and in total i have 10 shirts

5 small and 5 large.

it shows total quantity left 9 . but when i click the stock button it shows

Small 5

Large 5

 

can you please click on the links below to review my code and let me know whats wrong

 

 

/includes/modules/payment/paypal/catalog/checkout_process.php

 

/includes/modules/payment/paypal/catalog/checkout_update.php

 

thankx

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