Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Article Manager v1.0


RobAnderson

Recommended Posts

There doesn't appear to be anything in the error logs related to this addon. I have installed it twice now with the same result so I can only assume the latest version on OSCs site is missing parts. Which file do you think the part would be missing from? I could try trace back through older versions then to compare.

Edited by AusFiero
Link to comment
Share on other sites

It seems to be cutting off the code at that point in the page. Here is the bottom of the file if I look at the source. 

 

<td class="smallText" align="right">

<form name="search" action="http://oscommerce.xxxxxx.com.au/oscadmin/articles.php"method="get">Search: <input type="text" name="search" /></form>                </td>
                <td class="smallText" align="right">
<form name="goto" action="http://oscommerce.xxxxxx.com.au/oscadmin/articles.php"method="get">
Link to comment
Share on other sites

Do any of the other sections in Article Manger work, like Authors? If none of them work, then it is something common to them all. If it is only the one page, then it has something to do with that page.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Do any of the other sections in Article Manger work, like Authors? If none of them work, then it is something common to them all. If it is only the one page, then it has something to do with that page.

Yes other sections work. I have added an author and everything appears right in the rest of it. I have tried replacing the code for that page with 3 different versions but to no avail. 

 

It is a development site. I could give you access for a look at the code if you like. 

Link to comment
Share on other sites

Then there is something in that file that is failing. In the admin/articles.php file, find the includes(application_top.php line and add this code beneath it

  error_reporting(E_ALL);  
  ini_set('display_errors','1'); 

Then go to that page and see if any failures are reported.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Notice: Undefined variable: SID in /home2/internet/oscommerce/responsive/oscadmin/includes/functions/html_output.php on line 48 is the error

 

The line is shown below

 

46      // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined

47          if ( ($add_session_id == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
48            if (tep_not_null($SID)) {
49              $_sid = $SID;
50        } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
51              if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
52                $_sid = tep_session_name() . '=' . tep_session_id();
53              }
54            }
55          }
 
I just changed if
( ($add_session_id == true)
to false and all errors disappeared.
 
But still no buttons and the code still cuts off at 
<form name="goto" action="http://oscommerce.xxxx.com.au/admin/articles.php"method="get">
Edited by AusFiero
Link to comment
Share on other sites

I even tried replacing the html_output.php file with standard one and no errors, but no buttons. 

 

Back on page 91 of this thread a guy seemed to have exactly the same problem. 

Edited by AusFiero
Link to comment
Share on other sites

A notice, which is what that is, won't stop the code from working. If there was something causing it to fail, the message would say error. Usually it is the last one shown. Is that notice message the only message displayed?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

Hi gang,

 

I am getting a strange error from the admin > Cross-Sell Articles page:

"Warning: mysql_fetch_row() expects parameter 1 to be resource, object given in /home/.../admin/articles_xsell.php on line 55"

 

Seems to be related to this section of code, from admin/articles_xsell.php

    /* general_db_conct($query) function */    /* calling the function:  list ($test_a, $test_b) = general_db_conct($query); */
    function general_db_conct($query_1)
    {
      $result_1 = tep_db_query($query_1) or die($query_1."error 1:".mysql_error());
      $num_of_rows = tep_db_num_rows($result_1) or die($result_1."error 2:".mysql_error());
      $a_to_pass = array();
      for ($i=0;$i<$num_of_rows;++$i)
      {
        $fields = mysql_fetch_row($result_1);
        $a_to_pass[$i]= $fields[$y=0];
        $b_to_pass[$i]= $fields[++$y];
        $c_to_pass[$i]= $fields[++$y];
        $d_to_pass[$i]= $fields[++$y];
        $e_to_pass[$i]= $fields[++$y];
        $f_to_pass[$i]= $fields[++$y];
        $g_to_pass[$i]= $fields[++$y];
        $h_to_pass[$i]= $fields[++$y];
        $i_to_pass[$i]= $fields[++$y];
        $j_to_pass[$i]= $fields[++$y];
        $k_to_pass[$i]= $fields[++$y];
        $l_to_pass[$i]= $fields[++$y];
        $m_to_pass[$i]= $fields[++$y];
        $n_to_pass[$i]= $fields[++$y];
        $o_to_pass[$i]= $fields[++$y];
      }
    return array($a_to_pass,$b_to_pass,$c_to_pass,$d_to_pass,$e_to_pass,$f_to_pass,$g_to_pass,$h_to_pass,$i_to_pass,$j_to_pass,$k_to_pass,$l_to_pass,$m_to_pass,$n_to_pass,$o_to_pass);
    }//end of function

This worked on my previous 2.2 osCommerce, running an older version of PHP and mySQL.

I am running  PHP version 5.4.38 and MySQL version 5.5.40-36.; but, I don't see the problem.

 

Any advice?

Link to comment
Share on other sites

Then you are using mysqli and the code is setup to work with MySQL. You can try changing all of the MySQL instances in the file to mysqli and it may work though I'm not sure there is a direct replacement for them all.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I made some changes, and was able to connect to DB and generate Xsell table; but, the code fails after a 7 entries, with the following error:

Catchable fatal error: Object of class mysqli_result could not be converted to string in /admin/articles_xsell.php on line 66

    /* general_db_conct($query) function */
    /* calling the function:  list ($test_a, $test_b) = general_db_conct($query); */
    function general_db_conct($query_1)
    {
	//	$link = tep_db_connect();
	$link = new mysqli(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE);

	/* check connection */
	  if (mysqli_connect_errno()) {
    	printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
	  }
		
      //$result_1 = mysqli_query($link,$query_1) or die($result_1.$query_1."error 1:".mysql_error()); 
	  /* Select queries return a resultset */
		if ($result_1 = mysqli_query($link, $query_1)) {
			printf("Select returned %d rows.\n", mysqli_num_rows($result_1));
	  
      $num_of_rows = mysqli_num_rows($result_1) or die($result_1.$query_1."error 2:".mysql_error());
	  //printf("Select returned %d rows.\n", mysqli_fetch_row($result_1));
      $a_to_pass = array();
      for ($i=0;$i<$num_of_rows;++$i)
      {
        $fields = mysqli_fetch_row($result_1);
        $a_to_pass[$i]= $fields[$y=0];
        $b_to_pass[$i]= $fields[++$y];
        $c_to_pass[$i]= $fields[++$y];
        $d_to_pass[$i]= $fields[++$y];
        $e_to_pass[$i]= $fields[++$y];
        $f_to_pass[$i]= $fields[++$y];
        $g_to_pass[$i]= $fields[++$y];
        $h_to_pass[$i]= $fields[++$y];
        $i_to_pass[$i]= $fields[++$y];
        $j_to_pass[$i]= $fields[++$y];
        $k_to_pass[$i]= $fields[++$y];
        $l_to_pass[$i]= $fields[++$y];
        $m_to_pass[$i]= $fields[++$y];
        $n_to_pass[$i]= $fields[++$y];
        $o_to_pass[$i]= $fields[++$y];
      }
    return array($a_to_pass,$b_to_pass,$c_to_pass,$d_to_pass,$e_to_pass,$f_to_pass,$g_to_pass,$h_to_pass,$i_to_pass,$j_to_pass,$k_to_pass,$l_to_pass,$m_to_pass,$n_to_pass,$o_to_pass);
	
			/* free result set */
			mysqli_free_result($result_1);
		}
    }//end of function

Any thoughts?

Link to comment
Share on other sites

Try replacing this

 $num_of_rows = mysqli_num_rows($result_1) or die($result_1.$query_1."error 2:".mysql_error());

with this

 $num_of_rows = mysqli_num_rows($result_1);

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks Jack, that totally fixed it. I had too many troubleshooters going (and some in the wrong place).

 

New working function for osCommerce 2.3.4 Boostrap:

    /* general_db_conct($query) function */
    /* calling the function:  list ($test_a, $test_b) = general_db_conct($query); */
    function general_db_conct($query_1)
    {
	//	$link = tep_db_connect();
	$link = new mysqli(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE);

	/* check connection */
	  if (mysqli_connect_errno()) {
    	printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
	  }
		
	  /* Select queries return a resultset */
		if ($result_1 = mysqli_query($link, $query_1)) {	  
		  $num_of_rows = mysqli_num_rows($result_1);
		  $a_to_pass = array();
		  for ($i=0;$i<$num_of_rows;++$i)
		  {
			$fields = mysqli_fetch_row($result_1);
			$a_to_pass[$i]= $fields[$y=0];
			$b_to_pass[$i]= $fields[++$y];
			$c_to_pass[$i]= $fields[++$y];
			$d_to_pass[$i]= $fields[++$y];
			$e_to_pass[$i]= $fields[++$y];
			$f_to_pass[$i]= $fields[++$y];
			$g_to_pass[$i]= $fields[++$y];
			$h_to_pass[$i]= $fields[++$y];
			$i_to_pass[$i]= $fields[++$y];
			$j_to_pass[$i]= $fields[++$y];
			$k_to_pass[$i]= $fields[++$y];
			$l_to_pass[$i]= $fields[++$y];
			$m_to_pass[$i]= $fields[++$y];
			$n_to_pass[$i]= $fields[++$y];
			$o_to_pass[$i]= $fields[++$y];
		  }
		return array($a_to_pass,$b_to_pass,$c_to_pass,$d_to_pass,$e_to_pass,$f_to_pass,$g_to_pass,$h_to_pass,$i_to_pass,$j_to_pass,$k_to_pass,$l_to_pass,$m_to_pass,$n_to_pass,$o_to_pass);
	
		/* free result set */
		mysqli_free_result($result_1);
	  }
    }//end of function

This may not be the best looking code, but it works. Feel free to improve, as you see fit,

Link to comment
Share on other sites

Here's a little update to offer Select All functionality to the Cross-Sell Articles to Products page:

<?php
/*
  $Id: articles_xsell.php,v 1.1 2006/03/07 08:42:49 tni001 Exp $

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

  Copyright (c) 2003 osCommerce
  Portions Copyright 2009 http://www.oscommerce-solution.com

  cross.sale.php created By Isaac Mualem [email protected]

  Modified by Andrew Edmond ([email protected])
  Sept 16th, 2002

  Further Modified by Rob Anderson 12 Dec 03

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

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

<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
          </tr>
        </table></td>
     </tr>
     <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<!-- body_text //-->
    <td width="100%" valign="top">
      <!-- Start of cross sale //-->

      <table width="100%" border="0" cellpadding="0"  cellspacing="0">
        <tr><td align=left>
        <?php
    /* general_db_conct($query) function */
    /* calling the function:  list ($test_a, $test_b) = general_db_conct($query); */
    function general_db_conct($query_1)
    {
	//	$link = tep_db_connect();
	$link = new mysqli(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD,DB_DATABASE);

	/* check connection */
	  if (mysqli_connect_errno()) {
    	printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
	  }
		
	  /* Select queries return a resultset */
		if ($result_1 = mysqli_query($link, $query_1)) {	  
		  $num_of_rows = mysqli_num_rows($result_1);
		  $a_to_pass = array();
		  for ($i=0;$i<$num_of_rows;++$i)
		  {
			$fields = mysqli_fetch_row($result_1);
			$a_to_pass[$i]= $fields[$y=0];
			$b_to_pass[$i]= $fields[++$y];
			$c_to_pass[$i]= $fields[++$y];
			$d_to_pass[$i]= $fields[++$y];
			$e_to_pass[$i]= $fields[++$y];
			$f_to_pass[$i]= $fields[++$y];
			$g_to_pass[$i]= $fields[++$y];
			$h_to_pass[$i]= $fields[++$y];
			$i_to_pass[$i]= $fields[++$y];
			$j_to_pass[$i]= $fields[++$y];
			$k_to_pass[$i]= $fields[++$y];
			$l_to_pass[$i]= $fields[++$y];
			$m_to_pass[$i]= $fields[++$y];
			$n_to_pass[$i]= $fields[++$y];
			$o_to_pass[$i]= $fields[++$y];
		  }
		return array($a_to_pass,$b_to_pass,$c_to_pass,$d_to_pass,$e_to_pass,$f_to_pass,$g_to_pass,$h_to_pass,$i_to_pass,$j_to_pass,$k_to_pass,$l_to_pass,$m_to_pass,$n_to_pass,$o_to_pass);
	
		/* free result set */
		mysqli_free_result($result_1);
	  }
    }//end of function

        // first major piece of the program
        // we have no instructions, so just dump a full list of products and their status for cross selling

    if (! isset($_GET['add_related_article_ID']) )
    {
        $query = "select a.articles_id, ad.articles_name, ad.articles_description, ad.articles_url from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_DESCRIPTION . " ad where ad.articles_id = a.articles_id and ad.language_id = '" . (int)$languages_id . "' order by ad.articles_name";
        list ($articles_id, $articles_name, $articles_description, $articles_url) = general_db_conct($query);
    ?>

      <table border="0" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
        <tr class="dataTableHeadingRow">
          <td class="dataTableHeadingContent" align="center" nowrap>ID</td>
          <td class="dataTableHeadingContent"><?php echo HEADING_ARTICLE_NAME; ?></td>
          <td class="dataTableHeadingContent" nowrap><?php echo HEADING_CROSS_ASSOCIATION; ?></td>
          <td class="dataTableHeadingContent" colspan="3" align="center" nowrap><?php echo HEADING_CROSS_SELL_ACTIONS; ?></td>
        </tr>
         <?php
         $num_of_articles = sizeof($articles_id);
          for ($i=0; $i < $num_of_articles; ++$i)
          {
             /* now we will query the DB for existing related items */
             $query = "select pd.products_name, ax.xsell_id from " . TABLE_ARTICLES_XSELL . " ax, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = ax.xsell_id and ax.articles_id ='".$articles_id[$i]."' and pd.language_id = '" . (int)$languages_id . "' order by ax.sort_order";
             list ($Related_items, $xsell_ids) = general_db_conct($query);

             echo "<tr bgcolor='#FFFFFF'>";
             echo "<td class=\"dataTableContent\" valign=\"top\"> ".$articles_id[$i]." </td>\n";
             echo "<td class=\"dataTableContent\" valign=\"top\"> ".$articles_name[$i]." </td>\n";
             if ($Related_items)
             {
               echo "<td  class=\"dataTableContent\"><ol>";
               foreach ($Related_items as $display)
                 echo '<li>'. $display .' ';
                 echo"</ol></td>\n";
             }
             else
                 echo "<td class=\"dataTableContent\">--</td>\n";

             echo '<td class="dataTableContent"  valign="top"> <a href="' . tep_href_link(FILENAME_ARTICLES_XSELL, 'add_related_article_ID=' . $articles_id[$i], 'NONSSL') . '">Add/Remove</a></td>';

             if (count($Related_items)>1)
             {
               echo '<td class="dataTableContent" valign="top"> <a href="' . tep_href_link(FILENAME_ARTICLES_XSELL, 'sort=1&add_related_article_ID=' . $articles_id[$i], 'NONSSL') . '">' . TEXT_SORT . '</a> </td>';
             } else {
               echo "<td class=\"dataTableContent\" valign=top align=center>--</td>";
             }
             echo "</tr>\n";
             unset($Related_items);
          }
          ?>

      </table>
      <?php
      }   // the end of -> if (!$_POST['add_related_article_ID'])


    if ($_POST && ! isset($_GET['sort']))
    {
      if ($_POST['run_update'])
      {
        $ids = ' ( ';
        for ($x = 0; $x < count($_POST['xsell_id']); ++$x) {
           $ids .= ' xsell_id = ' . (int)$_POST['xsell_id'][$x] . ' or ';
        }
        $ids = substr($ids, 0, -3);
        $ids .= ' ) ';

        $ids = (count($_POST['xsell_id']) ? ' and ' . $ids : ''); //clear if list not present

        $query ="DELETE FROM " . TABLE_ARTICLES_XSELL . " WHERE articles_id = '".(int)$_POST['add_related_article_ID']."'" . $ids;
        if (!tep_db_query($query))
          exit(TEXT_NO_DELETE);
      }
      else if (isset($_POST['xsell_id']))
      {
        $id = $_GET['add_related_article_ID'];
        foreach ($_POST['xsell_id'] as $temp)
        {
          $query = "INSERT INTO " . TABLE_ARTICLES_XSELL . " VALUES ('',$id,$temp,1)";
          if (!tep_db_query($query))
            exit(TEXT_NO_INSERT);
        }
      }
      ?>
                <tr>
                  <td class="main"><?php echo TEXT_DATABASE_UPDATED; ?></td>
                </tr>
                <tr>
                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                </tr>
                <tr>
                  <td class="main"><?php echo sprintf(TEXT_LINK_SORT_PRODUCTS, tep_href_link(FILENAME_ARTICLES_XSELL, '&sort=1&add_related_article_ID=' . (int)$_POST['add_related_article_ID'], 'NONSSL')); ?></td>
                </tr>
                <tr>
                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                </tr>
                <tr>
                  <td class="main"><?php echo sprintf(TEXT_LINK_MAIN_PAGE, tep_href_link(FILENAME_ARTICLES_XSELL, '', 'NONSSL')); ?></td>
                </tr>
                <tr>
                  <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                </tr>
    <?php

//    if ($_POST[xsell_id])
    //  echo '<a href="' . tep_href_link(FILENAME_ARTICLES_XSELL, 'sort=1&add_related_article_ID=' . $_POST[add_related_article_ID], 'NONSSL') . '">Click here to sort (top to bottom) the added cross sale</a>' . "\n";
    }

    if (isset($_GET['add_related_article_ID']) && ! $_POST && ! isset($_GET['sort']))
    {
        echo tep_draw_form('goto', "articles_xsell.php", '', 'get') . tep_hide_session_id();
        echo '<input type="hidden" name="add_related_article_ID" value="'.(int)$_GET['add_related_article_ID'].'" />';
           echo SELECT_CATEGORY ." :" . tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
            echo '</form>';
        if (isset($_GET['cPath'])) {
        ?>

      <table border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
               <form name="selections" action="<?php tep_href_link(FILENAME_ARTICLES_XSELL, '', 'NONSSL'); ?>" method="post">
                <tr class="dataTableHeadingRow">
                  <td class="dataTableHeadingContent"><input type="checkbox" id="selectall" /></td>
                  <td class="dataTableHeadingContent" nowrap>ID</td>
                  <td class="dataTableHeadingContent"><?php echo HEADING_PRODUCT_NAME; ?></td>
                </tr>

                <?php
        $query = "select p.products_id, pd.products_name, pd.products_description, pd.products_url from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p2c.categories_id='".tep_db_input((int)$_GET['cPath'])."' and pd.products_id = p.products_id and p2c.products_id=p.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name ";

            list ($products_id, $products_name, $products_description, $products_url  ) = general_db_conct($query);
            $num_of_products = sizeof($products_id);
            $query = "select * from " . TABLE_ARTICLES_XSELL . " where articles_id = '".(int)$_GET['add_related_article_ID']."'";
            list ($ID_PR, $products_id_pr, $xsell_id_pr) = general_db_conct($query);
            $run_update=false; // set to false to insert new entry in the DB

            for ($i=0; $i < $num_of_products; ++$i)
            {
            ?><tr bgcolor="#FFFFFF"  onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
                <td class="dataTableContent"><input
                <?php /* this is to see it it is in the DB */
                if ($xsell_id_pr)
                {
                  foreach ($xsell_id_pr as $compare_checked)
                  {
                    if ($products_id[$i]===$compare_checked)
                    {
                      echo "checked";
                      $run_update=true;
                    }
                  }
                }
                ?> size="20" size="20" class="checkbox1" name="xsell_id[]" type="checkbox" value="<?php echo $products_id[$i]; ?>">
                </td>

            <?php echo "<td  class=\"dataTableContent\" align=center>".$products_id[$i]."</td>\n"
                ."<td class=\"dataTableContent\">".$products_name[$i]."</td>\n";
            }
            ?>

            <tr>
              <td> </td>
              <td> </td>
              <td bgcolor="#CCCCCC">
            <?php

            // list also those products not in current category
            $myquery = "SELECT ax.xsell_id AS nid FROM " . TABLE_ARTICLES_XSELL . " ax, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c WHERE ax.articles_id='".(int)$_POST['add_related_article_ID']."' AND ax.xsell_id=p2c.products_id AND categories_id!='".tep_db_input((int)$_GET['cPath'])."'";
            $myids_query = tep_db_query($myquery);
            ?> <div style="display:none"> <?php
            while ($tempid = tep_db_fetch_array($myids_query)) {
                echo  '<input type="checkbox" name="xsell_id[]" value="'.$tempid['nid'].'" checked>';
            }
            ?></div>
                        <input type="hidden" name="run_update" value="<?php echo $run_update; ?>">
                        <input type="hidden" name="add_related_article_ID" value="<?php echo (int)$_GET['add_related_article_ID']; ?>">
                        <?php  echo tep_image_submit('button_save.gif', IMAGE_SAVE) . '  <a href="' . tep_href_link(FILENAME_ARTICLES_XSELL) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?>
                      </td>
                </tr>
              </form>
            </table>
        <?php }
        }
        // sort routines

    if (isset($_GET['sort']) && $_GET['sort'] == 1)
    {
    //  first lets take care of the DB update.
      $run_once=0;

      if ($_POST)
      {
        foreach ($_POST as $key_a => $value_a)
        {
          tep_db_connect();
          $query = "UPDATE " . TABLE_ARTICLES_XSELL . " SET sort_order = '".$value_a."' WHERE xsell_id= '$key_a' ";
          if ($value_a != 'Update')
              if (!tep_db_query($query))
                  exit(TEXT_NO_UPDATE);
              else
                  if ($run_once==0)
                  { ?>
                  <tr>
                    <td class="main"><?php echo TEXT_DATABASE_UPDATED; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo sprintf(TEXT_LINK_MAIN_PAGE, tep_href_link(FILENAME_ARTICLES_XSELL, '', 'NONSSL')); ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                  </tr>
              <?php
              $run_once++;
              }

        }// end of foreach.
      }
    ?>
    <form method="post" action="<?php tep_href_link(FILENAME_ARTICLES_XSELL, 'sort=1&add_related_article_ID=' . $_POST['add_related_article_ID'], 'NONSSL'); ?>">
              <table cellpadding="3" cellspacing="1" bgcolor="#CCCCCC" border="0">
                <tr class="dataTableHeadingRow">
                  <td class="dataTableHeadingContent">ID</td>
                  <td class="dataTableHeadingContent"><?php echo HEADING_PRODUCT_NAME; ?></td>
                  <td class="dataTableHeadingContent"><?php echo HEADING_PRODUCT_ORDER; ?></td>
                </tr>
                <?php
                $query = "select * from " . TABLE_ARTICLES_XSELL . " where articles_id = '".(int)$_GET['add_related_article_ID']."'";
                list ($ID_PR, $products_id_pr, $xsell_id_pr, $order_PR) = general_db_conct($query);
                $ordering_size =sizeof($ID_PR);
                for ($i=0;$i<$ordering_size;++$i)
                    {

        $query = "select p.products_id, pd.products_name, pd.products_description, pd.products_url from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = ".$xsell_id_pr[$i]."";

                    list ($products_id, $products_name, $products_description, $products_url) = general_db_conct($query);

                    ?>
                    <tr class="dataTableContentRow" bgcolor="#FFFFFF">
                      <td class="dataTableContent"><?php echo $products_id[0]; ?></td>
                      <td class="dataTableContent"><?php echo $products_name[0]; ?></td>
                      <td class="dataTableContent" align="center"><select name="<?php echo $products_id[0]; ?>">
                          <?php for ($y=1;$y<=$ordering_size;++$y)
                                {
                                echo "<option value=\"$y\"";
                                    if (!(strcmp($y, "$order_PR[$i]"))) {echo "SELECTED";}
                                    echo ">$y</option>";
                                }
                                ?>
                        </select></td>
                    </tr>
                    <?php } // the end of foreach
                    ?>
                <tr>
                  <td> </td>
                  <td bgcolor="#CCCCCC"><?php echo tep_image_submit('button_save.gif', IMAGE_SAVE) . '  <a href="' . tep_href_link(FILENAME_ARTICLES_XSELL) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
                  <td> </td>
                </tr>
              </table>
            </form>

            <?php }?>


          </td>
        </tr>
    </table>
    <!-- End of cross sale //-->
    </td>
</tr></table>

<script type="text/javascript">
$(document).ready(function() {
    $('#selectall').click(function(event) {  //on click 
        if(this.checked) { // check select status
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = true;  //select all checkboxes with class "checkbox1"               
            });
        }else{
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = false; //deselect all checkboxes with class "checkbox1"                       
            });         
        }
    });
    
});</script>
<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Script is at the end.

Select All Checkbox: line 208

Select All Inputs: line 238

 

Hope this is useful to someone.

Link to comment
Share on other sites

  • 2 months later...

Is there anywhere I can see a demo of article manager running?

 

I know it says "Screen captures are included in a separate download." but I can't find that other download

 

 

EDIT: Nevermind, I found it. lol

Edited by mlopes
Link to comment
Share on other sites

  • 8 months later...

Problem 1:

For articles with Blog Status = True, when view from shop front the Header Tags SEO will not show their SEO web links entered in Page Control > article_blog.php?articles_id=n

However when article is switched to non-Blog, shop front showed the entered SEO title.  Is this a bug or any resolution?

 

Problem 2:

From shop front when click on Articles > All Blog Articles, All Articles & All Topics, all did not display their SEO web links. A bug or how to solve?

 

Good news is all articles with blog status off will dutifully show their corresponding Page Control SEO link.

 

Jack, you are the greatest, thank you for all these great contributions!  Also thanks to all above for posting solutions.

Thks & Regards,

Zaccoco

Link to comment
Share on other sites

@@ZacCoco I wasn't aware of this so thanks for mentioning it. I looked at it and it is because of the way the code is being added for the pseudo pages. The new version of Header Tags SEO has code in it to handle the pseudo pages differently so that might fix the problems. But I don't have that version installed in a shop with Article Manager so I can't test it. I had planned on releasing the latest version soon but I will postpone that until I can fix this problem. I don't know when that will be but, hopefully, within a month.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Problem 3:

When click on any blog articles, the Products Related To This Article will not be shown whereas x-sell products are shown for all non-blog articles.  Wouldn't it be good to show in blog articles too?

 

Problem 4:

X-Sell Articles to Product can either add or remove, what about modify?

 

Problem 5:

Even though everyone needs to create an account > login before allowed to post an article/comment/review, as Admin I may not know who they really are as the data captured (pen names) are not back-linked to their corresponding customer accounts. 

 

Good to have features:

- 1 article to multiple authors.

- Header Tags SEO input directly from articles page.

- Maximum All Blog Articles & All Articles per left_column display. 

 

Jack, thanks in advance for the new version of Header Tags SEO that might resolve problems 1 & 2.

Thks & Regards,

Zaccoco

Link to comment
Share on other sites

For #4, I don't understand what you want to do. All that code does is add or remove a product. If you want to change which products are in the list, just click Add/Remove and select or unselect what you want. If that is not what you mean, please explain in more detail.

 

For Maximum All Blog Articles & All Articles per left_column display, I don't understand this one.

 

I will look at the other problems you mention and I like some of the suggestions. This addon is long overdue for an update. I have a version I use for installations that has fixes/changes in it but it is not ready to be released. I will plan on doing this one once Header Tags SEO has been updated. Thank you for all of your input.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

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