Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Hey there, I don't know if this has already been answered, but I don't fancy looking through 103 pages to find out.

 

My problem is that I downloaded the add-on for 2.3 from http://www.oscommerce.com/community/contributions,7786/category,3/search,qt and after installing the add-on, each of my product pages displays the 'Available options' twice. Does anyone know how to get rid of the original one that was there before the add on?

 

Hi Sammin - I am experiencing the same problem did you ever figure out how to remove the extra available options?

Share this post


Link to post
Share on other sites

I just installed QT PRo and instead of one drop down box I am getting two. I do have it configured for a single dropdown. The difference between to the 2 dropdowns is one has the "out of stock" message next to the attributes (which it should) and the other does not. I deleted all of my attributes and started over and as soon as I add an attribute to an item the two drop downs show up. One drop down is correct with out of stock message the other is not. Does anyone know why I am getting 2 drop downs?

 

After much trial and error I figured out how to remove the extra available options dropdown (that is the original oscommerce available options dropdown). I am posting this incase anyone else runs into the same problem after installing QT Pro (which I wish the 5+ people who posted the same issue in this forum had done when they discovered the fix! DUH!)

 

So In the catalog/product_info.php file remove the following lines of code:

 

?>

<strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />

<?php

 

and

 

<p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>

Share this post


Link to post
Share on other sites

everything is working except that I need to add an additional line of text next to the option values and I havent' been able to find it. basically I want to display a color swatch next to the label (ie color: purple the option will say purple and have an image of the purple swatch). I have created my swatches and they match the attribute id (ie purple is attribute id 131 and my swatch is named 131.png). any idea on how to make this work?

Share this post


Link to post
Share on other sites

With the automatic solution provided from qtpro, I can re-set the summary stock to options stock, one product at a time. However, I have thousands of products, is there a one click solution to this, so I don't need to go through each sick product? Thank you!

Share this post


Link to post
Share on other sites

Qtpro 4.6.1 and OSC 2.3.3

 

Has any one tried this combination successfully ?

 

If so any pointers to gotchas would be appreciated

 

im looking at upgrading from OSC2.3.2

 

many thx in advance

Share this post


Link to post
Share on other sites

Hello.

I didn't find any solutions for my issue which is connected to this contribution. I have two attributes: color and size in diferent quantities. Let say article in red (L) 1 pcs, yellow (XL) 1 pcs and blue (M) 2 pcs. How can I set in admin (if this is passible at all) to display on page (frontend) when I choose red articles to see only L size and not also other sizes (XL, M) and colors (yellow, blue). Now I have on page displayed all sizes and all colors, which is a bit confusing for customers. Later on, when articles are in cart, everything is OK. Those articles which are not on stock are noted ''not available''. Does this contribution (QTPro) allow customization form this point of view.

Share this post


Link to post
Share on other sites

@@Gornik regarding your posts 2082, if you go into admin>configuration>product info (qt pro) and test various settings I believe you will get what you are after. Note the option there to display a table with what is exactly in stock as well.

 

If after trying that you don't have what you want, another option is to edit the products attributes and delete the attribute combination that has zero quantity


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Thanks a lot, Steve. It works fine. But only one problem. How to switch products options on page. I have two option names: One is Size (ID 2), the other is Color (ID 3). Now I have on the first selection place Color (which have to be selected firstly by customers), on the second place is Size (which is selected secondly). I use ''sequenced_dropdowns'' options in admin. I want to have Size on the first place and Color on the second place. Size option have to be selected firstly by customers! Could be the issue ID number of option name in attributes? ID 1 was deleted...

Thanks.

Matjaz

Share this post


Link to post
Share on other sites

I haven't had this issue to deal with but I just checked a couple shops I have with multiple attributes. They appear in order as I want them. Without rummaging through the code to see what's going on my quick hunch is this may be tied to the product options ID found in admin>catalog>product attributes. In my items the first option showing for multiple options is the one with the lowest ID. Just a hunch though.

An examination of the code would tell sure.

 

Thanks a lot, Steve. It works fine. But only one problem. How to switch products options on page. I have two option names: One is Size (ID 2), the other is Color (ID 3). Now I have on the first selection place Color (which have to be selected firstly by customers), on the second place is Size (which is selected secondly). I use ''sequenced_dropdowns'' options in admin. I want to have Size on the first place and Color on the second place. Size option have to be selected firstly by customers! Could be the issue ID number of option name in attributes? ID 1 was deleted...

Thanks.

Matjaz


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Where do I find a clean or most recently de-bugged version of QTPro.

 

Thanks.

 

i am using version 4.6.1 for the 2.3 version of osC. However I had to do so after fix ups to make things work with Attribute Manager. I see there are subsequent fixes to the version i use, but since alls working well in my shops i haven't gotten around to looking into those yet.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I've got QT Pro 4.6.1 on OSC 2.3.1.

When I add the stock quantity I click the "add" button and I'm kicked out the admin area logged out instantly

If I login again the qty is saved, but doing this every single time is soooooo boring!!!!

 

Does someone know how to fix this problem?

Thanks,

Max

Share this post


Link to post
Share on other sites

I just went through installation and when i tried to log on to my local host admin, i received this message:

 

Warning: require(includes/functions/qtpro_functions.php) [function.require]: failed to open stream: No such file or directory in W:\www\mystore\admin\includes\functions\general.php on line 1534

 

Fatal error: require() [function.require]: Failed opening required 'includes/functions/qtpro_functions.php' (include_path='.;/usr/local/PHP/includes;/usr/local/PHP/pear;/home/admin/www/plugins/pear/PEAR') in W:\www\mystore\admin\includes\functions\general.php on line 1534

 

There is no line 1534 in general.php nor do I have includes/functions/qtpro_functions.php

Any help would be greatly appreciated!!!!

Share this post


Link to post
Share on other sites

I use IcePay as payment provider for the shop, but I didn't manage to update the stock if the payment is provided by payment provider.

 

I looked on various php files, but I ain't that good at coding. I think the problem is in includes/modules/payment/icepay/custom/class_update_stock.php.

 

Someone who can help me with this problem?

Share this post


Link to post
Share on other sites

Hi guys- desperate for some help :)

 

I've got QTPro 4.6.1 installed, but am having a problem with it. I have added two options for a product. The product displays as normal on my website with the choice of the two options appearing in the drop-down box. So far, everything looks good. However, when the product (regardless of the option) is added to the cart, the product will add, but not the option. You can see the problem in action here. So, when I go to check on the orders behind the scene, I can only see that the customer has bought the product, but I don't know what option they have actually chosen.

 

Can anyone help? I'm sure it's probably an easy fix; I'm not expert on this stuff though.

 

Thanks everyone!

Share this post


Link to post
Share on other sites

Hi guys- desperate for some help :)

 

I've got QTPro 4.6.1 installed, but am having a problem with it. I have added two options for a product. The product displays as normal on my website with the choice of the two options appearing in the drop-down box. So far, everything looks good. However, when the product (regardless of the option) is added to the cart, the product will add, but not the option. You can see the problem in action here. So, when I go to check on the orders behind the scene, I can only see that the customer has bought the product, but I don't know what option they have actually chosen.

 

Can anyone help? I'm sure it's probably an easy fix; I'm not expert on this stuff though.

 

Thanks everyone!

 

 

Can anyone help me on this? I would be forever grateful! Still can't get it worked out :(

Share this post


Link to post
Share on other sites

Hi all I'm getting the below error when I try to log in to the admin section after installing this addon.

 

Fatal error: Call to undefined function qtpro_sick_product_count() in admin/includes/header.php on line 19

Share this post


Link to post
Share on other sites

Have 2.3.3 cart. Installed 4.6.1 of QTPro.

 

Getting Parse error: syntax error, unexpected '}' in /home/attitude/public_html/shop/product_info.php on line 238

 

Here is my code:

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

if (!isset($HTTP_GET_VARS['products_id'])) {
 tep_redirect(tep_href_link(FILENAME_DEFAULT));
}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
 $current_page = FILENAME_PRODUCT_INFO;
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<?php echo tep_draw_content_top();?>
<?php
 if ($product_check['total'] < 1) {
?>
<?php echo tep_draw_title_top();?>
<h1><?php echo TEXT_PRODUCT_NOT_FOUND; ?></h1>
<?php echo tep_draw_title_bottom();?>

<div class="contentContainer">
 <div class="contentPadd">
     <div class="buttonSet">
           <span class="fl_right"><?php echo tep_draw_button_top();?><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?><?php echo tep_draw_button_bottom();?></span>
     </div>
</div>
</div>
<?php
 } else {
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1'

       and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' 
       and pd.products_id = p.products_id 
       and pd.language_id = '" . (int)$languages_id . "'");

   $product_info = tep_db_fetch_array($product_info_query);



       $tags_query_raw = tep_db_query("select pt.tag_id, t.tag_text from " . TABLE_TAGS . " t, " . TABLE_PRODUCTS_TAGS . " pt where pt.products_id = '" . (int)$product_info['products_id'] . "' and t.tag_id = pt.tag_id");
       $tags = '';
       $caount = 0;
     while ($tag = tep_db_fetch_array($tags_query_raw)) {
               if ($caount != 0) $tags .= ', ';
               $tags .= '<a href="' . tep_href_link(FILENAME_TAG_PRODUCTS) .'?id_tag='.$tag['tag_id'].'">'.$tag['tag_text'].'</a>';
               $caount++;
           }



   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = ' <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> <del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del>';
           $sale    = '<div class="sale"></div>';
   } else {
     $products_price = '<span class="productSpecialPrice">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
           $sale    = '';
   }

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

<?php
// add by Seaman   
   switch (tep_not_null($product_info['products_image'])) {
   case 0:
       if (($oscTemplate->hasBlocks('box_info_page')))    {
       $port_side = 'left_side_pic-1';    
       $starboard_side = 'right_side_pic-1';
       }else{
       $port_side = 'left_side_pic-0';
       $starboard_side = 'right_side_pic-0';
       }
       break;
   case 1:
       $port_side = 'left_side_pic-1';
       $starboard_side = 'right_side_pic-1';
       break;
   }   

?>
<div class="contentContainer">
 <div class="contentPadd prods_info_page">
   <div class="prods_info decks big">
       <div class="forecastle">
       <ol class="masthead">
             <li class="port_side <?php echo $port_side;?>">
<?php
   if (tep_not_null($product_info['products_image'])) {
     $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
?>      
<?php
         if (tep_db_num_rows($pi_query) > 0) {
?>
       <div id="piGal" class="hover">
             <ul class="relative">
<?php
       $pi_counter = 0;
       while ($pi = tep_db_fetch_array($pi_query)) {
         $pi_counter++;
         $pi_entry = '        <li class="wrapper_pic_div"><a href="';
         $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false);
         $pi_entry .= '" target="_blank" rel="fancybox" title="' . $pi['htmlcontent'] . '" class="prods_pic_bg" style="width:'.(PROD_INFO_IMAGE_WIDTH + PIC_MARG_W).'px;height:'.(PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H).'px;">' . tep_image(DIR_WS_IMAGES . $pi['image'], $pi['htmlcontent'], (PROD_INFO_IMAGE_WIDTH), (PROD_INFO_IMAGE_HEIGHT), ' style="width:'.(PROD_INFO_IMAGE_WIDTH + PIC_MARG_W2).'px;height:'.(PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H2).'px;margin:'.PIC_MARG_T.'px '.PIC_MARG_R.'px '.PIC_MARG_B.'px '.PIC_MARG_L.'px;"') . ''.tep_draw_prod_pic_info_top().''.tep_draw_prod_pic_info_bottom().'</a>'.$sale;
         $pi_entry .= '</li>';
         echo $pi_entry;
       }
?>
             </ul>
       </div>
<?php
// add by Seaman
    if    (PROD_INFO_IMAGE_WIDTH + PIC_MARG_W2 != PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H2){
       $coeff = ((PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H2)/(PROD_INFO_IMAGE_WIDTH + PIC_MARG_W2));    
   }else{
       $coeff = 1;
   }
// add by Seaman    
?>      
   <script type="text/javascript">
   $(function(){
   var myWidth = <?php echo (($pi_counter > 1) ? '65' : '0'); ?>;
   var myHeight = myWidth * <?php echo $coeff;?>;
       $('#piGal ul').bxGallery({
         maxwidth: '<?php echo (PROD_INFO_IMAGE_WIDTH + PIC_MARG_W); ?>',
         maxheight: '<?php echo (PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H); ?>',
         thumbwidth: myWidth,
         thumbheight: myHeight,
         thumbcontainer: <?php echo (PROD_INFO_IMAGE_WIDTH + PIC_MARG_W + 7); ?>,
         load_image: 'ext/jquery/bxGallery/spinner.gif'
   })
       });
   </script>
<?php
         } else {
             if (tep_not_null($product_info['products_image'])) {
?>
                   <div style="width:<?php echo (PROD_INFO_IMAGE_WIDTH + 10); ?>px;" class="hover">
         <?php echo '<div id="piGal" class="wrapper_pic_div fl_left" style="width:'.(PROD_INFO_IMAGE_WIDTH + PIC_MARG_W).'px;height:'.(PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H).'px;"><a class="prods_pic_bg" href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (PROD_INFO_IMAGE_WIDTH), (PROD_INFO_IMAGE_HEIGHT), ' style="width:'.(PROD_INFO_IMAGE_WIDTH + PIC_MARG_W2).'px;height:'.(PROD_INFO_IMAGE_HEIGHT + PIC_MARG_H2).'px;margin:'.PIC_MARG_T.'px '.PIC_MARG_R.'px '.PIC_MARG_B.'px '.PIC_MARG_L.'px;"', '', '') . ''.tep_draw_prod_pic_info_top().''.tep_draw_prod_pic_info_bottom().'</a>'.$sale.'</div>'; ?>

               </div>
<?php
// add by Seaman
             }
       }                  
   echo '<script type="text/javascript">
   $("#piGal a[rel^=\'fancybox\']").fancybox({
     cyclic: true
   });
   </script>';

?>

<?php
       }
?>
<?php
   if (($oscTemplate->hasBlocks('box_info_page')))    {
       $width_ext = PROD_INFO_IMAGE_WIDTH + PIC_MARG_W;
?>
               <div class="bookmarks">
<?php echo $oscTemplate->getBlocks('box_info_page');?>
               </div>        
<?php                

// add by Seaman
}
?>
             </li>
             <li class="starboard_side <?php echo $starboard_side;?>">
<?php
// add by Seaman   
  if ($product_check['total'] >= 1) {
     include (DIR_WS_INCLUDES . 'products_next_previous.php');
  }
// add by Seaman
?>              
                   <div class="info">
<?php
       if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
                       <div class="data data_padd small_title"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></div>
<?php
       }else{
?>        
                       <div class="data data_padd small_title"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></div>
<?php        
       }
?>
                       <br /><h2><?php echo $products_name; ?></h2>
                       <h2 class="price"><?php echo '<b>'.PRICE. '</b>'.$products_price; ?></h2>
<?php

//++++ QT Pro: End Changed Code
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
     $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']); 
     require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
     $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
     $pad = new $class($products_id);
     echo $pad->draw();
   }

//Display a table with which attributecombinations is on stock to the customer?
if(PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST == 'True'): require(DIR_WS_MODULES . "qtpro_stock_table.php"); endif;

//++++ QT Pro: End Changed Code
?>

                               <li class="fl_left"><label><?php echo $products_options_name['products_options_name'] . ':'; ?></label><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></li>
<?php
         }
?>
                           </ul>
                       </div>
<?php
       }
?>
                       <div class="desc desc_padd"><?php echo stripslashes($product_info['products_description']); ?></div>

<?php
       $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
       $reviews = tep_db_fetch_array($reviews_query);
?>

                       <div class="buttonSet">
                           <span class="buttonAction"><?php echo tep_draw_button2_top();?><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?><?php echo tep_draw_button2_bottom();?></span>

                           <div class="fl_right" align="right"><?php echo tep_draw_button_top();?><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?><?php echo tep_draw_button_bottom();?></div>
                       </div>
                   </div> 
             </li>
       </ol>
       </div>    
<?php
               if    ($tags != '')    {
?>
   <div class="infoBoxWrapper">
     <div class="box_wrapper">
         <div class="infoBoxHeading prod_page"><div class="title-icon"></div><?php echo tep_draw_box_title_top();?>Tags of product<?php echo tep_draw_box_title_bottom();?></div>
     <div class="infoBoxContents">
               <?php
               echo $tags;
       ?>
     </div>
   </div>
 </div>    
<?php
               }
?>                
   </div>

   </div>
</div>
<?php echo tep_draw_content_bottom();?>
<?php
//Optional Related Products (ORP)
    include(DIR_WS_MODULES . FILENAME_RELATED_PRODUCTS);
//ORP: end    
// add by Seaman
           if ((USE_CACHE == 'true') && empty($SID)) {
             echo tep_cache_also_purchased(3600);
           } else {
             include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
           }
?>
</form>
<?php
 }
?>

<?php
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Edited by apie

Share this post


Link to post
Share on other sites

I think I solved that issue.

 

There were two brackets that needed to be removed.

 

One on line 238 and one on 290.

 

I've got one more problem though. Now the product info pages load but there is the following error message.

 

Warning: require(includes/modules/qtpro_stock_table.php) [function.require]: failed to open stream: No such file or directory in /home/attitude/public_html/shop/product_info.php on line 226

 

Warning: require(includes/modules/qtpro_stock_table.php) [function.require]: failed to open stream: No such file or directory in /home/attitude/public_html/shop/product_info.php on line 226

 

Fatal error: require() [function.require]: Failed opening required 'includes/modules/qtpro_stock_table.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/attitude/public_html/shop/product_info.php on line 226

 

Please let me know what needs to be fixed.

Share this post


Link to post
Share on other sites

Resolved. When I had copied all of the files to my server I had missed the qtpro_stock_table.php file.

Share this post


Link to post
Share on other sites

I Have installed QT Pro, and notice that the product attributes get jumbled up, and do not display in order as per the attribute ID displayed in the Admin console.

 

I have been looking in the class (pasted below) that I think needs changing to sort the attributes before they are displayed, but cant get anything to work. If anyone has got any ideas, that would be great. Thanks

 

 

 

function _draw_stocked_attributes() {

global $languages_id;

 

$out='';

 

$attributes = $this->_build_attributes_array(true, false);

if (sizeof($attributes)>0) {

$combinations = array();

$selected_combination = 0;

$this->_build_attributes_combinations($attributes, $this->show_out_of_stock == 'True', $this->mark_out_of_stock, $combinations, $selected_combination);

 

$combname='';

foreach ($attributes as $attrib) {

$combname.=', '.$attrib['oname'];

}

$combname=substr($combname,2).':';

 

 

foreach ($combinations as $combindex => $comb) {

$out.="<tr>\n";

$out.=' <td align="right" class=main><strong>'.$combname."</strong></td>\n <td class=main>";

$out.=tep_draw_radio_field('attrcomb', $combinations[$combindex]['id'], ($combindex==$selected_combination)) . $comb['text'];

$out.="</td>\n";

$out.="</tr>\n";

$combname='';

}

}

 

$out.=$this->_draw_out_of_stock_message_js($attributes);

 

return $out;

}

 

}

Share this post


Link to post
Share on other sites

I've got QT Pro working on an osC 2.3.3 storefront with only one other module. Product info displays the attribute sizes properly, but certain products say they're out of stock--even when the stock table displays quantities. It's not happening to everything, but since I've got over two thousand products in there, I really don't want to go through every single item if I can avoid it.

 

Does anybody know which part of the system this kind of error happens in? I tried looking in pad_multiple_dropdowns, and I even got it to print its queries on the screen for me so I could try them in MySQL. On products that make this mistake, the query still loads the correct data in MySQL. The quantities I see on MySQL match the ones I see on the product detail page. The quantities are above the low stock threshold, but on the faulty items, the item still cannot be added to my cart.

 

Anybody have any ideas?

 

<?php
/*
  QT Pro Version 4.1

  pad_multiple_dropdowns.php

  Contribution extension to:
    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com

  Copyright (c) 2004, 2005 Ralph Day
  Released under the GNU General Public License

  Based on prior works released under the GNU General Public License:
    QT Pro prior versions
	  Ralph Day, October 2004
	  Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman
	  FREEZEHELL - 08/11/2003 freezehell@hotmail.com Copyright (c) 2003 IBWO
	  Joseph Shain, January 2003
    osCommerce MS2
	  Copyright (c) 2003 osCommerce

  Modifications made:
	  11/2004 - Created
	  12/2004 - Fix _draw_out_of_stock_message_js to add semicolon to end of js stock array
	  03/2005 - Remove '&' for pass by reference from parameters to call of
			    _build_attributes_combinations.  Only needed on method definition and causes
			    error messages on some php versions/configurations

*******************************************************************************************

  QT Pro Product Attributes Display Plugin

  pad_multiple_dropdowns.php - Display stocked product attributes first as one dropdown for each attribute.

  Class Name: pad_multiple_dropdowns

  This class generates the HTML to display product attributes.  First, product attributes that
  stock is tracked for are displayed, each attribute in its own dropdown list.  Then attributes that
  stock is not tracked for are displayed, each attribute in its own dropdown list.

  Methods overidden or added:

    _draw_stocked_attributes		    draw attributes that stock is tracked for
    _draw_out_of_stock_message_js	   draw Javascript to display out of stock message for out of
									    stock attribute combinations
*/
 require_once(DIR_WS_CLASSES . 'pad_base.php');
 class pad_multiple_dropdowns extends pad_base {

/*
   Method: _draw_stocked_attributes

   draw dropdown lists for attributes that stock is tracked for

   Parameters:

  none

   Returns:

  string:		 HTML to display dropdown lists for attributes that stock is tracked for

*/
   function _draw_stocked_attributes() {
  global $languages_id;

  $out='';

  $attributes = $this->_build_attributes_array(true, false);
  if (sizeof($attributes)>0) {
    for($o=0; $o<sizeof($attributes); $o++) {
	  $s=sizeof($attributes[$o]['ovals']);
	  for ($a=0; $a<$s; $a++) {

/* diagnostic code here */
	    $sqlTest = "select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$attributes[$o]['oid'] . "-" . (int)$attributes[$o]['ovals'][$a]['id'] . "(,|$)' AND products_stock_quantity > 0";
	    echo "<strong>" . $sqlTest . "</strong><br /><br />";
/* end diagnostic code */

	    $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$attributes[$o]['oid'] . "-" . (int)$attributes[$o]['ovals'][$a]['id'] . "(,|$)' AND products_stock_quantity > 0");
	    $out_of_stock=(tep_db_num_rows($attribute_stock_query)==0);
	    if ($out_of_stock && ($this->show_out_of_stock == 'True')) {
		  switch ($this->mark_out_of_stock) {
		    case 'Left':   $attributes[$o]['ovals'][$a]['text']=TEXT_OUT_OF_STOCK.' - '.$attributes[$o]['ovals'][$a]['text'];
						   break;
		    case 'Right':  $attributes[$o]['ovals'][$a]['text'].=' - '.TEXT_OUT_OF_STOCK;
						   break;
		  }
	    }
	    elseif ($out_of_stock && ($this->show_out_of_stock != 'True')) {
		  unset($attributes[$o]['ovals'][$a]);
	    }
	  }
	  $out.='<tr><td align="right" class=main><strong>'.$attributes[$o]['oname'].":</strong></td><td class=main>".tep_draw_pull_down_menu('id['.$attributes[$o]['oid'].']',array_values($attributes[$o]['ovals']),$attributes[$o]['default'], "onchange=\"stkmsg(this.form);\"")."</td></tr>\n";
    }	   
    $out.=$this->_draw_out_of_stock_message_js($attributes);

    return $out;
  }
   }

/*
   Method: _draw_out_of_stock_message_js

   draw Javascript to display out of stock message for out of stock attribute combinations

   Parameters:

  $attributes	 array   Array of attributes for the product.  Format is as returned by
						  _build_attributes_array.

   Returns:

  string:		 Javascript to display out of stock message for out of stock attribute combinations

*/
   function _draw_out_of_stock_message_js($attributes) {
  $out='';

  $out.="<tr><td> </td><td><span id=\"oosmsg\" class=errorBox></span>\n";

  if (($this->out_of_stock_msgline == 'True' | $this->no_add_out_of_stock == 'True')) {
    $out.="<SCRIPT LANGUAGE=\"Javascript\"><!--\n";
    $combinations = array();
    $selected_combination = 0;
    $this->_build_attributes_combinations($attributes, false, 'None', $combinations, $selected_combination);

    $out.="  function chkstk(frm) {\n";

    // build javascript array of in stock combinations
    $out.="    var stk=".$this->_draw_js_stock_array($combinations).";\n";
    $out.="    var instk=false;\n";

    // build javascript if statement to test level by level for existance 
    $out.='    ';
    for ($i=0; $i<sizeof($attributes); $i++) {
	  $out.='if (stk';
	  for ($j=0; $j<=$i; $j++) {
	    $out.="[frm['id[".$attributes[$j]['oid']."]'].value]";
	  }
	  $out.=') ';
    }

    $out.="instk=true;\n";
    $out.="  return instk;\n";
    $out.="  }\n";
    if ($this->out_of_stock_msgline == 'True') {
	  // set/reset out of stock message based on selection
	  $out.="  function stkmsg(frm) {\n";
	  $out.="    var instk=chkstk(frm);\n";
	  $out.="    var span=document.getElementById(\"oosmsg\");\n";
	  $out.="    while (span.childNodes[0])\n";
	  $out.="	  span.removeChild(span.childNodes[0]);\n";
	  $out.="    if (!instk)\n";
	  $out.="	  span.appendChild(document.createTextNode(\"".TEXT_OUT_OF_STOCK_MESSAGE."\"));\n";
	  $out.="    else\n";
	  $out.="	  span.appendChild(document.createTextNode(\" \"));\n";
	  $out.="  }\n";
	  //initialize out of stock message
	  $out.="  stkmsg(document.cart_quantity);\n";
    }

    if ($this->no_add_out_of_stock == 'True') {
	  // js to not allow add to cart if selection is out of stock
	  $out.="  function chksel() {\n";
	  $out.="    var instk=chkstk(document.cart_quantity);\n";
	  $out.="    if (!instk) alert('".TEXT_OUT_OF_STOCK_MESSAGE."');\n";
	  $out.="    return instk;\n";
	  $out.="  }\n";
	  $out.="  document.cart_quantity.onsubmit=chksel;\n";
    }
    $out.="//--></SCRIPT>\n";
  }
  $out.="</td></tr>\n";

  return $out;
   }
 }
?>

Share this post


Link to post
Share on other sites

@@twigster

 

I Have installed QT Pro, and notice that the product attributes get jumbled up, and do not display in order as per the attribute ID displayed in the Admin console.

 

I have been looking in the class (pasted below) that I think needs changing to sort the attributes before they are displayed, but cant get anything to work. If anyone has got any ideas, that would be great. Thanks

 

 

I know from looking at pad_multiple_dropdowns that the system loops through individual queries to build a set of results (see my recent post). Each query it runs is just ONE combination of attributes, like "RED / SMALL," so I'm guessing the only way to influence the ordering of the options would be to figure out a way to get the option sort column into a query of all the options before you run anything else. Then you would need to use "ORDER BY" in SQL to control sorting order. Then you would run a "for..next" loop covering the range of numbers covered in your sort column.

 

Then on each loop, you could add the sort column's value to the "WHERE" clause of the query, getting you the rows in order.

 

Unfortunately, since I'm so new to this, I can't tell you exactly how you're going to do that, but if you know some SQL, you should be able to get it.

Edited by PhaseClone

Share this post


Link to post
Share on other sites

My problem is now solved, but it's now a bug report in QT Pro.

 

Consider an item with one color and many sizes. For example, a hardware store sells work gloves in various sizes but they're all the same color:

Red/Small, Red/Medium, Red/Large, Red/XLarge

 

or

 

Consider an item with one size and many colors. For example, a hardware store sells plastic garden shovels that have different colors:

Orange/Shovel, Silver/Shovel, Gray/Shovel, White/Shovel

 

Each of these items fails to appear properly in stock if the non-varying unit (for the gloves, that's RED and for the shovels, that's SHOVEL) is declared separately in the product attributes system: the products_attributes, products_options, products_options_values, and products_options_values_to_products_options tables.

 

Workaround: on any grid containing only one color with many sizes, or on any grid containing one size with many colors, merge the attributes so they are not separated on two menus. For example, describe the gloves as "red gloves," and then only offer sizes, or describe the shovel as a "shovel" and only offer colors.

 

This problem may not occur if you add all your products manually, but if you're importing products from another database, it helps to know.

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

×