Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

AJAX Attribute Manager support


Guest

Recommended Posts

I am having problems with the sort order aspect of this contribution. Every time I change the sort order of the product attributes it only changes in the admin and not the actual product page. The template shows correct in the ajax attribute manager but that is it.

 

in the file admin/attributeManager/classes/attributeManagerConfig.class.php the directions say:

 

Change the column name to whatever your sort column is called on each of your database tables

 

$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

 

I used the contribution "Product Attrib Sort v1.2a" located at http://www.oscommerce.com/community/contributions,1822

Im a little confused about what column name to change. The sql file in the sort order contribution adds the column

"attribute_sort" to product attributes table. Is this what I change the above to?

 

If not what is the correct edit of this file. Any help will be greatly appreciated.

 

 

I am stuck at the same place and can't figure out what is ment by that discription! I am not a pro in phpmyadmin! :blush:

 

I would appreciate an HINT or HELP! THANKY YOU! :thumbsup:

IT?s ALL good!!!

Link to comment
Share on other sites

I am stuck at the same place and can't figure out what is ment by that discription! I am not a pro in phpmyadmin! :blush:

 

I would appreciate an HINT or HELP! THANKY YOU! :thumbsup:

 

Ok I seem to have good results with the following:

 

$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','attribute_sort'); // Sort column on product_attributes table

 

If i enter the attributes 1 at a time all is well. If I save as a template the a few tend to get out of place. The odd part is after you assign a template you can no longer re-order the options. It shows in the admin but not the product info page.

 

The problem has to be in the template code.

Link to comment
Share on other sites

Ok I seem to have good results with the following:

 

$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','attribute_sort'); // Sort column on product_attributes table

 

If i enter the attributes 1 at a time all is well. If I save as a template the a few tend to get out of place. The odd part is after you assign a template you can no longer re-order the options. It shows in the admin but not the product info page.

 

The problem has to be in the template code.

 

Ok thanks "Jcoleman2007"!

Just to get this right.....(I was working on this for sleepless days now :blink: )......that would mean just adding the 'attribute_sort' to the bottom line

 

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

 

would at least let me sort the attributes, right? :huh:

 

The top line

 

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

 

is not changed...???!!!

 

Is that right?

 

Sorry for double checking so much but I am just refreshing the database too often, since everytime something seems to go wrong with this! :'(

 

THANKS! :rolleyes:

IT?s ALL good!!!

Link to comment
Share on other sites

Ok thanks "Jcoleman2007"!

Just to get this right.....(I was working on this for sleepless days now :blink: )......that would mean just adding the 'attribute_sort' to the bottom line

 

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

 

would at least let me sort the attributes, right? :huh:

 

The top line

 

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

 

is not changed...???!!!

 

Is that right?

 

Sorry for double checking so much but I am just refreshing the database too often, since everytime something seems to go wrong with this! :'(

 

THANKS! :rolleyes:

 

Correct

 

Make sure you have the attribute sort contribution installed first. Then in the file admin\attributeManager\classes\attributeManagerConfig.class.php should look like this around line 66.

 

 

$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','attribute_sort'); // Sort column on product_attributes table

Link to comment
Share on other sites

The minus sign (- or remove) does not work.

Help me.

 

Thank you, but I found the solution to this problem here:

http://www.oscommerce.com/community/contri...all/search,ajax

 

I also have a contribution "Product Attrib Sort v1.2a"

And I would like to sort the attributes. Through Ajax attributes manager.

 

It is possible?

Link to comment
Share on other sites

After install, I got following error message in admin:

 

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /srv/www/vhosts/undersite.de/subdomains/wwl/httpdocs/catalog/admin/includes/functions/sessions.php on line 123

 

I got newest osCommerce Version: 2.2 RC2

Link to comment
Share on other sites

After install, I got following error message in admin:

 

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /srv/www/vhosts/undersite.de/subdomains/wwl/httpdocs/catalog/admin/includes/functions/sessions.php on line 123

 

I got newest osCommerce Version: 2.2 RC2

 

 

I'm receiving the same problem, haven't figured it out yet. hope so contrib will save me a major headache.

Link to comment
Share on other sites

I installed the AJAX Attribute Manager contribution on osCommerce 2.2-MS2.

 

We too stumbled on the double attributes problem, like when putting in sizes S,M,L the result would be S,M,L,S,M,L

 

This was the case when adding a new product and rightaway setting the attributes.

But when we add a new product to our shop, first save it and after that set the attributes we DON'T get double entries.....

 

 

 

No Joy on the slo...o...o...o...w input. Still getting double database entries. like the eyeglasses above:

 

color: green

green

red

red

blue

blue

doesn't seem to matter how I input I still get two of every option :'( any other ideas anyone?

 

Rad

Edited by Morgan^
Link to comment
Share on other sites

We too have installed Product Attrib Sort v1.2a together with AJAX Attribute Manager V2.7.1

 

At first it would also give errors , but with the following I got it going:

 

In the file admin/attributeManager/classes/attributeManagerConfig.class.php:

 

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

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

 

In the .sql from file Attrib Sort v1.2a I put:

 

ALTER TABLE products_attributes ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

ALTER TABLE products_options ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

 

Good luck :)

 

 

I am having problems with the sort order aspect of this contribution. Every time I change the sort order of the product attributes it only changes in the admin and not the actual product page. The template shows correct in the ajax attribute manager but that is it.

 

in the file admin/attributeManager/classes/attributeManagerConfig.class.php the directions say:

 

Change the column name to whatever your sort column is called on each of your database tables

 

$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

 

I used the contribution "Product Attrib Sort v1.2a" located at http://www.oscommerce.com/community/contributions,1822

Im a little confused about what column name to change. The sql file in the sort order contribution adds the column

"attribute_sort" to product attributes table. Is this what I change the above to?

 

If not what is the correct edit of this file. Any help will be greatly appreciated.

Edited by Morgan^
Link to comment
Share on other sites

When I try to add the "missing SQL instruction for templates to work fine." from the AJAX Attribute Manager V 2.7.1 FULL PACKAGE from ajuaristi (21 Jan 2008) I get the below mentioned error. I'm using MySQL 5, might that be the problem, I'm no MySQL expert so does anybody have a suggestion to solve it?

 

mysql> ALTER TABLE `am_attributes_to_templates` ADD ( options_values_price decimal( 15, 4 ) , price_prefixchar( 1 ) );

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( 1 ) )' at line 1

mysql>

 

Kind regards,

 

Morgan

Edited by Morgan^
Link to comment
Share on other sites

When I try to add the "missing SQL instruction for templates to work fine." from the AJAX Attribute Manager V 2.7.1 FULL PACKAGE from ajuaristi (21 Jan 2008) I get the below mentioned error. I'm using MySQL 5, might that be the problem, I'm no MySQL expert so does anybody have a suggestion to solve it?

Kind regards,

 

Morgan

 

The instruction has a mistake in it, it is missing a space between price_prefix and char

 

It should read

ALTER TABLE `am_attributes_to_templates` ADD (
options_values_price decimal( 15, 4 ) ,
price_prefix char( 1 )
)

Link to comment
Share on other sites

The instruction has a mistake in it, it is missing a space between price_prefix and char

 

It should read

ALTER TABLE `am_attributes_to_templates` ADD (
options_values_price decimal( 15, 4 ) ,
price_prefix char( 1 )
)

 

That worked :)

 

But now I get a new slightly different error when trying to create a template :(

 

1054 - Unknown column 'products_options_sort_order' in 'field list'

 

insert into am_attributes_to_templates (template_id, options_id, option_values_id, price_prefix, options_values_price, products_options_sort_order) values ('2', '1', '10', '+', '0.0000', '0')

Edited by Morgan^
Link to comment
Share on other sites

I'm sure it is supposed to make that alteration automaticallly but you could run this query instead

 

ALTER TABLE am_attributes_to_templates ADD COLUMN products_options_sort_order INT UNSIGNED NOT NULL DEFAULT '0';

Link to comment
Share on other sites

Thanks that made the template option finally work without giving errors :)

 

Only it doesn't work without flaws unfortunately.

 

1) The sortorder of the attributes is not saved in the template

 

2) When loading a template for a product, an empty option with (1) empty option value is added next to the existing option(s)???

 

 

screenshottemplatesz3.png

 

 

 

I'm sure it is supposed to make that alteration automaticallly but you could run this query instead

 

ALTER TABLE am_attributes_to_templates ADD COLUMN products_options_sort_order INT UNSIGNED NOT NULL DEFAULT '0';

Link to comment
Share on other sites

Please ignore point 2) of my previous post, for some reason I can't edit it anymore???

 

The problem with the "empty option with (1) empty option value in the template", that I meantioned in my previous post, had another reason which doesn't apply here, it's allready solved.

 

The only thing that I still need to resolve is the sort order in the template:

 

 

When I make a template of the following configuration:

 

savedtemplatemc5.png

 

 

Then when I load that template on a product, the order is inverted and the sort column gives 0,0,0,0 instead of 0,1,2,3:

 

afterloadingtemplateyy1.png

Edited by Morgan^
Link to comment
Share on other sites

I couldn't figure out why I couldn't add Product Options when adding a NEW product. Then I realized that, since the product had not been created (and thus not inserted into the Database), it has no way of knowing the product to which it should add the options.

 

So I inserted the AJAX Attribute Manager at the end of the admin/categories.php file, underneath the "Preview" & "Cancel" buttons with the following note:

"If you are adding a NEW product, you must first "PREVIEW" and then "INSERT" the product before you can add Product Options. You'll then need to re-select the product and "EDIT"."

 

Makes sense to me but I'm just curious if anyone else can add product options when inserting a NEW product?

Link to comment
Share on other sites

Hello

 

I tried to include to functionality to set the options-weight. now it works. but i had some things, i dont understand. probabely, somebody can answer my questions.

 

1. im an novice in php/javascript/ajax

 

2. i debugged the code with firebug (firefox extension). when i was debugging and deleted an option, the whole product gets deleted. when firebug is off, it works as designed. how can this be possible?

 

if somebody also want to use weight, you can contact me, i will send you the files. it works just with "add-weight-to-product-attributes v0.2". im also using the sort-funcionality.

 

Stefan

Link to comment
Share on other sites

have you managed to find the cause of the Warning: array_key_exists() error?

 

 

Actually Swapdude found a workaround and shared it with me, be sure to thank him! :-)

 

in admin/functions/sessions.php

 

if (PHP_VERSION < 4.3) {

return session_is_registered($variable);

} else {

return session_is_registered($variable);

//return isset($_SESSION) && (is_array($_SESSION) ? array_key_exists($variable, $_SESSION) : false);

// return (is_array($_SESSION) ? array_key_exists($variable, $_SESSION) : false);

}

}

 

change the else variable to return session_is_registered($variable);

Link to comment
Share on other sites

If anyone is having the issue with the sort order not being saved in the template, you may try this fix. Seems to be working for me..

 

first I applied Morgan's fix (thanks Morgan)..........

 

"At first it would also give errors , but with the following I got it going:

 

In the file admin/attributeManager/classes/attributeManagerConfig.class.php:

 

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

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

 

In the .sql from file Attrib Sort v1.2a I put:

 

ALTER TABLE products_attributes ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

ALTER TABLE products_options ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

 

................

 

Then

 

I renamed the column "products_options_sort_order" in the "am_attributes_to_templates" table to "attribute_sort" using PHPAdmin.

 

 

Finally I changed all instants of "products_options_sort_order" in attributemanager.class.php to "attribute_sort".

 

Did a few test and all seems to work well. Hope someone finds this useful

 

Nx

Link to comment
Share on other sites

That's great that you got the sort order working with templates :thumbsup:

 

Do you know the SQL instruction to rename the column "products_options_sort_order" in the "am_attributes_to_templates" table to "attribute_sort" ?

 

greeting Morgan

 

 

If anyone is having the issue with the sort order not being saved in the template, you may try this fix. Seems to be working for me..

 

first I applied Morgan's fix (thanks Morgan)..........

 

"At first it would also give errors , but with the following I got it going:

 

In the file admin/attributeManager/classes/attributeManagerConfig.class.php:

 

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

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

 

In the .sql from file Attrib Sort v1.2a I put:

 

ALTER TABLE products_attributes ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

ALTER TABLE products_options ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

 

................

 

Then

 

I renamed the column "products_options_sort_order" in the "am_attributes_to_templates" table to "attribute_sort" using PHPAdmin.

Finally I changed all instants of "products_options_sort_order" in attributemanager.class.php to "attribute_sort".

 

Did a few test and all seems to work well. Hope someone finds this useful

 

Nx

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