Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

I have a problem. This contribution and BUNDLE PRODUCT overlape at the file of CHECKOUT_PROCCESS.PHP. Have anybody can combine them? Thanks very much!

QTpro

// otherwise, we have to build the query dynamically with a loop
//++++ QT Pro: Begin Changed code
//      $products_attributes = $order->products[$i]['attributes'];
//++++ QT Pro: End Changed Code
     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);
//++++ QT Pro: Begin Changed code
       $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']) . "'");
//++++ QT Pro: End Changed Code
         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']) . "'");
         }
       }
     }
//++++ QT Pro: Begin Changed code
   }
//++++ QT Pro: End Changed Code

 

Bundle product:

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
   if (STOCK_LIMITED == 'true') {
     if (DOWNLOAD_ENABLED == 'true') {
       $stock_query_raw = "SELECT products_quantity, products_bundle, 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
       $products_attributes = $order->products[$i]['attributes'];
       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 {
       $stock_query = tep_db_query("select products_quantity, products_bundle 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);
   if ($stock_values['products_bundle'] == 'yes') {
	 // order item is a bundle and must be separated
	 $report_text .= "Bundle found in order : " . tep_get_prid($order->products[$i]['id']) . "<br>\n";
  	 $bundle_query = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_model, p.products_quantity, p.products_bundle 
         from " . TABLE_PRODUCTS_BUNDLES . " pb 
         LEFT JOIN " . TABLE_PRODUCTS . " p 
         ON p.products_id=pb.subproduct_id 
         where pb.bundle_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

	 while ($bundle_data = tep_db_fetch_array($bundle_query)) {
   if ($bundle_data['products_bundle'] == "yes") {
  	 $report_text .= "<br>level 2 bundle found in order :  " . $bundle_data['products_model'] . "<br>";
    	 $bundle_query_nested = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_model, p.products_quantity, p.products_bundle 
          	 from " . TABLE_PRODUCTS_BUNDLES . " pb 
          	 LEFT JOIN " . TABLE_PRODUCTS . " p 
          	 ON p.products_id=pb.subproduct_id 
          	 where pb.bundle_id = '" . $bundle_data['subproduct_id'] . "'");
  	 while ($bundle_data_nested = tep_db_fetch_array($bundle_query_nested)) {
     $stock_left = $bundle_data_nested['products_quantity'] - $bundle_data_nested['subproduct_qty'] * $order->products[$i]['qty'];
     $report_text .= "updating level 2 item " . $bundle_data_nested['products_model'] . " : was " . $bundle_data_nested['products_quantity'] . " and number ordered is " . ($bundle_data_nested['subproduct_qty'] * $order->products[$i]['qty']) . " <br>\n";
     tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . $bundle_data_nested['subproduct_id'] . "'");
  	 }
   } else {
  	 $stock_left = $bundle_data['products_quantity'] - $bundle_data['subproduct_qty'] * $order->products[$i]['qty'];
  	 $report_text .= "updating level 1 item " . $bundle_data['products_model'] . " : was " . $bundle_data['products_quantity'] . " and number ordered is " . ($bundle_data['subproduct_qty'] * $order->products[$i]['qty']) . " <br>\n";
  	 tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . $bundle_data['subproduct_id'] . "'");
   }
	 }
	 
   } else {
// order item is normal and should be treated as such
	 $report_text .= "Normal product found in order : " . tep_get_prid($order->products[$i]['id']) . "\n";
// do not decrement quantities if products_attributes_filename exists
        if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
          $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
        } 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']) . "'");
        }
   }
     }
   }

Link to comment
Share on other sites

I've found that on IE on a Mac, the sequenced dropdowns do not display correctly. After selecting an initial option, the remaining fields do not populate, they are simply blank.

 

Is this a javascript issue? Any workarounds?

IE Mac is a horribly buggy browser and getting very dated. It most likely a javascript probem with that browser. Someone else had that problem q while back I believe. I can't remember if it was ever solved. Check back a ways on this thread.

Link to comment
Share on other sites

this is a snippet from the applican_top.php

 

orginal

 	 $cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$HTTP_POST_VARS['id']))+1,$HTTP_POST_VARS['id']);

 

this is the from your contrieb

 $cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$attributes))+1, $attributes);
//++++ QT Pro: End Changed Code

 

my with sppc-pricebreake

//SPPC PRICEBREAK  BOF
$cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$HTTP_POST_VARS['id']))+$HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
//SPPC PRICEBREAK  EOF

 

what is the right code ?

Link to comment
Share on other sites

this is a snippet from the applican_top.php

 

orginal

 ?	$cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$HTTP_POST_VARS['id']))+1,$HTTP_POST_VARS['id']);

 

this is the from your contrieb

 $cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$attributes))+1, $attributes);
//++++ QT Pro: End Changed Code

 

my with sppc-pricebreake 

//SPPC PRICEBREAK ?BOF
$cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$HTTP_POST_VARS['id']))+$HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
//SPPC PRICEBREAK ?EOF

 

what is the right code ?

It should be:

$cart->add_cart($HTTP_POST_VARS['products_id'],$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'],$attributes))+$HTTP_POST_VARS['cart_quantity'], $attributes);

Link to comment
Share on other sites

  • 2 weeks later...

Sorry guys i was trying to read up on this but didn't really find the solution, the only thing that was done was logging right? Did we have a fix for this issue? iim also having the same issue btw.

 

Strange, I made no code changes other than adding the logging to what you posted earlier.  You can rip the logging back out, it shouldn't need it.

 

Delete with restock is fixed in QT Pro 4.  Only for orders created with QT Pro 4 as it needs to stash a few things in the order tables.  Since you're still using 3.x it won't work.

Link to comment
Share on other sites

Sorry for the lack of information regarding my issue. I looked at the past issues and it looks like most of the ppl using paypal IPN has the earlier releases. I downloaded the moduled version

"osCommerce PayPal IPN Module v1.0 For 2.2MS2" and installed v 1.1.

 

I don't see the files under ~modules/payment/paypal/OSC..

 

is this version harder to fix ?

 

I have QT Pro 4.2 btw.

 

 

Sorry guys i was trying to read up on this but didn't really find the solution, the only thing that was done was logging right? Did we have a fix for this issue? iim also having the same issue btw.

Link to comment
Share on other sites

Sorry for the lack of information regarding my issue. I looked at the past issues and it looks like most of the ppl using paypal IPN has the earlier releases. I downloaded the moduled version

"osCommerce PayPal IPN Module v1.0 For 2.2MS2" and installed v 1.1.

 

I don't see the files under ~modules/payment/paypal/OSC..

 

is this version harder to fix ?

 

I have QT Pro 4.2 btw.

 

You are using a different Paypal IPN contribution that was discussed earlier. You need to merge the QT Pro changes to catalog/checkout_process.php into paypal IPN catalog/includes/modules/payment/paypal_ipn.php. It looks like the stock update changes go into method before_process. Getting order deletion working will be a bit harder. The code to insert the order is moved to the confirmation method which gets called from checkout_confirmation - a different page. That will require rebuilding the key to the products_stock table from the attributes. You'll need to extract the code that does that from the stock update and add it into the confirmation method.

Link to comment
Share on other sites

thanks for the quick reply ralph, im not good in php thus i think getting this working will be harder. What is the quickest, safest way of getting this to work ? Do you suggest I remove the module and install the paypal IPN which is not moduled? will that be easier? If i do that, do i only need to update paypal_ipn.php with the c hanges in checkout_process.php? I did this on the module btw, and the stock didn't get updated.

Link to comment
Share on other sites

Hey guys,

 

I just need an opinion on this.

 

I have a store that sells basically 3 things: Jewelry, Art, and Clothing.

On the art prints and the clothing I've been using the Attribute Sets contribution, but I've been having a problem with it (attributes look fine from the customer side but choice doesn't appear) and this QTpro contribution seems a better deal as far as keeping track of the stock.

So, do I delete Attribute Sets if I install this or should/would they work together?

 

Second, there are some jewelry items that I have that would be better with the Option as Images contribution. Stock is not so much an issue on those because they are handmade to order. I haven't installed that one yet. Just trying to figure out what would work with what.

 

Any input?

 

Thanks

Link to comment
Share on other sites

Hi all

 

I'd like to use qtpro 4.2 and wishlist 2.3.

The problem is, if I add a product to the wishlist the attributes are not written to the database.

Without the QTPro mod everything works fine.

 

I guess it's because the attributes are combined in pad_singel_dropdown.php

 

I'd really love to use these 2 contributions together and would be greatful for any solution :)

 

Thanks!

 

Code from wishlist 2.3 in product_info.php

 

 <!-- Wish List 2.3 Start -->
              <td align="left" class="main"><?php if (tep_session_is_registered('customer_id')) echo tep_draw_hidden_field('wishlist_action', 'add_wishlist') . tep_image_submit('button_wishlist.gif', IMAGE_BUTTON_ADD_WISHLIST, 'onClick="document.cart_quantity.action=\''. tep_href_link(FILENAME_WISHLIST, tep_get_all_get_params(array('action')) . 'action=add_wishlist') . '\';document.cart_quantity.submit();"'); ?></td>
              <!-- Wish List 2.3 End   -->

Link to comment
Share on other sites

Hi all

 

I'd like to use qtpro 4.2 and wishlist 2.3.

The problem is, if I add a product to the wishlist the attributes are not written to the database.

Without the QTPro mod everything works fine.

 

I guess it's because the attributes are combined in pad_singel_dropdown.php

 

Take a look at the QT Pro changes in catalog/includes/application_top.php for code to break apart the combined attributes. You'll need to adapt that for use in the wishlist code - whatever gets invoked when the add to wishlist button is clicked.

Link to comment
Share on other sites

Hey guys,

 

I just need an opinion on this.

 

I have a store that sells basically 3 things: Jewelry, Art, and Clothing.

On the art prints and the clothing I've been using the Attribute Sets contribution, but I've been having a problem with it (attributes look fine from the customer side but choice doesn't appear) and this QTpro contribution seems a better deal as far as keeping track of the stock.

So, do I delete Attribute Sets if I install this or should/would they work together?

 

Second, there are some jewelry items that I have that would be better with the Option as Images contribution. Stock is not so much an issue on those because they are handmade to order. I haven't installed that one yet. Just trying to figure out what would work with what.

 

Any input?

 

Thanks

 

QT Pro will have conflicts with most other attribute contributions. The two you mention don't sound like they will be major conflicts. You'll just have to spend a little time working through merging the code changes.

Edited by ralphday
Link to comment
Share on other sites

Take a look at the QT Pro changes in catalog/includes/application_top.php for code to break apart the combined attributes.  You'll need to adapt that for use in the wishlist code  - whatever gets invoked when the add to wishlist button is clicked.

 

Hi

 

I guess these are the 2 functions you were mentioning:

 

//++++ QT Pro: Begin Changed code
                               $attributes=array();
                               if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {
                                 $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);
                                 foreach ($attrlist as $attr) {
                                   list($oid, $oval)=explode('-',$attr);
                                   if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)
                                     $attributes[$oid]=$oval;
                                 }
                               }
                               if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
                                 foreach ($HTTP_POST_VARS['id'] as $key=>$val) {
                                   if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)
                                     $attributes=$attributes + $HTTP_POST_VARS['id'];
                                 }
                               }
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);
//++++ QT Pro: End Changed Code
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;



 // Shopping cart actions through POST variables from forms
 if (isset($HTTP_POST_VARS['wishlist_action'])) {
   // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   if ($session_started == false) {
     tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
   }

   $goto = basename($PHP_SELF);
   switch ($HTTP_POST_VARS['wishlist_action']) {
     // Customer wants to update the product quantity in their shopping cart
     case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                               if ($HTTP_POST_VARS['products_id']) {
                                 if ($customer_id > 0) {
           // Queries below replace old product instead of adding to queatity.
                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   // Read array of options and values for attributes in id[]
                                   if (isset ($id)) {
                                     foreach($id as $att_option=>$att_value) {
                                       // Add to customers_wishlist_attributes table
                                       tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                     }
                                   }
                                 }
                               }
                             }
                             break;

 

But I havent got a clue what to do with it :(

Can you point me in the right direction :)

Link to comment
Share on other sites

hi ralphday,

got a quick question for you

 

If i have a file that has

MODEL # ATTRIBUTE 1 (COLOR) ATTRIBUTE 2 (SIZE) QTY

 

 

 

ie

 

54445 GREEN M 4

54445 BLUE M 4

54445 BLUE L 2

 

 

is there a quick way to import it? as I have a huge inventory along with a couple retail stores it would be impossible to keep track of stock so if i could do an update every nite with jus importing one file that would be great..i can get my pos software to export a file in a similar format..now just need to import into osc

 

some help would be great

 

thanks

Link to comment
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?

Link to comment
Share on other sites

I'd like to get this contribution working with extended option types ie be able to display a mix of checkboxes as well as radiosets and dropdowns and also for products that are not tracked for stock.

 

I've read some of the manual for the QTPro contribution and I see there is brief guidance for writing other classes. However, I'm wondering if there is a fundamental reason why the stock has to be tracked before different option types can be displayed. Maybe it would be easier to first add extended option types for products that are NOT tracked.

 

Has anyone done any work in this area please?

Link to comment
Share on other sites

I installed QTPRO as a new install and the good news is that nothing was broken in the process. I've only put on a USPS contribution and image Stretch contribution to date.

 

The down side is that it's not working as I had hoped. It's all about stock attibutes and stock levels.

 

For example, I have 5 of a product, 2 red and 3 blue. I created the attibutes with stock tracking enabled. When I add the 2 and 3 the product shows the total of 5.. so far so good. However when it's shopping time, the customer can buy up to 5 red and 5 blue and never see an out of stock message...

 

I'm sure it's something I've not done correctly and am hoping for an easy solution! ;)

Link to comment
Share on other sites

I just did some further testing with purchases. I ordered 5 of my product which should have elimanted the stock, attribute or not. When I logged back on I was able to order 4... Checked the admin and after my order of 5 the stock had only been reduced by a quantity of 1.

 

This is pretty much a show stopper. Any ideas?

Link to comment
Share on other sites

Hi

 

I guess these are the 2 functions you were mentioning:

 

.....

 

But I havent got a clue what to do with it :(

Can you point me in the right direction :)

 

That's the right areas of code. Here's what the wishlist section should end up looking like:

 

    $goto = basename($PHP_SELF);
   switch ($HTTP_POST_VARS['wishlist_action']) {
     // Customer wants to update the product quantity in their shopping cart
     case 'add_wishlist' :  if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
                               if ($HTTP_POST_VARS['products_id']) {
                                 if ($customer_id > 0) {
           // Queries below replace old product instead of adding to queatity.
                                   tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                   tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
                                   tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
//++++ QT Pro: Begin Changed code
                               $attributes=array();
                               if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {
                                 $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);
                                 foreach ($attrlist as $attr) {
                                   list($oid, $oval)=explode('-',$attr);
                                   if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)
                                     $attributes[$oid]=$oval;
                                 }
                               }
                               if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
                                 foreach ($HTTP_POST_VARS['id'] as $key=>$val) {
                                   if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)
                                     $attributes=$attributes + $HTTP_POST_VARS['id'];
                                 }
                               }

                                   // Read array of options and values for attributes in id[]
                                     foreach($attributes as $att_option=>$att_value) {
                                       // Add to customers_wishlist_attributes table
                                       tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
                                     }
                                   }
                                 }
                               }
                             }
                             break;

Link to comment
Share on other sites

hi ralphday,

got a quick question for you

 

If i have a file that has

MODEL #          ATTRIBUTE 1 (COLOR)              ATTRIBUTE 2 (SIZE)          QTY

ie

 

54445            GREEN            M          4

54445            BLUE            M          4

54445            BLUE            L          2

is there a quick way to import it? as I have a huge inventory along with a couple retail stores it would be impossible to keep track of stock so if i could do an update every nite with jus importing one file that would be great..i can get my pos software to export a file in a similar format..now just need to import into osc

 

some help would be great

 

thanks

 

There is no easy way. You'll need to write a program to do the lookup on the options to get the option ID and values to build the key to the stock table.

Link to comment
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:

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.

Link to comment
Share on other sites

I'd like to get this contribution working with extended option types ie be able to display a mix of checkboxes as well as radiosets and dropdowns and also for products that are not tracked for stock.

 

I've read some of the manual for the QTPro contribution and I see there is brief guidance for writing other classes. However, I'm wondering if there is a fundamental reason why the stock has to be tracked before different option types can be displayed. Maybe it would be easier to first add extended option types for products that are NOT tracked.

 

Has anyone done any work in this area please?

There is no reason stock has to be tracked before different option types can be displayed. But having option types for options where stock is tracked has some complications as different types behave differently from an HTML/Javascript perspective and the javascript that checks for stock would need a bit of work. Also, certain option types don't make sense (e.g. text box) when stock is tracked. It certainly would be easier to add extended option types for products where stock is not tracked as those complications don't have to be dealt with but its still a fairly big project.

Link to comment
Share on other sites

Hi All, I am kind a newbie here, Everyone kinda knows what they doing except me...trying hard not to collapse, i have worked really hard to get to where i am now,( I am a complete beginner at PHP) the shop opens in about a week and i just stumbled on the stock level problem. I have been advised to download the QTpro contribution which i did , but i'm not sure how to import that in the oscommerce files. Any help would be very much appreciated,

 

Look forward to hear from anyone!!

 

Azanaz

Link to comment
Share on other sites

I just did some further testing with purchases.  I ordered 5 of my product which should have elimanted the stock, attribute or not.  When I logged back on I was able to order 4... Checked the admin and after my order of 5 the stock had only been reduced by a quantity of 1.

 

This is pretty much a show stopper.  Any ideas?

 

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.

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