Jump to content
Nimmit

AJAX Attribute Manager support

Recommended Posts

I think I am going to give up on this contribution until someone can come up with a solution to the consistent problems that people seem to be having with the sort field.

 

Shame as it is very useful.

 

:(

Share this post


Link to post
Share on other sites
I believe I found the correct sort contribution that adds the SQL inquestion:

 

see http://www.oscommerce.com/community/contri...s+Sorter+Copier

 

Did you ever get this contribtion working fully?

 

There are people who are having lots of bother with it but noone seems to be able to help.

 

Here's hoping you can help me and others who are having a problem. :rolleyes:

Share this post


Link to post
Share on other sites

I am trying to use this too.

For now I sort the attributes on the product_info.php page like this - around line 150:

 

$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 . "' order by pov.products_options_values_name asc");

 

I know it doesn't solve all - but at least the customers can see it nice

 

Helle :-)

Share this post


Link to post
Share on other sites
I do not know why this functions, but functioned... In attributeManager.php, find:

 

// db wrapper
require_once('classes/amDB.class.php');

// session functions
require_once('includes/attributeManagerSessionFunctions.inc.php');

 

Change to:

 

// db wrapper
if(class_exists("amDB"))
require_once('classes/amDB.class.php');

// session functions
if(function_exists("amSessionUnregister"))
require_once('includes/attributeManagerSessionFunctions.inc.php');

 

Your contribuition is very cool!!

 

Thanks!

 

Adriano

Same problem here.

Fatal error: Cannot redeclare class amdb in .....\admin\attributeManager\classes\amDB.class.php on line 18

Thanx for your solution.

I think it is for php version.

Edited by opurahman

Arafat Rahman

Web Developer

Dhaka, Bangladesh

Share this post


Link to post
Share on other sites

I have posted the latest version I am working on which should work for everyone.

Up to you thereafter to turn on the sort order support or not it is set to false by default

Share this post


Link to post
Share on other sites

Hello,

 

I have just installed Version 2.3 beta and I have a little problem. When I want to add an option to a product I get redirected to the product_preview page and the option is not added to the attributes. If the product allread has attributes and I want to add another value it is no problem.

Am I doing something wrong or is it not installed corecctly?

 

Alex

Share this post


Link to post
Share on other sites

Wolfalex, try the new update should be ok.

Thanks for the feedback. problem was when sort order was not used I missed a couple of spots where code needed to be change.

Should be ok now.

Share this post


Link to post
Share on other sites

Phocea - Thanks for taking this one on, I don't seem to be able to find the time these days. If you get it stable, please feel free to take it out of beta, I can't realistically see myself delving back into it. Thanks again, Nimmit :thumbsup:


Knowledge is knowing that a tomato is a fruit, wisdom is not putting one in a fruit salad :D

Share this post


Link to post
Share on other sites

No problem, I think it is a way before it comes out of beta. Adding the edit, delete functionality like you intended should be pretty easy since you left the ground work to do so.

 

Addin QT Pro plugin functionality is however giving me grief at the moment.

 

Thanks for the original code anyway, it is very clearly coded and following OO coding to the letter (or as mush as PHP4 let u !)

Share this post


Link to post
Share on other sites

I get

1054 - Unknown column 'products_options_sort_order' in 'order clause'

What sql query needs to be executed to get this thing to work?

 

I added this sql query

ALTER TABLE products_attributes ADD products_options_sort_order int(6) NOT NULL default '0' AFTER price_prefix;

ALTER TABLE products_options_values_to_products_options ADD products_options_values_sort_order int(6) NOT NULL default '0' AFTER products_options_values_id;


Andrew Yuen

osCommerce, Community Team

Share this post


Link to post
Share on other sites

The sorting is not part of this contribution, it is to be used if you have installed one of the numerous attribute sorting contribution existing.

 

 

The code you are refering to is from this contribution:

http://www.oscommerce.com/community/contri...,attribute+sort

So it should be fine.

 

The point of the config area is that people can choose which contribution to use or have already use and change the name of the field accordingly

Share this post


Link to post
Share on other sites

I really like the concept of Ajax, but I really need to fill in a filename - I have lots of downloads....

 

This Attributes Copier - does it also copy the "file field" ??

 

Helle :-)

Share this post


Link to post
Share on other sites

Hi Greg,

 

Thanks for the reply. I still get

1054 - Unknown column 'products_options_sort_order' in 'order clause'

 

After running that sql query. This was my original question, I may not have worded clearly. How would I go about fixing this 1054 error?

 

Thanks


Andrew Yuen

osCommerce, Community Team

Share this post


Link to post
Share on other sites

:::::andyy15

 

Did you remember to read the lines at the bottom in the install.htm??

I think I had the same error

 

all I did was putting // in front of those two lines

Hope it helps you

 

Helle :-)

 

admin/attributeManager/classes/attributeManagerConfig.class.php

Find (Around line 65)

 

$this->add('AM_FIELD_OPTION_SORT_ORDER','products_options_sort_order'); // Sort column on Products_options table

$this->add('AM_FIELD_OPTION_VALUE_SORT_ORDER','products_options_sort_order'); // Sort column on product_attributes table

Share this post


Link to post
Share on other sites
Hi Greg,

 

Thanks for the reply. I still get

1054 - Unknown column 'products_options_sort_order' in 'order clause'

 

After running that sql query. This was my original question, I may not have worded clearly. How would I go about fixing this 1054 error?

 

Thanks

Did you change the Sort order option to true to false or not ?

in attributemanager/classes/attributeManagerConfig.class.php

 

$this->add('AM_USE_SORT_ORDER' , false);

Share this post


Link to post
Share on other sites

I have tried removing the sort column from my database and to run the contribution with

$this->add('AM_USE_SORT_ORDER' , false);

and i am not getting any errors, so you must have done something wrong.

 

Hellem, if you keep the switxh to off you do not need to comment out this 2 lines

Share this post


Link to post
Share on other sites

phocea

 

Is was already set like this:

$this->add('AM_USE_SORT_ORDER' , false);

 

That's way I // the two lines...

 

Is there any way to get these two fields into the tables? Then everything should work - right?? Maybe a small SQL query?

 

$this->add('AM_FIELD_OPTION_SORT_ORDER','products_options_sort_order'); // Sort column on Products_options table

$this->add('AM_FIELD_OPTION_VALUE_SORT_ORDER','products_options_sort_order'); // Sort column on product_attributes table

 

Helle :-)

Share this post


Link to post
Share on other sites

Note that just adding the 2 columns for the fun of it will let you store the sort order for the attributes and attributes values but if it is not used anywhere else on the catalogue there is not much point using this functionality :)

 

If you add this column or any other sort column using one of the contribution existing, make sure you also follow the changes on product_info

Share this post


Link to post
Share on other sites

That means - if I add Attributes Copier - I can "active" the sort columns?

One thing this really great contributions lacks - for my use anyway - is the option to fill in a download file - that would be SO awsome

 

- thanks for the fast reply

Share this post


Link to post
Share on other sites

Greg,

I have set the below code to true:

$this->add('AM_USE_SORT_ORDER' , true);

Changes are made in my product_info page but I still get the 1054 error.


Andrew Yuen

osCommerce, Community Team

Share this post


Link to post
Share on other sites

Hi,

 

 

ive just installed the 2.3b beta. with the admin access option

 

Getting when creating a product:

Fatal error: Call to undefined function: getallproductoptionsandvalues() in /home/mojointe/public_html/testbed/uk/admin/attributeManager/attributeManager.php on line 64

 

 

Any ideas what ive messed up? also the Attribute manager doesnt appear in the left column menu?

Edited by Pilly

Share this post


Link to post
Share on other sites

The same problem !!

 

Only can edit :angry:

 

When click new product :

 

Fatal error: Call to undefined method attributeManagerAtomic::getAllProductOptionsAndValues() in D:\WebServ\httpd\admin\attributeManager\attributeManager.php on line 63

 

I try bypass this on line 63:

 

if ($_GET['a']==1) {$allProductOptionsAndValues = $attributeManager->getAllProductOptionsAndValues();} else if ($_GET['a']==0) {}

 

'a' is my variable

 

but dont work :'( HELP ?

 

i try oder version v2.1-beta work,

v2.3-beta and v2.3b-beta dont work :'(

 

 

Any ideas what ive messed up? also the Attribute manager doesnt appear in the left column menu?

it's ok AJAX doesnt add to the left menu

Edited by pdm

Share this post


Link to post
Share on other sites

Ok i find this BUG :rolleyes:

 

to fix you have to edit attributeManager\classes\attributeManagerAtomic.class.php

 

Line 139:

 

Find:

// QT pro
/**
 * Updates the quantity on the products stock table
 * @access public
 * @author Phocea
 * @param $get $_GET
 * @return void
 */
function AddStockToProduct($get) {
	customprompt();
	$this->getAndPrepare('stockQuantity',$get,$stockQuantity);
	//$this->getAndPrepare('option_id', $get, $optionId);
	//$this->getAndPrepare('option_value_id', $get, $optionValueId);
	//$this->getAndPrepare('price', $get, $price);
	//$this->getAndPrepare('prefix', $get, $prefix);
	//$this->getAndPrepare('sortOrder', $get, $sortOrder);

	$this->arrSessionVar[] = array(
		'product_stock_quantity' => $productStockQuantity
	);
}
}

// QT pro

 

And replace:

 

// QT pro
/**
 * Updates the quantity on the products stock table
 * @access public
 * @author Phocea
 * @param $get $_GET
 * @return void
 */
function AddStockToProduct($get) {
	customprompt();
	$this->getAndPrepare('stockQuantity',$get,$stockQuantity);
	//$this->getAndPrepare('option_id', $get, $optionId);
	//$this->getAndPrepare('option_value_id', $get, $optionValueId);
	//$this->getAndPrepare('price', $get, $price);
	//$this->getAndPrepare('prefix', $get, $prefix);
	//$this->getAndPrepare('sortOrder', $get, $sortOrder);

	$this->arrSessionVar[] = array(
		'product_stock_quantity' => $productStockQuantity
	);

}

// QT pro

 

Find: on the end file

 

?>

 

And replace:

	}
?>

 

You should see on the end of the file something like this:

				if (AM_USE_SORT_ORDER) {
				$this->arrAllProductOptionsAndValues[$optionsId]['values'][$res['options_values_id']]['sortOrder'] = $res[AM_FIELD_OPTION_VALUE_SORT_ORDER];
			}
		}
	}
	return $this->arrAllProductOptionsAndValues;
}

}
?>

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

×