Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

I have just installed this contibution and I now have my home page saying:-

 

Fatal error: Class messagestack: Cannot inherit from undefined class tableboxmessagestack in /home/killerh/public_html/includes/classes/message_stack.php on line 20

 

and my admin page saying:-

 

 

Fatal error: Call to undefined function: tep_admin_check_login() in /home/killerh/public_html/admin/includes/application_top.php on line 215

 

 

Devastated as I installed it straight to the live shop AND the backup :-(

 

Anyone any ideas or have I mow lost the lot......

Share this post


Link to post
Share on other sites
Is the stock for the attributes getting reduced or just the product?

 

If its just the product the changes in checkout_process or application_top might not be correct.

 

If the attribute stock is reduced but by the wrong quantity its possible the field name for quantity is wrong in the html - perhaps something got tweaked when applying one of the other contributions.

 

 

It looks like a lot of ppl more experienced than me are getting problems, so i think being a complete newbie here i think i will create more problems rather than solve small problems. I have decided that i will have separate products listing for all my products..., <_< that will be easier. Until i can get more experienced anyway...lol

 

azanaz

Share this post


Link to post
Share on other sites
I have just installed this contibution and I now have my home page saying:-

 

Fatal error: Class messagestack: Cannot inherit from undefined class tableboxmessagestack in /home/killerh/public_html/includes/classes/message_stack.php on line 20

 

and my admin page saying:-

Fatal error: Call to undefined function: tep_admin_check_login() in /home/killerh/public_html/admin/includes/application_top.php on line 215

Devastated as I installed it straight to the live shop AND the backup :-(

 

Anyone any ideas or have I mow lost the lot......

 

Go through your code with a program like beyond compare to find your mistakes. The contribution works as advertised.

Share this post


Link to post
Share on other sites
Go through your code with a program like beyond compare to find your mistakes.  The contribution works as advertised.

 

Hi - I have installed in three times now - stll get the same error - but....... I am installing it on a clean fresh copy of CRE? Does this make a difference? :(

 

Am a complete non techy - sorry - what is beyond compare - have only been using OSC for a few days - never used anything like it before, so am totally stumped :-(

Share this post


Link to post
Share on other sites

I saw in a google search that someone pointed out that the contribution would only work on a clean MS2.2. version of osc. These posts were from the folks at CRE - a loaded site.

 

Sorry but you'll probably need to go there to sort out the install on a cre modified version.

 

HTH

Tom

Share this post


Link to post
Share on other sites
I saw in a google search that someone pointed out that the contribution would only work on a clean MS2.2. version of osc. These posts were from the folks at CRE - a loaded site.

 

Sorry but you'll probably need to go there to sort out the install on a cre modified version.

 

HTH

Tom

OceanRanch is absolutely right. QT Pro, like most contributions, can only safely be installed by a direct copy of the files over an unmodified version of osCommerce it was built for - in this case 2.2 MS2. CRE Loaded has so many contributions merged into it there is no telling what a direct copy of QT Pro will break.

 

If your pre-QT Pro site was an unmodified CRE Loaded this procedure might work to restore it:

 

- Backup what you have now!! Even though its not working you need a known point to work from and go back to if things go even worse. Plus you'll need some files from your existing site later in this process.

 

- Ungzip and untar the CRE Loaded distribution into a temporary directory

 

- Copy the CRE Loaded files from the catalog directory to your site directory

 

- Copy catalog/includes/configure.php and catalog/admin/includes/configure.php from the backup you made in the first step back to your site directory.

 

- Pray a lot and see if it works.

Share this post


Link to post
Share on other sites
I am having trouble installing this contribution - please help. To quote from the install instructions manual included in the download,? in the part that reads: Appendix: Creating a Product Attribute Display Plugin:Change the require_once line and the extends part of the class definition to refer to the class you have chosen to extend

My question: in which file is this change to be implemented?

 

The change is implemented in the new class file for the plugin you are developing, not in any file that comes as part of QT Pro or osCommerce.

 

 

To be truthful, I never understood that whole part of ceating my own class. Most contributions are simple drag/drop, changes to existing files etc but not creating new classes I don't know what to do here!!!! Let me go thru the instructions from the manual one by one.

 

1.Choose the plugin that is closest to your desired functionality to extend.

Ok I want to have multiple dropdowns so...

2.Copy the plugin file you want to extend to a new name in catalog/includes/classes.

I copy pad_multiple_dropdowns.php to my catalog/includes/classes directory. I'm not changing the name.

3.Change the require_once line and the extends part of the class definition to refer to the class you have chosen to extend.

???? Please help me with this or post an example of something you have done.

4.Update the class name to match the file name of your new plugin.

Since I have no clue on number 3 above, I don't know where to update the class name in this step

Could you Ralph or anyone else post a sample of actual files how it should be done?

Edited by smashing

Share this post


Link to post
Share on other sites
Has anyone installed this contribution when they've already got the STS Simple Template System installed? Is it straight forward?

 

Yes, it works and yes it's reasonably straight forward on osC install that isn't heavily modded.

 

Iggy


Everything's funny but nothing's a joke...

Share this post


Link to post
Share on other sites

Minor bug: lost the "Add to Cart" button and right column? They're actually appended to the bottom of the left column. I just did a simple replacement to the stock store, so I was surprised to find this error.

 

Turns out that QTPro wraps the image (in product_info.php) in an additional table. The begin tags for this table are in a conditional:

    if (tep_not_null($product_info['products_image'])) {

...but the matching end tags aren't. So if you've got an imageless product, the first tags are omitted, but the table is still closed. That results in everything after the image getting jammed into the left column... including the "Add to Cart" button. (I had just deleted the stock store and added dummy products, but I can't imagine a production store having products without images. Still, in case this is frustrating someone else...)

 

Simple solution: add the same conditional around the end tags.

Workaround: add a non-existent (or transparent) image to your product.


If this were easy, everybody would do it.

Share this post


Link to post
Share on other sites
To be truthful, I never understood that whole part of ceating my own class. Most contributions are simple drag/drop, changes to existing files etc but not creating new classes I don't know what to do here!!!!  Let me go thru the instructions from the manual one by one.

 

Creating a new class isn't necessary if you use the plugins provided - its drag & drop & set some configuration stuff in the admin site just like other contributions. That's why that information is in an appendix of the manual. If you do find a need to build your own plugin take a look at the existing plugins for examples. For example, pad_sequenced_dropdowns was derived from pad_multiple_dropdowns and required making the changes noted in the appendix when it was created from pad_multiple dropdowns. It helps a lot to understand how classes work in PHP - you'll need to do some reading elsewhere to learn about them - just like you need to read about PHP programming to make modifications to any contribution. BTW, the next milestone release of osCommerce is supposed to use classes much more heavily. This is a good thing as it helps to centralize code into logical modules instead of having it duplicated all over the place like it is today.

Share this post


Link to post
Share on other sites
Minor bug: lost the "Add to Cart" button and right column?? They're actually appended to the bottom of the left column.? I just did a simple replacement to the stock store, so I was surprised to find this error.

 

Turns out that QTPro wraps the image (in product_info.php) in an additional table.? The begin tags for this table are in a conditional:

 ? ?if (tep_not_null($product_info['products_image'])) {

...but the matching end tags aren't.? So if you've got an imageless product, the first tags are omitted, but the table is still closed.? That results in everything after the image getting jammed into the left column... including the "Add to Cart" button.?  (I had just deleted the stock store and added dummy products, but I can't imagine a production store having products without images.? Still, in case this is frustrating someone else...)

 

Simple solution: add the same conditional around the end tags.?

Workaround: add a non-existent (or transparent) image to your product.

Thanks for posting the bug and fix. The additional table is to keep the options below the image when there isn't much text. That keeps the options from butting up against the image and wrapping if the option text is long or the browser window narrow. I never tested without an image. Fix one bug create another....

Edited by ralphday

Share this post


Link to post
Share on other sites
Thanks for posting the bug and fix.  The additional table is to keep the options below the image when there isn't much text.  That keeps the options from butting up against the image and wrapping if the option text is long or the browser window narrow.  I never tested without an image.  Fix one bug create another....

 

Ooh, praise! I haven't heard that in a long time! :lol:

 

I'm getting interested in CSS, and it seems to me that osCommerce (not just QTPro) is presenting a lot of layout information in tables. Wouldn't it be better if we could just attach a style to the options, so if I wanted them to wrap around the image, I could make it so?

 

It just seems like a huge pain to modify the product_info.php file, especially when there's so much code-among-tags-among-code in there.


If this were easy, everybody would do it.

Share this post


Link to post
Share on other sites
That's the right areas of code.  Here's what the wishlist section should end up looking like:

(large chunk of code snipped)

 

D*mn, Ralph, you must love this stuff. I program for a living and I'm not so enchanted with it that I spend that much time helping random strangers.

 

On the other hand, I do give it away for free, so maybe I am helping random strangers. I just don't think I could do support that way.

 

In any case, you're pretty impressive.


If this were easy, everybody would do it.

Share this post


Link to post
Share on other sites

My "not checking stock" problem went away when I did the diff for the fourth time. I found two files (order.php and general.php) that I hadn't completely merged. After THREE EARLIER TRIES. >_< I feel so stupid. I must be a danger to myself and society.

 

I have "show out-of-stock" attributes set to False. I also have sequential drop-down boxes. There are two styles of jeans: Light wash and Medium Wash. There only 4 sizes in the medium wash. Now, when the customer selects the first option "Medium Wash", shouldn't that prevent the sizes that aren't available from showing up in the next option "Size"? It still shows all sizes in both styles. Also, if you choose a size that is not available in the medium wash, it will NOT notify you. I have allow checkout = False, and "prevent adding out-of-stock to cart" = True.

 

It's been driving me nuts for two days. I even had the same trouble with the single dropdown and radio buttons. I finally used kdiff3 on Windows (I've been using kdiff3 and meld on Gnome) and managed to merge the files correctly. I hope. At least, the single dropdown and sequenced dropdowns are working as expected. :thumbsup:


If this were easy, everybody would do it.

Share this post


Link to post
Share on other sites
Ooh, praise!  I haven't heard that in a long time!  :lol:

 

I'm getting interested in CSS, and it seems to me that osCommerce (not just QTPro) is presenting a lot of layout information in tables.  Wouldn't it be better if we could just attach a style to the options, so if I wanted them to wrap around the image, I could make it so? 

 

It just seems like a huge pain to modify the product_info.php file,  especially when there's so much code-among-tags-among-code in there.

 

Good luck getting CSS to work right on the Mac IE! Tables & javascript are enough of a pain.

 

Seriously, a good CSS implementation would be great. Using a templating engine along with it would even be better. I know a template system has been kicked around for osC and is on the MS3 workboard but I don't know what it will be like.

Share this post


Link to post
Share on other sites

Has anyone come up with a better low stock report format? I would like to have it where like on the other pages when u rollover the tabel row, it changes color, also mine isnt sorted by quanity or by product attribute name.

 

Any improvements?

Share this post


Link to post
Share on other sites

My question has to do with integrating QT Pro 4.2 with Paypal Shopping Cart IPN 3.1.5. I noticed some previous posts about this but no one seemed to figure out how to make attribute stock quantities update when buying things using Paypal IPN.

 

I've been working on Order.class.php

(part of Paypal IPN at includes/modules/payment/paypal/classes/osC/)

trying to replicate the QT Pro modifications to checkout_process.php, since as is mentioned earlier in this forum, a lot of the code from Order.class.php is taken from checkout_process.php. Most of it is within the function "updateProducts(&$order)".

 

But even with this, the stock quantities aren't being updated when a payment is made, only the main product quanitity is updated.

 

Now, I noticed that the updateProducts function takes a reference of $order, adding an '&' sign to the front so it looks like "updateProducts(&$order)". I know VERY BASIC php programming and don't know how references work, but I wonder if this affects how the rest of the QT Pro code works in this function? I also noticed "$this->" used in various places and wonder if that has to be used in the QT Pro code as well.

 

Any thoughts from the more seasoned php programmers out there? Let me know if you need me to show you the code I've got so far for the updateProducts function.

Share this post


Link to post
Share on other sites

Good questions.

 

Now, I noticed that the updateProducts function takes a reference of $order, adding an '&' sign to the front so it looks like "updateProducts(&$order)". I know VERY BASIC php programming and don't know how references work, but I wonder if this affects how the rest of the QT Pro code works in this function?

 

QT Pro doesn't update the order object so whether the order object is passed by reference or by value won't matter.

 

I also noticed "$this->" used in various places and wonder if that has to be used in the QT Pro code as well.

 

$this-> refers to properties of the object instance the method is being executed for. QT Pro doesn't use any properties of the order.class.php object. It gets what it needs from the order object and the database. Variable references without the $this-> are normal local variables for the method. This is the same as when QT Pro code is part of checkout_process.php and is what is needed.

 

My question has to do with integrating QT Pro 4.2 with Paypal Shopping Cart IPN 3.1.5. I noticed some previous posts about this but no one seemed to figure out how to make attribute stock quantities update when buying things using Paypal IPN.

 

sinryder finally got it working though he is using a version 3.x of QT Pro. There are changes to catalog/includes/classes/order.php that need to be made in the query method (function query($orderid)). Here's a fragment of order.php with the changes marked that should work for QT Pro version 4.x:

 

//begin PayPal_Shopping_Cart_IPN
//begin QT PRO/Paypal IPN
  $attributes_query = tep_db_query("select opa.products_options_id, opa.products_options_values_id, opa.products_options, opa.products_options_values, opa.options_values_price, opa.price_prefix, popt.products_options_track_stock from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa, " . TABLE_PRODUCTS_OPTIONS . " popt where opa.orders_id = '" . (int)$order_id . "' and opa.orders_products_id = '" . (int)$orders_products['orders_products_id'] . "' and popt.products_options_id = opa.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
//end QT PRO/Paypal IPN
//end PayPal_Shopping_Cart_IPN
      if (tep_db_num_rows($attributes_query)) {
        while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->products[$index]['attributes'][$subindex] = array(
//begin PayPal_Shopping_Cart_IPN
                                                           'option_id' => $attributes['products_options_id'],
                                                           'value_id' => $attributes['products_options_values_id'],
//end PayPal_Shopping_Cart_IPN
//begin QT PRO/Paypal IPN
        'track_stock' => $attributes['products_options_track_stock'],
//end QT PRO/Paypal IPN

        'option' => $attributes['products_options'],
        'value' => $attributes['products_options_values'],
        'prefix' => $attributes['price_prefix'],
        'price' => $attributes['options_values_price']);

           $subindex++;

 

HTH - Ralph

Share this post


Link to post
Share on other sites
sinryder finally got it working though he is using a version 3.x of QT Pro.  There are changes to catalog/includes/classes/order.php that need to be made in the query method (function query($orderid)).  Here's a fragment of order.php with the changes marked that should work for QT Pro version 4.x:

Thanks Ralf, those changes are working so far along with the changes I had made to Order.class.php. When an order is paid for through Paypal IPN, the stock attribute decreases as it should.

 

There is still a problem though; when you want to delete one of these orders from the admin and restock the quantity, the attribute's stock quantity isn't affected, though the main product quantity is increased... so for example if someone had ordered a t-shirt, leaving 9 large and 10 small shirts for a total of 19, and I delete that order while checking the "restock" box, it will still show 9 large and 10 small, but will show a total of 20 shirts in the Product Quantity value.

 

I found that the code that removes orders is in general.php (catalog/admin/includes/functions/general.php) but I don't think the problem is here. I have the feeling that the problem is in how the order is added into the database. I've made two test orders of t-shirts, one Small shirt with Paypal IPN and the other an X-Large shirt with a Cheque, and notice that the attributes for each order are stored slightly differently...

 

In the orders_products table, products_stock_attributes is NULL for the Paypal order, and '1-4' for the Cheque:

 

insert into orders_products (orders_products_id, orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity, products_stock_attributes) values ('292', '199', '69', 'tshirt', 'TEST Shirt', '0.0100', '0.0100', '0.0000', '1', NULL);

insert into orders_products (orders_products_id, orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity, products_stock_attributes) values ('293', '200', '69', 'tshirt', 'TEST Shirt', '0.0100', '0.0100', '0.0000', '1', '1-4')

Also, in the orders_products_attributes table, products_options_id and products_options_values_id have values of '1' and '7' in the Paypal order, but values of '0' and '0' in the Cheque order:

 

insert into orders_products_attributes (orders_products_attributes_id, orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix, products_options_id, products_options_values_id) values ('65', '199', '292', 'size', 'small', '0.0000', '+', '1', '7');

insert into orders_products_attributes (orders_products_attributes_id, orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix, products_options_id, products_options_values_id) values ('66', '200', '293', 'size', 'x-large', '0.0000', '+', '0', '0');

Where would these differences arise? I know there must be a problem with that NULL value because in the tep_remove_order function of general.php, it skips a big chunk of the QT Pro code if products_stock_attributes is NULL:

 

if (tep_not_null($order['products_stock_attributes']))

...don't forget, I'm an absolute php beginner here so feel free to dumb down the wording of your reply!

Share this post


Link to post
Share on other sites
Thanks Ralf, those changes are working so far along with the changes I had made to Order.class.php. When an order is paid for through Paypal IPN, the stock attribute decreases as it should.

 

There is still a problem though; when you want to delete one of these orders from the admin and restock the quantity, the attribute's stock quantity isn't affected, though the main product quantity is increased... so for example if someone had ordered a t-shirt, leaving 9 large and 10 small shirts for a total of 19, and I delete that order while checking the "restock" box, it will still show 9 large and 10 small, but will show a total of 20 shirts in the Product Quantity value.

 

... snip ...

 

In the orders_products table, products_stock_attributes is NULL for the Paypal order, and '1-4' for the Cheque

<grumble> More duplicated code in Paypal IPN :angry: </grumble>

 

You've definitely found the root of the problem

 

The code that inserts the table_order_products row for paypal IPN is in checkout_process_inc. But since the code to reduce stock is now in order.class.php all the work to build the attribute stock key is there too. Rather than duplicate it in checkout_process_inc its probably better to just update table_order_products in order.class.php since the attribute stock key isn't needed unless stock has been reduced.

 

Try adding this to order.class.php right before the comment "insert customer choosen option to order"

 

tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " SET products_stock_attributes = '" . $products_stock_attributes . "' WHERE orders_id = " . $this->orderID . " AND orders_products_id = " . $order->products[i]['orders_products_id']);

 

- Ralph

Share this post


Link to post
Share on other sites
Try adding this to order.class.php right before the comment "insert customer choosen option to order"

 

tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " SET products_stock_attributes = '" . $products_stock_attributes . "' WHERE orders_id = " . $this->orderID . " AND orders_products_id = " . $order->products[i]['orders_products_id']);

 

- Ralph

That didn't work, and actually it caused another problem where the IPN wasn't being accepted, which I fixed that by adding some extra single-quotes around the order ID and such, but no matter, the stock quantity still isn't being restocked and the products_stock_attributes setting is still NULL in the database.

 

Let me go ahead and show you what I have as my updateProducts function in Order.class.php. Maybe the problem is in there... (pardon the length!):

 

  function updateProducts(&$order) {
   // initialized for the email confirmation
   $this->products_ordered = '';
   $subtotal = 0;
   $total_tax = 0;
   for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
   // Stock Update - Joao Correia
//begin QT PRO/Paypal IPN
     $products_stock_attributes=null;
     if (STOCK_LIMITED == 'true') {
       $products_attributes = $order->products[$i]['attributes'];
//        if (DOWNLOAD_ENABLED == 'true') {
//end QT PRO/Paypal IPN
         $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
//begin QT PRO/Paypal IPN
//          $products_attributes = $order->products[$i]['attributes'];
//end QT PRO/Paypal IPN
       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);
       if (tep_db_num_rows($stock_query) > 0) {
         $stock_values = tep_db_fetch_array($stock_query);
//begin QT PRO/Paypal IPN
       $actual_stock_bought = $order->products[$i]['qty'];
       $download_selected = false;
       if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) {
         $download_selected = true;
         $products_stock_attributes='$$DOWNLOAD$$';
       }
//      If not downloadable and attributes present, adjust attribute stock
       if (!$download_selected && is_array($products_attributes)) {
         $all_nonstocked = true;
         $products_stock_attributes_array = array();
         foreach ($products_attributes as $attribute) {
           if ($attribute['track_stock'] == 1) {
             $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id'];
             $all_nonstocked = false;
           }
         } 
         if ($all_nonstocked) {
           $actual_stock_bought = $order->products[$i]['qty'];
         }  else {
           asort($products_stock_attributes_array, SORT_NUMERIC);
           $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'];
             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 = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty'];
           } else {
             $attributes_stock_left = 0 - $order->products[$i]['qty'];
             tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')");
             $actual_stock_bought = 0;
           }
         }
       }
//        $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_selected) {
         $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
         tep_db_query("UPDATE " . TABLE_PRODUCTS . " 
                       SET products_quantity = products_quantity - '" . $actual_stock_bought . "' 
                       WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
//end QT PRO/Paypal IPN
         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']) . "'");
         }
       }
     }
//begin QT PRO/Paypal IPN
   }
//end QT PRO/Paypal IPN

     // Update products_ordered (for bestsellers list)
     tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

     //begin QT PRO/Paypal IPN
     tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " SET products_stock_attributes = '" . $products_stock_attributes . "' WHERE orders_id = '" . $this->orderID . "' AND orders_products_id = '" . $order->products[i]['orders_products_id'] . "'");
     //end QT PRO/Paypal IPN

     //------insert customer choosen option to order--------
     $attributes_exist = '0';
     $products_ordered_attributes = '';
     if (isset($order->products[$i]['attributes'])) {
       $attributes_exist = '1';
       for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
         if (DOWNLOAD_ENABLED == 'true') {
           $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
                                from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                 on pa.products_attributes_id=pad.products_attributes_id
                                where pa.products_id = '" . $order->products[$i]['id'] . "'
                                 and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
                                 and pa.options_id = popt.products_options_id
                                 and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
                                 and pa.options_values_id = poval.products_options_values_id
                                 and popt.language_id = '" . $this->languageID . "'
                                 and poval.language_id = '" . $this->languageID . "'";
           $attributes = tep_db_query($attributes_query);
         } else {
           $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $this->languageID . "' and poval.language_id = '" . $this->languageID . "'");
         }
         $attributes_values = tep_db_fetch_array($attributes);
         if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename']) ) {
           $sql_data_array = array('orders_id' => $this->orderID,
                                   'orders_products_id' => $order->products[$i]['orders_products_id'],
                                   'orders_products_filename' => $attributes_values['products_attributes_filename'],
                                   'download_maxdays' => $attributes_values['products_attributes_maxdays'],
                                   'download_count' => $attributes_values['products_attributes_maxcount']);
           tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
         }
         $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
       }
     }
     //------insert customer choosen option eof ----
     $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
     $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
     $total_cost += $total_products_price;

     //$currency_price = $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
     $products_ordered_price = $this->displayPrice($order->products[$i]['final_price'],$order->products[$i]['tax'],$order->products[$i]['qty']);

     $this->products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $products_ordered_price . $products_ordered_attributes . "\n";
   }
 }

Share this post


Link to post
Share on other sites
That didn't work, and actually it caused another problem where the IPN wasn't being accepted, which I fixed that by adding some extra single-quotes around the order ID and such, but no matter, the stock quantity still isn't being restocked and the products_stock_attributes setting is still NULL in the database.

 

I figured there had to be at least one syntax error in that raw brain dump. :-"

 

OK, I made the assumption that $order->products['orders_products_id'] actually had the orders_products_id in it because it is being used later in order.class.php. That was a bad assumption - Paypal IPN has a bug where it doesn't set that value. You need to add orders_products_id to the array in the catalog/includes/classes/order.php query method around line 128.

Share this post


Link to post
Share on other sites

hi.

 

i have just installed this contribution v4.2 on a fresh install of oscommerce ms2.2 and i am getting the following error.

 

Warning: main(includes/classes/pad_PRODINFO_ATTRIBUTE_PLUGIN.php): failed to open stream: No such file or directory in /home/catalog/public_html/abc/product_info.php on line 163

 

also:

 

Fatal error: main(): Failed opening required 'includes/classes/pad_PRODINFO_ATTRIBUTE_PLUGIN.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/catalog/public_html/abc/product_info.php on line 163

 

 

i was trying get the radio buttons to work, that suits me down to the ground. one of the things i did notice was that one of the screenshots showed the configuration box in admin with product information - i didnt end up with that or the product stock listing that appeared in the screenshots

 

i am a novice at all this html/php stuff and basically a copy and paste person, so any advice given will be appreciated

 

Thanks in a advance.


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
hi.

 

i have just installed this contribution v4.2 on a fresh install of oscommerce ms2.2 and i am getting the following error.

 

Warning: main(includes/classes/pad_PRODINFO_ATTRIBUTE_PLUGIN.php): failed to open stream: No such file or directory in /home/catalog/public_html/abc/product_info.php on line 163

 

 

This sounds like you didn't run the database scripts. You need to run both new_install.sql and config.sql.

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

×