Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

Hi, i install qtpro 4.6.1 on oscom 2.3.4 gold

When i do click on a product whit 0 stock the categories box disappears, If stock works well-

Any idea?

Regards

Hello, the error is in catalog / product_info.php

I have 2 buttons, one that says exhausted and another that goes back and clear ... do not follow the instructions of the qtpro.

I have to change this in product_info

<?php
    $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) {
?>

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

    <p>
<?php
      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name 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 . "' order by popt.products_options_name");
      while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
        $products_options_array = array();
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
        while ($products_options = tep_db_fetch_array($products_options_query)) {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          if ($products_options['options_values_price'] != '0') {
            $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
          }
        }

        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
          $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
        } else {
          $selected_attribute = false;
        }
?>
      <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
      }
?>
    </p>

<?php
    }
?>

For this other:

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

And since I have the buttons mentioned above, the form does not close and there is something that causes the categories box to disappear. If I remove the buttons, I will see the box again. How do I change without removing the buttons?

Product_info current:

    <?php
    /*
      $Id$

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

      Copyright (c) 2010 osCommerce

      Released under the GNU General Public License
       Modified for KISS Image Thumbnailer r19 August 2015 by @[member=raiwa]
    */

      require('includes/application_top.php');

      if (!isset($_GET['products_id'])) {
        tep_redirect(tep_href_link('index.php'));
      }
      require('includes/languages/' . $language . '/product_info.php');

      $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)$_GET['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('includes/template_top.php');

      if ($product_check['total'] < 1) {
    ?>

    <div class="contentContainer">
      <div class="contentText">
        <div class="alert alert-warning"><?php echo TEXT_PRODUCT_NOT_FOUND; ?></div>
      </div>

      <div class="pull-right">
        <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', tep_href_link('index.php')); ?>
      </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, p.products_gtin from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['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);

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

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

        if ($product_info['products_date_available'] > date('d-m-Y H:i:s')) {
          $products_price .= '<link itemprop="availability" href="http://schema.org/PreOrder" />';
        } elseif ((STOCK_CHECK == 'true') && ($product_info['products_quantity'] < 1)) {
          $products_price .= '<link itemprop="availability" href="http://schema.org/OutOfStock" />';
        } else {
          $products_price .= '<link itemprop="availability" href="http://schema.org/InStock" />';
        }

        $products_price .= '<meta itemprop="priceCurrency" content="' . tep_output_string($currency) . '" />';

        $products_name = '<a href="' . tep_href_link('product_info.php', 'products_id=' . $product_info['products_id']) . '" itemprop="url"><span itemprop="name">' . $product_info['products_name'] . '</span></a>';

        if (tep_not_null($product_info['products_model'])) {
          $products_name .= '<br /><small>[<span itemprop="model">' . $product_info['products_model'] . '</span>]</small>';
        }
    ?>

    <?php echo tep_draw_form('cart_quantity', tep_href_link('product_info.php', tep_get_all_get_params(array('action')). 'action=add_product', 'NONSSL'), 'post', 'class="form-horizontal" role="form"'); ?>

    <div itemscope itemtype="http://schema.org/Product">

    <div class="page-header">
      <div class="row"> 
        <h1 class="col-sm-8"><?php echo $products_name; ?></h1>
        <h2 class="col-sm-4 text-right-not-xs" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><?php echo $products_price; ?></h2>
      </div>
    </div>

    <?php
      if ($messageStack->size('product_action') > 0) {
        echo $messageStack->output('product_action');
      }
    ?>

    <div class="contentContainer">
      <div class="contentText">

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

          echo tep_image('images/' . $product_info['products_image'], NULL, NULL, NULL, 'itemprop="image" style="display:none;"');

          $photoset_layout = (int)MODULE_HEADER_TAGS_PRODUCT_COLORBOX_LAYOUT;

          $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
          $pi_total = tep_db_num_rows($pi_query);

          if ($pi_total > 0) {
    ?>

        <div class="piGal pull-right" data-imgcount="<?php echo $photoset_layout; ?>">

    <?php
            $pi_counter = 0;
            $pi_html = array();

            while ($pi = tep_db_fetch_array($pi_query)) {
              $pi_counter++;

              if (tep_not_null($pi['htmlcontent'])) {
                $pi_html[] = '<div id="piGalDiv_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div>';
              }

              echo tep_image('images/' . $pi['image'], '', '', '', 'id="piGalImg_' . $pi_counter . '"');
            }
    ?>

        </div>

    <?php
            if ( !empty($pi_html) ) {
              echo '    <div style="display: none;">' . implode('', $pi_html) . '</div>';
            }
          } else {
    ?>

        <div class="piGal pull-right">
          <?php echo tep_image('images/' . $product_info['products_image'], addslashes($product_info['products_name'])); ?>
        </div>

    <?php
          }
        }
    ?>
        <!--<div class="clearfix"></div>-->
    <div itemprop="description">
      <?php echo stripslashes($product_info['products_description']); ?>
    </div>

                  <?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)$_GET['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})*$/",$_GET['products_id']) ? $_GET['products_id'] : (int)$_GET['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
    ?>


        <div class="clearfix"></div>

    <?php
        if ($product_info['products_date_available'] > date('d-m-Y H:i:s')) {
    ?>

        <div class="alert alert-info"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></div>

    <?php
        }
    ?>

      </div>

    <?php
        $reviews_query = tep_db_query("select count(*) as count, avg(reviews_rating) as avgrating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$_GET['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);

        if ($reviews['count'] > 0) {
          echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><meta itemprop="ratingValue" content="' . $reviews['avgrating'] . '" /><meta itemprop="ratingCount" content="' . $reviews['count'] . '" /></span>';
        }
    ?>
    <br>
    <!-- Back Back Button Start -->
      <div class="buttonSet row">
        <div class="col-xs-4 text-left"><?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'fa fa-commenting', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?></div>
         <div class="col-xs-4 text-center">
        <?php echo tep_draw_button(IMAGE_BUTTON_BACK, 'fa fa-angle-left', tep_href_link('index.php', tep_get_path())); ?>
      </div>
      <?php
        if (($product_info['products_quantity'] <> 0) and ($product_info['products_price'] > 0)) {
    ?>
        <div class="col-xs-4 text-right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'fa fa-shopping-cart', null, 'primary', null, 'btn-success'); ?></div>
      </div>
      <?php
        } else {
    ?>
        <div class="col-xs-4 text-right"> <button class="btn btn-danger" type="button">Agotado</button></div>
    <?php
        }
    ?>
    <!-- Back Back Button End -->

      <div class="row">
        <?php echo $oscTemplate->getContent('product_info'); ?>
      </div>

    <?php
        if ((USE_CACHE == 'true') && empty($SID)) {
          echo tep_cache_also_purchased(3600);
        } else {
          include('includes/modules/also_purchased_products.php');
        }

        if ($product_info['manufacturers_id'] > 0) {
          $manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$product_info['manufacturers_id'] . "'");
          if (tep_db_num_rows($manufacturer_query)) {
            $manufacturer = tep_db_fetch_array($manufacturer_query);
            echo '<span itemprop="manufacturer" itemscope itemtype="http://schema.org/Organization"><meta itemprop="name" content="' . tep_output_string($manufacturer['manufacturers_name']) . '" /></span>';
          }
        }
    ?>

    </div>

    </div>

    </form>

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

No external links here, thank you

Link to comment
Share on other sites

@@Lioelx i tokk a look at the HTML source of your web shop and you have some broken/mixed markup. Seems that you have really a lot of modules and scripts and it's tedious to see where is/are the failures. I'd suggest disabling all modules and enabling one by one to trace the errors.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...

Nevermind - I had a trailing / after the URL in admin/includes/configure.php. This caused the URL of the ADD action to add another /, which caused a new session instance each time the attribute inventory was modified. It all works perfectly now!

 

If anybody needs help with this addon, let me know.

 

Rob Wood

Hi Rob,

 

I don;t know if you're still active on this forum but I hope so!  

 

I have just installed the QTPro 4.6.1 contribution and have exactly the same problem as you mentioned here.  However, if I remove trailing /s from the URL's in my admin/configure.php file then other things don't work properly e.g. the display is misarranged or the page isn't found (because there isn't a / where there should be in the address) or the main admin menu disappears altogether.  

 

Can you tell me which URL in your admin/configure.php file was causing you the problem? I realise it is a long time ago now but thought I would try asking anyway!

 

Thank you in advance for any help you can give.

 

Kind Regards,

 

John

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 4 months later...
3 hours ago, ckscs said:

Can anyone please tell me where i go to add stock to an attribute? I have the track stock box checked, but when i add an attribute it does not ask me for a quantity. Did i miss a code?

Hello Cliff @ckscs,

There are 3 links to the page "stock.php" where you have to add the stock for each attribute.

1. in Categories/Products, in products listing select a product, it shows the Button "Stock" on the upper right below all the other buttons.

2. In the product page, when you edit a product, it shows the Button "Stock" instead of the quantity input field

3. In admin -> reports -> stock report, each product in the list links to its "attributes Stock" page

 

And yes, you are right, this should be added to the instructions. :-)

Will do as soon as possible.

 

rgds

Rainer

 

Edited by raiwa
Link to comment
Share on other sites

17 hours ago, raiwa said:

Hello Cliff @ckscs,

There are 3 links to the page "stock.php" where you have to add the stock for each attribute.

1. in Categories/Products, in products listing select a product, it shows the Button "Stock" on the upper right below all the other buttons.

2. In the product page, when you edit a product, it shows the Button "Stock" instead of the quantity input field

3. In admin -> reports -> stock report, each product in the list links to its "attributes Stock" page

 

And yes, you are right, this should be added to the instructions. :-)

Will do as soon as possible.

 

rgds

Rainer

 

Thanks Rainer, appreciate that help!!

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