Latest News: (loading..)
Sign in to follow this  
Followers 0
Newtone17

stockview 1.4 not working

5 posts in this topic

Hello,

 

I am currently busy moving my oscommerce 2.2 shop to version 2.3.4.1

This is all going pretty good.

In my old shops I used the contribution stockview to copy stock levels to Excel.

I would also like to do this in version 2.3.4.1 too

However I can none of the versions I get from this addon seems to work.

All I get is the following screen:

-----------------------------------------------------------------------------------------------------------

 ".$stockview["products_id"]."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($stockview["products_quantity"]>0) { $prod_value = $stockview["products_cost"]*$stockview["products_quantity"]; $prod_total_value = $prod_total_value + $prod_value; echo "\n"; } else {echo "\n";} echo "\n"; ?>

osCommerce StockView Version 1.4
Products ID Products Name Products Model Products Status Stock Quantity Product Price Product Value
".$stockview["products_name"]." ".$stockview["products_model"]." ".$stockview["products_status"]." ".$stockview["products_quantity"]." ".$stockview["products_cost"]." ".$prod_value." 0




osCommerce Online Merchant Copyright © 2000-2017 osCommerce (Copyright and Trademark Policy)

-----------------------------------------------------------------------------------------------------------

I use:

osc version 2.3.4.1

php version 5.6.18 (I have also tried php 7.0.3 with the same result)

mysql version 5.7.11

 

Below is the code from stockview.php

-----------------------------------------------------------------------------------------

<?php
/*
  $Id: stockview.php,v 1.00 2005/03/07

  osCommerce Simple StockViewer

  Contribution based on:

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

  Copyright (c) 2002 - 2005 osCommerce

  Released under the GNU General Public License
*/

require('includes/application_top.php');

?>

<?
  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<table border="0" width="90%" cellspacing="0" cellpadding="2">
<tr>
<td class="pageHeading" align="center">osCommerce StockView Version 1.4 </td>
</tr>
<?
$prod_value = 0;
$prod_total_value=0;
?>
<tr class="dataTableHeadingRow">
    <td><b>Products ID</b></td>
    <td><b>Products Name</b></td>
    <td><b>Products Model</b></td>
    <td><b>Products Status</b></td>
    <td><b>Stock Quantity</b></td>
    <td><b>Product Price</b></td>
    <td><b>Product Value</b></td>
    </tr>
    <tr class="dataTableRow">
<?
    $stockview_query = tep_db_query("SELECT * FROM products, products_description WHERE products.products_id = products_description.products_id and products_description.language_id = '" . $languages_id . "' ORDER BY products_description.products_name");
    $stockview = tep_db_fetch_array($stockview_query);
    

    
    while ($stockview = tep_db_fetch_array($stockview_query)) {
            echo "<td class='dataTableContent'>&nbsp".$stockview["products_id"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_name"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_model"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_status"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_quantity"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_cost"]."</td>\n";
            if ($stockview["products_quantity"]>0) {
                $prod_value = $stockview["products_cost"]*$stockview["products_quantity"];
                $prod_total_value = $prod_total_value + $prod_value;
                echo "<td class='dataTableContent'>".$prod_value."</td>\n";
                }
            else
            {echo "<td class='dataTableContent'> 0 </td>\n";}
             echo "</tr>\n";
             ?>
                 <tr class="dataTableRow">
             <?        
        }
 ?>      
   </table><br /><br />
   <?
    echo "TOTAL VALUE= ".$prod_total_value;
?>
 </td></tr></table>

<br>
<!-- body_eof //-->

<!-- footer //-->
<?php   require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
<!-- footer_eof //-->
</body>
</html>

-------------------------------------------------------------------------------------------------------------------

Can the forum please help me to get this stockview.php working?

 

Greetings

GJ

 

Share this post


Link to post
Share on other sites

Hello Artcolnc

Thank you for your quick answer.

I have done the replacements and now it works.

For other people having this problem, below is the edited stockview.php

The only question I have now is: why does it work now? What is the difference between <? and <?php? Has is something to do with the php version?

Greetings,

GJ

-----------------------------------------------------------------------------------------------------------------------------------

<?php
/*
  $Id: stockview.php,v 1.00 2005/03/07

  osCommerce Simple StockViewer

  Contribution based on:

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

  Copyright (c) 2002 - 2005 osCommerce

  Released under the GNU General Public License
*/

require('includes/application_top.php');

?>

<?php
  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<table border="0" width="90%" cellspacing="0" cellpadding="2">
<tr>
<td class="pageHeading" align="center">osCommerce StockView Version 1.4 </td>
</tr>
<?php
$prod_value = 0;
$prod_total_value=0;
?>
<tr class="dataTableHeadingRow">
    <td><b>Products ID</b></td>
    <td><b>Products Name</b></td>
    <td><b>Products Model</b></td>
    <td><b>Products Status</b></td>
    <td><b>Stock Quantity</b></td>
    <td><b>Product Price</b></td>
    <td><b>Product Value</b></td>
    </tr>
    <tr class="dataTableRow">
<?php
    $stockview_query = tep_db_query("SELECT * FROM products, products_description WHERE products.products_id = products_description.products_id and products_description.language_id = '" . $languages_id . "' ORDER BY products_description.products_name");
    $stockview = tep_db_fetch_array($stockview_query);
    

    
    while ($stockview = tep_db_fetch_array($stockview_query)) {
            echo "<td class='dataTableContent'>&nbsp".$stockview["products_id"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_name"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_model"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_status"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_quantity"]."</td>\n";
            echo "<td class='dataTableContent'>".$stockview["products_cost"]."</td>\n";
            if ($stockview["products_quantity"]>0) {
                $prod_value = $stockview["products_cost"]*$stockview["products_quantity"];
                $prod_total_value = $prod_total_value + $prod_value;
                echo "<td class='dataTableContent'>".$prod_value."</td>\n";
                }
            else
            {echo "<td class='dataTableContent'> 0 </td>\n";}
             echo "</tr>\n";
             ?>
                 <tr class="dataTableRow">
             <?php        
        }
 ?>    
   </table><br /><br />
   <?php
    echo "TOTAL VALUE= ".$prod_total_value;
?>
 </td></tr></table>

<br>
<!-- body_eof //-->

<!-- footer //-->
<?php   require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
<!-- footer_eof //-->
</body>
</html>

Share this post


Link to post
Share on other sites

it is to do with short_open_tag and whether your server allows short tags.

This is a setting in php.ini on the server

Share this post


Link to post
Share on other sites

@Newtone17

Two things ...

1) If you are moving an old store, please be sure you are moving it to 2.3.4 Edge, the community supported, responsive version of osCommerce. The last "official" version of osC (2.3.4.1) is obsolete, and will not display well on phones, tablets, etc.  You can download Edge here:

https://github.com/gburton/Responsive-osCommerce/archive/master.zip

2) When someone answers your questions, please be sure to 'Like' their answer(s).

Malcolm

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
Sign in to follow this  
Followers 0