Jump to content
Nimmit

AJAX Attribute Manager support

Recommended Posts

@@satinwoods Yes, it does. There is a setting you need to change for it to work though. It is mentioned in the docs.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Tried it and I got this mess;

 

[b]Strict Standards[/b][color=#000000][font='Trebuchet MS', Arial][size=3]: Non-static method amDB::query() should not be called statically, assuming $this from incompatible context in [/size][/font][/color][b]/home/.../public_html/strutfashion.ca/admin/attributeManager/classes/attributeManagerConfig.class.php[/b][color=#000000][font='Trebuchet MS', Arial][size=3] on line [/size][/font][/color][b]143[/b]

[b]Strict Standards[/b][color=#000000][font='Trebuchet MS', Arial][size=3]: Non-static method amDB::query() should not be called statically, assuming $this from incompatible context in [/size][/font][/color][b]/home/.../public_html/strutfashion.ca/admin/attributeManager/classes/attributeManagerConfig.class.php[/b][color=#000000][font='Trebuchet MS', Arial][size=3] on line [/size][/font][/color][b]148[/b]

[b]Strict Standards[/b][color=#000000][font='Trebuchet MS', Arial][size=3]: Non-static method amDB::query() should not be called statically, assuming $this from incompatible context in [/size][/font][/color][b]/home/.../public_html/strutfashion.ca/admin/attributeManager/classes/attributeManagerConfig.class.php[/b][color=#000000][font='Trebuchet MS', Arial][size=3] on line [/size][/font][/color][b]167[/b]

 

For about 100 lines of just errors after errors

 

And yes I did go in and do this like it said to "Yo use QTpro with this contrib, you must edit attributeManager - attributeManager - classes attributeManagerConfig.class.php and edit line 65 "AM_USE_QT_PRO" to "true""

 

Did I miss something else? I read through the instructions again and I think I got everything.

 

I used v2.8.10. Was I suppose to use v2.8.7?

Edited by satinwoods

Share this post


Link to post
Share on other sites

 

But now .... if one clicks on the little green + button to add an additional option I get these errors -- you seem to get a set of errors for each option that you already have.

 

Warning: Illegal string offset 'id' in admin\includes\functions\html_output.php on line 330

Warning: Illegal string offset 'id' in admin\includes\functions\html_output.php on line 331

Warning: Illegal string offset 'text' in admin\includes\functions\html_output.php on line 335

 

and it also makes reference to the attributeManager\includes\attributeManagerPrompts.inc.php file - and this function tep_draw_pull_down_menu( ) - but now for the life of me - I have no idea of where to start looking for a fix for that.

 

the error only happens if you try to add a new option but not when you try add a new value.

 

Perhaps someone with more coding experience could find the fix for this.

 

 

This is issue occurs when sorting is activated.

 

Open /catalog/admin/attributeManager/includes/attributeManagerPrompts.inc.php

 

Change this, around line 40:

 

$optionSortDrop = array('1', '2', '3', '4', '5', '6', '7', '8', '9');
$return .= ' <tr>';
if(AM_USE_SORT_ORDER) {

 

To this:

 

 $optionSortDrop = array();
 for ($i=1; $i<=10; $i++) {
   $optionSortDrop[] = array('id' => $i, 'text' => $i);
 }
$return .= ' <tr>';
if(AM_USE_SORT_ORDER) {

Share this post


Link to post
Share on other sites

This is what seems to be working for me on osCommerce 2.3.3.2 - Apache 2.4.4, PHP 5.4.16 and MySQL 5.6.12

 

IN admin/includes/application_top.php

 

error_reporting(E_ALL & E_ERROR);

 

IN admin/attributeManager/classes/amDB.php

 

<?php
/*
==================================================================================================================
AJAX-AttributeManager-for-osc2.3.1-V2
==================================================================================================================
Addons installed in this file:
- Osc Version Upgrade from v2.3.3.1 to v2.3.3.2
==================================================================================================================
$Id: DB.class.php,v 1.0 21/02/06 Sam West$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Released under the GNU General Public License
Copyright © 2006 Kangaroo Partners
http://kangaroopartners.com
osc@[member='KangarooPartners'].com
*/
/**
* OSC Database functions wrapper - just in case they decide to release ms3 the moment i release this - he he
*/
class amDB {
/**
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @package $strQuery sting - sql query string
* @[member='Return'] query reference
*/
public static function query($strQuery) {
return tep_db_query($strQuery);
}
/**
* Fetches the next array from a mysql query reference
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $ref - referece from a mysql query
* @[member='Return'] array
*/
public static function fetchArray($ref) {
return tep_db_fetch_array($ref);
}
/**
* Gets the field count from a mysql query reference
* @[member='author'] Tomasz Iwanow aka TomaszBG - microvision@gmail.com
* @[member='param'] $ref - referece from a mysql query
* @[member='Return'] int - number of fields in result
*/
public static function numFields($ref) {
return mysqli_field_count($ref);
}
/*function numFields($ref) {
return mysql_num_fields($ref);
}
/**
* Gets the field name from a mysql query reference
* @[member='author'] Tomasz Iwanow aka TomaszBG - microvision@gmail.com
* @[member='param'] $ref - referece from a mysql query
* @[member='param'] $offset - offset of a field
* @[member='Return'] string - name of the field
*/
public static function fieldName($ref,$offset) {
return mysqli_fetch_field_direct($ref,$offset);
}
/*function fieldName($ref,$offset) {
return mysql_field_name($ref,$offset);
}
/**
* Counts the number of results from a mysql query referece
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $ref - reference from a mysql query
* @[member='Return'] int - number of rows in result
*/
public static function numRows($ref) {
return tep_db_num_rows($ref);
}
/**
* peforms inserts / updates
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $strTable string tablename
* @[member='param'] $arrData array data to be inserted/ updated
* @[member='param'] $strAction sting - update / insert
* @[member='param'] $strParams string additonal where clauses
* @[member='Return'] void
*/
public static function perform($strTable,$arrData,$strAction='insert',$strParams='') {
return tep_db_perform($strTable,$arrData,$strAction,$strParams);
}
/**
* Returns a singular result from a mysql query
* @[member='param'] $strQuery string - mysql query
* @[member='Return'] mixed - first record, first row
*/
public static function getOne($strQuery) {
$res = amDB::query($strQuery);
if ($res && amDB::numRows($res))
return tep_db_result($res,0,'next');
return false;
}
/*
function getOne($strQuery) {
$res = amDB::query($strQuery);
if ($res && amDB::numRows($res))
return mysql_result($res,0,0);
return false;
}
/**
* Returns all results from a mysql query
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $strQuery string - mysql query
* @[member='Return'] array - all results
*/
public static function getAll($strQuery) {
$res = amDB::query($strQuery);
$results = array();
while($row = amDB::fetchArray($res))
$results[] = $row;
return $results;
}
/**
* Prepares string for database input
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $str string
* @[member='Return'] void
*/
public static function input($str) {
return tep_db_prepare_input($str);
}
/**
* Returns placebo autoincrement value
* @[member='access'] public
* @[member='param'] $strTable string table name
* @[member='param'] $strField string field name
* @[member='Return'] mixed
*/
public static function getNextAutoValue($strTable,$strField) {
return (int)amDB::getOne("select max($strField) + 1 as next from $strTable limit 1");
}
/**
* Some contributions such as the Ultimate SEO URLs have there own
* database functions. This can cause the internal, last insert id to be
* wrong if the link id isn't included in the mysql_insert_id statement.
* For this reason i have not used the default osc function for this one as for some
* reason they haven't put the link in their wrapper function.
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $link sting - db link name
* @[member='Return'] void
*/
public static function insertId($link = 'db_link' ) {
global $$link;
return tep_db_insert_id($$link);
}
/*
function insertId($link = 'db_link' ) {
global $$link;
return mysql_insert_id($$link);
}*/
}
//////////////////////////////////////////////////////////////////////////////////////////////////
if ( !function_exists('mysqli_field_count') ) {
function mysqli_field_count($result) {
	 return mysql_num_fields($result);
}
}
if ( !function_exists('mysqli_fetch_field_direct') ) {
function mysqli_fetch_field_direct($result, $fieldnr) {
	 return mysql_field_name($result, $fieldnr);
}
}
?>

 

In admin/attributeManager/classes/stopDirectAccess.class.php

 

<?php
/*
$Id: stopDirectAccess.class.php,v 1.0 21/02/06 Sam West$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Released under the GNU General Public License

Copyright © 2006 Kangaroo Partners
http://kangaroopartners.com
osc@[member='KangarooPartners'].com
*/
require_once('attributeManager/includes/attributeManagerSessionFunctions.inc.php');
/**
* Try and stop direct access to the script
* As far as i know there is no way for a remote user to set a session var without high jacking the session, in which case it doesn't really matter what this script does anyway.
* If there is i will have to rethink this
*/
class stopDirectAccess {

/**
* Sets the global session variable
* @[member='static'] authorise()
* @[member='access'] public
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $sessionVar string session variable name
* @[member='Return'] void
*/
public static function authorise($sessionVar) {
amSessionRegister($sessionVar);
$GLOBALS[$sessionVar] = stopDirectAccess::makeSessionId();
}

/**
* deletes the global session variable
* @[member='static'] deAuthorise()
* @[member='access'] public
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $sessionVar string session variable name
* @[member='Return'] void
*/
public static function deAuthorise($sessionVar) {
amSessionUnregister($sessionVar);
}

/**
* Checks the session var
* @[member='static'] checkAuthorisation()
* @[member='access'] public
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='param'] $sessionVar string session variable name
* @[member='Return'] void
*/
public static function checkAuthorisation($sessionVar) {
if(!amSessionIsRegistered($sessionVar))
exit("Session not registered - You cant access this page directly");

if($GLOBALS[$sessionVar] != stopDirectAccess::makeSessionId())
exit("Session ids don't match - You cant access this page directly");

}

/**
* makes encoded session var
* @[member='static'] makeSessionId()
* @[member='access'] public
* @[member='author'] Sam West aka Nimmit - osc@[member='KangarooPartners'].com
* @[member='Return'] void
*/
public static function makeSessionId() {
return sha1(md5(AM_VALID_INCLUDE_PASSWORD));
}

}
?>

 

I've done quite a bit of testing and I havent received any further error messages.

 

Works perfectly for me now on MS 2.2 RC2a. Thanks a lot! The stopDirectAccess.class.php changes did the trick! :)

Share this post


Link to post
Share on other sites

Hi,

 

well i installed the contrib and see the "Save Product before adding options" message, when i try to add an article.

 

But when i try to edit an already saved article, nothing happens. Atrribute manager is missing. No errors, nothing. PHP error reporting is enabled.

 

However, in my local xampp installation, i see the attribute bar - everything works fine. But i am getting the

 

Deprecated: Assigning the return value of new by reference is deprecated 

 

error message. Well this message doesn't apper on my product server, too.

 

 

Well i tried to fix it and changed line 55 from:

		$attributeManager =& new attributeManagerAtomic(amGetSessionVariable(AM_SESSION_VAR_NAME));

to

		$clone = attributeManagerAtomic(amGetSessionVariable(AM_SESSION_VAR_NAME));
	$attributeManager = clone $clone;

 

I don't know, if that is the correct way! I tried to replace "=& new" with the "clone-function". It seems to work with line 55. But line

		$attributeManager =& new attributeManagerInstant($_GET['products_id']);

 

isn't so simple?!? "$test = attributeManagerInstant($_GET['products_id']);" for example does not work. I am not really a coder. But i think to disable error reporting isn't even a correct way...

 

 

But at the moment my problem is, that the ajax attribute manager section is blank!

 

greetz Crusher

 

I know this is really old, but thought I'd help anyone else running 2.2rca2 and php 5.3.

 

To get these errors fixed, simply remove the &.

 

$attributeManager = new attributeManagerAtomic(amGetSessionVariable(AM_SESSION_VAR_NAME));

 

and

 

$attributeManager = new attributeManagerInstant($_GET['products_id']);

Share this post


Link to post
Share on other sites

Hi,

 

When I have more than one attributes box the price is not anymore updated. It's working well when I have just one attribute box. Anyone knows what is wrong on my product_info.php file?

 

<?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 = '';
   }


$v_new_price = (tep_not_null($new_price) ? $new_price : '0'); // ajax attribute pricechange
   $v_products_price = (tep_not_null($product_info['products_price']) ? $product_info['products_price'] : '0'); // ajax attribute pricechange





   if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<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;?>">

    <div class="info">
<h2><?php echo $products_name; ?></h2>


<?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) {
?>
			    <div class="options">
				    <p class="options-title"><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
				    <ul class="ofh">
<?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)) {

$numberofopt = tep_db_num_rows($products_options_name_query);  
  $opt_count = 0;  
  $products_attributes = array();
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
 array_push($products_attributes,$products_options_name['products_options_id']);
    $opt_count++;



				    $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;
				    }
  ?>

<!-- SUBSTITUIDO INICIO -->	

 <li ><label><?php echo $products_options_name['products_options_name'] . ':'; ?></label><?php
 $comma = "";
 $all_option_js = "[";
 for($t = 1;$t<=$numberofopt; $t++)
 {
  $all_option_js .= $comma.'document.getElementById(\'cmbooption_'.$t.'\').value';
  $comma = ",";   
 }
 $all_option_js .= "]";	
 ?>
 <?php
 echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute,'id="cmbooption_'.$opt_count.'"  onchange="getPrice('.$v_new_price.','.$v_products_price.','.(int)$HTTP_GET_VARS['products_id'].','.$all_option_js.')"'); ?></li><br />	  

<!-- SUBSTITUIDO FIM -->		



<?php
	  }
?>
					    </ul>
				    </div>
<?php
    }
?>
<h2 class="price" id="display_price"><?php echo '<b>'.PRICE. '</b>'.$products_price; ?> <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();?>
<input type="hidden" name="optionsid" id="optionsid" value="<?php echo implode(",",$products_attributes); ?>" />
</div></h2>
					    <?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();?>



	   </div>
				   <?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	
    }
?>
		   <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);
?>


		  </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_PRODUCT. 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');
?>

Share this post


Link to post
Share on other sites

I know this is really old, but thought I'd help anyone else running 2.2rca2 and php 5.3.

 

To get these errors fixed, simply remove the &.

 

$attributeManager = new attributeManagerAtomic(amGetSessionVariable(AM_SESSION_VAR_NAME));

 

and

 

$attributeManager = new attributeManagerInstant($_GET['products_id']);

 

Bug Fix:

 

admin/attributeManager/includes/attributeManagerGeneralFunctions.inc.php

Should be

 

$attributeManager =new attributeManagerAtomic(amGetSesssionVariable(AM_SESSION_VAR_NAME));
 //$attributeManager =& new attributeManagerAtomic(amGetSessionVariable(AM_SESSION_VAR_NAME));
}
else
 //$attributeManager =& new attributeManagerInstant($_GET['products_id']);
 $attributeManager =new attributeManagerInstant($_GET['products_id']);

 

Notice no space after =new or else it will give error on osc 2.3.3.4 or modern servers ( depreciated function )

 

There was an error while retrieving the URL: Internal Server Error

 

When adding new products that have no options .

 

Regards

Joli

 

PS: No need to change the admin/attributeManager/javascript/requester.js as reported in previous posts ( unless possibiy you are having problems wiith charsets)

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

I am looking for a solution to the attribute sort order problem. The arrows do not change the sort order. When an attribute is removed and placed in order, sometimes it just pops in wherever it wants. I need the attributes to stay put. Thank you.

Share this post


Link to post
Share on other sites

Nor sure if we are taking same thing here the green arrows add the attributes and the green plus changes the sort order of the

Option Value.

 

When adding an attribute I just make sure the option value I want as first DROPDOWN is added as first. and so on and works fine occasionally for example color black will for some reason appear twice in an option dropdown on the customer page so I would then just delete and add again in admin to keep things tidy

 

The option name sort order is set in products attributes page in admin.

 

Now I did notice a bug here at least in my version I am using this with option types v2

 

when the attributes went over 10 ( EG 11 ) he done what he wanted and 11 did not appear in the 11th place

 

I solved this in my case simply by not starting the options name at 1 but instead at 01 so number 1 = 10th option name in my sort order

 

now I presume if I have over 20 option names I will probably have to start with 001

 

not sure if that will help you as my set up uses option types v2 and this may be different for you

 

PS:

 

Check in your admin/product attributes that you have no 0 value sort order as they would default to first in the sort order

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

 

Now I did notice a bug here at least in my version I am using this with option types v2

 

when the attributes went over 10 ( EG 11 ) he done what he wanted and 11 did not appear in the 11th place

 

I solved this in my case simply by not starting the options name at 1 but instead at 01 so number 1 = 10th option name in my sort order

 

now I presume if I have over 20 option names I will probably have to start with 001

 

 

The problem in in the sorting of the query in product_info.php

 

A simple order by database_field , produce following

 

1

11

2

etc

 

You can use order by ABS(database_field) to get the correct

 

1

2

11

Share this post


Link to post
Share on other sites

Thank you for your help. I am speaking of changing the sort order of the Option Value. I would like them all the same for my products, but they change places on different products for no apparent reason. I don't use numbers so don't see how I can change the sort order with a number based system. I either need to figure out how to make the sort order feature function, or find a place in the php to change the sort order.

Share this post


Link to post
Share on other sites

How do you want them sorted, Name, value, price?


OsC 2.3.4.1 CE Frozen   PHP 7.2   MySQL 10.1.36-MariaDB-cll-lve

Share this post


Link to post
Share on other sites

Updated package with a number of fixes for latest php & mysql requirements.

 

 

AJAX AttributeManager v2.8.11 released

 

+ Updated mysql function to msqli for forward compatibility (should maintain backward also)
+ removed PHP5 deprecated idiom =& new in attributeManagerGeneralFunctions.inc.php
+ Fixed PHP Strict Standards: Non-static method amDB::xxxxx() caused on PHP5.4.
+ Fixed "Illegal string offset 'id' & 'text' in html_output.php" caused by malformed array passed to tep_draw_pull_down_menu in attributeManagerPrompts.inc.php
+ Fixed more short <? PHP tags, extra commas, and missing semi-colons
+ Sync all language files and converted all files to UTF-8
+ Added some missing changelog stuff
+ Included required GNU License Statement

** All non-english Translations need at least a little more work. **
** espanol, french, german, hebrew, italian, portugues, russian **

Share this post


Link to post
Share on other sites

Hi Todd,

 

Welcome back. It's good to see you active again. :)

 

I had been planning on updating this addon since there were so many problems. I'm glad you beat me to it. :) Here is one item that still needs fixing.

 

In attributeManager/includes/attributeManagerGeneralFunctions.inc.php, it has the function call as amGetSesssionVariable (an extra s)

		$attributeManager = new attributeManagerAtomic(amGetSesssionVariable(AM_SESSION_VAR_NAME));

Share this post


Link to post
Share on other sites

Thanks Jack, yeah I saw that.  There are a couple more issues I ran into I'll address and post shortly.

Share this post


Link to post
Share on other sites

Updated package with several more fixes for latest php & mysql requirements.

 

AJAX AttributeManager v2.8.12 released


 

+ Fixed Call to undefined function amGetSesssionVariable() introduced in v2.8.11

+ Semicolon missing in: adminattributeManagerjavascriptrequester.js

+ Added UTF8 Character Encoding to the created tables for osC 2.3.x+

+ Fixed PHP Strict Standards: Only variables should be passed by reference in attributeManagerGeneralFunctions.inc.php caused on PHP5.4.

+ Various input scrubbing issues cleaned up. (I know, it's behind a login and not hugely important, but I sleep better)

+ Fixed a couple more PHP5 deprecated pass by reference issues

 

** All non-english Translations need at least a little more work. **

** espanol, french, german, hebrew, italian, portugues, russian **

Share this post


Link to post
Share on other sites

Hello,

 

Just installed your add-on (V2.8.13) in my store (V:2.3.4) and it is working great. Except one error (But it does not stop it from working)

 

-It is on the product page just below the attribute manager

 

1054 - Unknown column 'products_options.products_options_track_stock' in 'where clause'

select products_name, products_options_name as _option, products_attributes.options_id as _option_id, products_options_values_name as _value, products_attributes.options_values_id as _value_id from products_description, products_attributes, products_options, products_options_values where products_attributes.products_id = products_description.products_id and products_attributes.products_id = '79' and products_attributes.options_id = products_options.products_options_id and products_attributes.options_values_id = products_options_values.products_options_values_id and products_description.language_id = 1 and products_options_values.language_id = 1 and products_options.products_options_track_stock = 1 and products_options.language_id = 1 order by products_attributes.options_id, products_attributes.options_values_id

[TEP STOP]

 

 

Any idea how to fix it ?

 

Thanks, 

Share this post


Link to post
Share on other sites

looks like the new version by Phocea left QTPro turned on by default.  I'm assuming you don't have that contribution installed in your shop, so you need to follow the instructions in the install file for turning QTPro support on, but instead turn it off with a false.

Share this post


Link to post
Share on other sites

I Have the following problem when i wan't to add a new Option Name.

 

1062 - Duplicate entry '1-4' for key 'PRIMARY'

insert into products_options_values (products_options_values_id, language_id, products_options_values_name) values ('1', '4', 'test')

[TEP STOP]

Share this post


Link to post
Share on other sites

 

I Have the following problem when i wan't to add a new Option Name.

 

1062 - Duplicate entry '1-4' for key 'PRIMARY'

insert into products_options_values (products_options_values_id, language_id, products_options_values_name) values ('1', '4', 'test')

[TEP STOP]

 

found the bug, thanks for reporting!  Just replace and upload the /admin/attributeManager folder.  I think that should do it.
 
-------------------------------------
 
AJAX AttributeManager v2.8.14 Package Released with a couple fixes.
 
+ Turned off QT Pro plugin that was left enabled in Phocea's version
+ Fixed 1062 - Duplicate entry '1-4' for key 'PRIMARY'   insert into products_options_values (products_options_values_id, ...   in shops with osC2.2ms2 & using mysql_  PHP functions
 
** All non-english Translations need at least a little more work. **
** espanol, french, german, hebrew, italian, portugues, russian **
 
AJAX AttributeManager v2.8.14: http://addons.oscommerce.com/info/4063

Share this post


Link to post
Share on other sites

Thank you for your help. I am speaking of changing the sort order of the Option Value. I would like them all the same for my products, but they change places on different products for no apparent reason. I don't use numbers so don't see how I can change the sort order with a number based system. I either need to figure out how to make the sort order feature function, or find a place in the php to change the sort order.

 

Hi, idk if this will help anyone, but I've been having the same problem too with items sorting in weird orders for a couple of years now with different versions of this contribution. I installed the current ajax a.m. version (2.8.14) correctly on osc 2.3.4 but the 123 or abc sorts don't do anything. I seem to recall 'sort arrows' or something on previous versions that are not there now? Just as well you got rid of them, they never worked either!! haha But like Pacific101 said, sometimes the order just seems very random and the only other few contributions I have installed now (and used previously) on a vanilla store are current versions of discount coupon codes, SEO URL's, SEO header tags,and Google Sitemaps...not sure if one of them could be a culprit...

 

Anyway, I found this really old post (link below) with a slight change to product_info.php that works great for me..it sorts first by price level (lowest to high), then by the order the option was added if the price is the same (good for colors). For me, it's nice because my attributes are 'upgrade parts' that cost more money, so I need for the first one that is automatically selected to be what comes standard with the product  (usually $0...customers can take it the wrong way if they think I'm purposely trying to make them spend more money by sneaking in upgrades). Hope it helps!

 

http://forums.oscommerce.com/topic/123629-sorting-attributes/

Edited by coolfly027

Share this post


Link to post
Share on other sites

if you are not seeing the sort buttons, then you have not enabled the sort feature.  See the docs about enabling the sort feature.  Has been working for me.

Share this post


Link to post
Share on other sites

I have just moved my site to a new Server. 

 

Now everytime I try to click on a button that would call up a prompt window ( the Minus sign to remove an attribute or the + to add a new one) i get the message:

 

     "There was an error while retrieving the URL: Internal Server Error"

 

When there is no prompt, everything works fine.  I can choose an existing attribute and use the check box just fine.

 

I am running Ajax attributeManager v2.8.14. but had the same issues on v2.8.10 (on the new server... 2.8.10 worked on the old server)

 

OSC 2.2 MS2

PHP 5.3.3

Apache 2.2.15

MYSQL 5.1.73-log

 

I am at a loss here.  Any suggestions on where to look or more info needed to get a suggestion?

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

×