Jump to content
Nimmit

AJAX Attribute Manager support

Recommended Posts

Would anyone have any instructions for adding extra fields? I have a product attribute quantity modification on my store and I need to be able to input these values through AJAX AM. I have looked at the instructions for adding extra fields but they are very obscure and I think outdated.

 

I LOVE this contrib, just a few little tweaks here and there for me and it will be one of the best things I've ever installed on my osC store. I eagerly await your replies!

Share this post


Link to post
Share on other sites

Never mind, after a few hours I was able to figure out how to add an extra field and have it update and insert into the database when required.

 

Thanks for the contrib!

Share this post


Link to post
Share on other sites

Thanks Katerina423!!!

 

I made a corection and now everything works fine! Thanks again!

 

Zeldaz: would you be so nice and share your solution with us? Please?

 

 

Bojan

Share this post


Link to post
Share on other sites

Hello I just installed Installed this Contribution to my store but i get a WARNING message.

 

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /homepages/35/d178298060/htdocs/tush/admin/includes/functions/sessions.php on line 123

 

 

What should i do about this, what do I need to change in here: admin/includes/functions/sessions.php on line 123

 

This is what it says on line 123:

function tep_session_is_registered($variable) {

if (PHP_VERSION < 4.3) {

return session_is_registered($variable);

} else {

return isset($_SESSION) && array_key_exists($variable, $_SESSION);

}

}

Share this post


Link to post
Share on other sites

Erjon,

 

take a look the katerine123 (and other users) post:

 

Here it is:

 

 

 

OK, well, I have actually come up the same thing once, but found that there *maybe* a bug for some instances, as it seems that others are working fine without this issue.

 

To correct this, just do the following:

 

1. Open the "catalog\admin\attributeManager\classes\attributeManagerConfig.class.php"

2. Look for:

 

/**

* Install templates if not already done so

*/

$this->installTemplates();

 

3. Remove it!

 

4. Look for:

/**

* Install the sort order tables if they dont already exist

*/

$this->installSortOrder();

 

5. Remove it!!

 

6. Look for:

$this->add('AM_SESSION_SORT_ORDER_INSTALL_CHECKED','am_sort_order_checked');

$this->add('AM_SESSION_TEMPLATES_INSTALL_CHECKED','am_templates_checked');

$this->add('AM_ACTION_GET_VARIABLE', 'amAction'); // attribute manager get variable name

$this->add('AM_PAGE_ACTION_NAME','pageAction'); // attribute manager parent page action e.g. new_product

 

7. ADD AFTER:

/**

* Install templates if not already done so

*/

$this->installTemplates();

/**

* Install the sort order tables if they dont already exist

*/

$this->installSortOrder();

 

8. Should be done!

 

The main issue here is that the attribute manager is trying to initialize the templates and sort order without getting the parameters fully loaded. The above changes will ensure that the parameters are added to the instance before the initialization happens.

 

Hope this help.

 

BTW: Attribute Manager is GREAT!

 

 

 

 

Bojan

Share this post


Link to post
Share on other sites
Erjon,

 

take a look the katerine123 (and other users) post:

 

Here it is:

 

 

 

OK, well, I have actually come up the same thing once, but found that there *maybe* a bug for some instances, as it seems that others are working fine without this issue.

 

To correct this, just do the following:

 

1. Open the "catalog\admin\attributeManager\classes\attributeManagerConfig.class.php"

2. Look for:

 

/**

* Install templates if not already done so

*/

$this->installTemplates();

 

3. Remove it!

 

4. Look for:

/**

* Install the sort order tables if they dont already exist

*/

$this->installSortOrder();

 

5. Remove it!!

 

6. Look for:

$this->add('AM_SESSION_SORT_ORDER_INSTALL_CHECKED','am_sort_order_checked');

$this->add('AM_SESSION_TEMPLATES_INSTALL_CHECKED','am_templates_checked');

$this->add('AM_ACTION_GET_VARIABLE', 'amAction'); // attribute manager get variable name

$this->add('AM_PAGE_ACTION_NAME','pageAction'); // attribute manager parent page action e.g. new_product

 

7. ADD AFTER:

/**

* Install templates if not already done so

*/

$this->installTemplates();

/**

* Install the sort order tables if they dont already exist

*/

$this->installSortOrder();

 

8. Should be done!

 

The main issue here is that the attribute manager is trying to initialize the templates and sort order without getting the parameters fully loaded. The above changes will ensure that the parameters are added to the instance before the initialization happens.

 

Hope this help.

 

BTW: Attribute Manager is GREAT!

 

 

 

 

Bojan

 

Bojan

 

Thank you very much that did it! Now im just figuring it out how it works, but its pretty easy.

 

This contribution will save me a lot of time, this is a life savor.

 

**Before I had a problem with several of the products, the option values were not in order, and even though that this new attribute is installed the Option Values are still not ordered correctly just like how they did it with the regular oscommerce product attribute.

 

Option Value Example: Select Size: 26,28,29,25,27,31,24,32

 

I want those values to stay in order like this: 24,25,26,27,28,29,30,31,32

 

When i inserted them on the Option Value menu, I inserted them in order. Now 95% of the products are correctly ordered and the rest aren't!

 

Do you know any solution for this?

Share this post


Link to post
Share on other sites

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

select * from products_options where language_id='1' order by products_options_sort_order

 

For anyone having problems with this 1054 error when trying to install the sort order contribution, there are 3 columns missing in tables which are not obvious to fix

 

They are referenced in AttributeManagerconfig.class.php

 

amDB::query("ALTER TABLE ".TABLE_PRODUCTS_OPTIONS." ADD COLUMN ".$this->getValue('AM_FIELD_OPTION_SORT_ORDER')." INT UNSIGNED NOT NULL DEFAULT '0'");
amDB::query("ALTER TABLE ".TABLE_PRODUCTS_ATTRIBUTES." ADD COLUMN ".$this->getValue('AM_FIELD_OPTION_VALUE_SORT_ORDER')." INT UNSIGNED NOT NULL DEFAULT '0'");
amDB::query("ALTER TABLE ".$this->getValue('AM_TABLE_ATTRIBUTES_TO_TEMPLATES')." ADD COLUMN ".$this->getValue('AM_FIELD_OPTION_SORT_ORDER')." INT UNSIGNED NOT NULL DEFAULT '0'");

 

so basically you need to run 3 queries in mysql which are as follows

 

ALTER TABLE products_options ADD products_options_values_sort_order int(6) NOT NULL default '0'
ALTER TABLE products_attributes ADD AM_FIELD_OPTION_VALUE_SORT_ORDER int(6) NOT NULL default '0'
ALTER TABLE products_options ADD AM_FIELD_OPTION_SORT_ORDER int(6) NOT NULL default '0'

 

Do that, install your attribute sort contribution and then enable attribute sorting by changing this line

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

in AttributeManagerconfig.class.php to

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

 

This should sort the errors and get your attribute maneger to show iwth sort fileds and no errors

 

I hope that helps

 

Dave

Share this post


Link to post
Share on other sites

If someone have problems with language page given in output without reading php code, just find any <? tag and replace with <?php, this will fix the problem.

On many other parts of this contrib, the programmer forgot "php" after <? so try with this if you find language problems followed by output problems, is the simplest thing to do..

Share this post


Link to post
Share on other sites

WOW this i just what I was looking for unfortunately i'm one of those strange people who like IE and when trying to edit or create a new product I just get af blank page in IE7 it wors fine in firefox and Google Chrome. It's because of a script error when checking the details it says something about not beeing able to set focus on af hidden or invisible object?

 

Does any one know how to fix this?

Share this post


Link to post
Share on other sites
Never mind, after a few hours I was able to figure out how to add an extra field and have it update and insert into the database when required.

 

Thanks for the contrib!

 

 

Hi James

I don't suppose you would like to share how you were able to acheive this? :blink:

Share this post


Link to post
Share on other sites

Hello.

 

Im configuring the store to work with multilanguage.

With my defaut language (portugues) selected from the dropbox in the admin/index.php page and then edit the product all works perfectly.

 

The problem is when I go to admin/index.php and select a nother language, english, spanish or german, then go edit a product I get the error below:

 

Warning: Cannot modify header information - headers already sent by (output started at D:\IIS\store\admin\attributeManager\languages\english\attributeManager.php:1) in D:\IIS\store\admin\attributeManager\attributeManager.php on line 72

 

First I hade the version 2.8.2 so I updated to 2.8.5 but still have the same problem.

 

Ive got trough this thread and found a similar problem with the session.php so I updated my files with that fix, but did not resolve my problem.

Does anyone know how to fix this problem?

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I am having problems with AJAX Attribute Manager not running with Ultra Pics. If I remove Ultra Pics and install Attribute manager it runs no problems but soon as I install Ultra Pics it doesn't show on the New Products page at all. Can anyone help?

 

Thanks.

Share this post


Link to post
Share on other sites

I made all the edits to categories.php but when I enter to Attribute in the admin, the regular attribute manager appears.

 

The thing is that when I click Attributes the browser goes to

http://www.....com/admin/products_attributes.php

So, I don't see how editing categories.php would affect browsing product_attributes.php

 

I installed version 2.8.5

 

I don't have additional addons that affect the admin functoin (STS but as far as I know, that only affects the front-end)

 

What am I missing?

 

I tried some searches and read some of the 40 pages of this thread but I didn't find anything (I didn't read the whole 40 pages).

 

Thanks in advance

Share this post


Link to post
Share on other sites

Hi love the contribution,

 

Has anyone got this to work with RC2a im getting session id errors

 

Session not registered - You cant access this page directly

 

help please

Share this post


Link to post
Share on other sites
Hello.

 

Im configuring the store to work with multilanguage.

With my defaut language (portugues) selected from the dropbox in the admin/index.php page and then edit the product all works perfectly.

 

The problem is when I go to admin/index.php and select a nother language, english, spanish or german, then go edit a product I get the error below:

 

Warning: Cannot modify header information - headers already sent by (output started at D:\IIS\store\admin\attributeManager\languages\english\attributeManager.php:1) in D:\IIS\store\admin\attributeManager\attributeManager.php on line 72

 

First I hade the version 2.8.2 so I updated to 2.8.5 but still have the same problem.

 

Ive got trough this thread and found a similar problem with the session.php so I updated my files with that fix, but did not resolve my problem.

Does anyone know how to fix this problem?

 

Thanks

 

You have white spaces more than likely check at end of the files make sure it ends like this

last line of code

?>

 

and not

last line of code

 

?>

Share this post


Link to post
Share on other sites
Hi love the contribution,

 

Has anyone got this to work with RC2a im getting session id errors

 

Session not registered - You cant access this page directly

 

help please

Update here is list of error in firefox

 

Error: uncaught exception: [Exception... "Node cannot be used in a document other than the one in which it was created" code: "4" nsresult: "0x80530004 (NS_ERROR_DOM_WRONG_DOCUMENT_ERR)" location: "file:///D:/Documents%20and%20Settings/steve/Application%20Data/Mozilla/Firefox/Profiles/line79wt.default/extensions/%7B3112ca9c-de6d-4884-a869-9855de68056c%7D/components/bootstrap.js -> file:///D:/Documents%20and%20Settings/steve/Application%20Data/Mozilla/Firefox/Profiles/line79wt.default/extensions/%7B3112ca9c-de6d-4884-a869-9855de68056c%7D/lib/toolbar.js Line: 1"]

 

if i remove the session and cant access directly function and protect folder with a .htaccess will this be sufficent?

Share this post


Link to post
Share on other sites
WOW this i just what I was looking for unfortunately i'm one of those strange people who like IE and when trying to edit or create a new product I just get af blank page in IE7 it wors fine in firefox and Google Chrome. It's because of a script error when checking the details it says something about not beeing able to set focus on af hidden or invisible object?

 

Does any one know how to fix this?

Replace the <body> tag in categories.php with this one

<body onload="goOnLoad();">

 

it will now work in IE

Share this post


Link to post
Share on other sites
You have white spaces more than likely check at end of the files make sure it ends like this

last line of code

?>

 

and not

last line of code

 

?>

 

Hi steve,

 

I checked both files:

D:\IIS\store\admin\attributeManager\languages\english\attributeManager.php

and

D:\IIS\store\admin\attributeManager\attributeManager.php

 

and found no spaces betwin code and the last ?> of the files.

 

Here is the ending code of my D:\IIS\store\admin\attributeManager\attributeManager.php file

 

?>

<td>

<?php echo tep_draw_input_field("stockQuantity", $db_quantity, ' style="margin:3px 0px 3px 0px;" id="stockQuantity" size="4"'); ?>

</td>

<td valign="top">

<input type="image" src="attributeManager/images/icon_add.png" value="Add" onclick="return root('<?php echo implode(",", $dropDownOptions); ?>');" title="<?=AM_AJAX_UPDATE_OR_INSERT_ATTRIBUTE_COMBINATIONBY_QUANTITY?>" border="0" /><br/>t:

</td>

</tr>

</table>

<?php

if(!isset($_GET['target']))

echo '</div>';

} // end target = newProductStockValue

if(!isset($_GET['target']))

echo '</div>';

?>

<?php

} // End QT Pro Plugin

?>

 

and my D:\IIS\store\admin\attributeManager\languages\english\attributeManager.php file:

<?

/*

$Id: attributeManager.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

 

English translation to AJAX-AttributeManager-V2.7

 

by Shimon Doodkin

http://help.me.pro.googlepages.com

helpmepro1@gmail.com

*/

 

//attributeManagerPrompts.inc.php

define('AM_AJAX_YES', 'Yes');

define('AM_AJAX_NO', 'No');

define('AM_AJAX_UPDATE', 'Update');

define('AM_AJAX_CANCEL', 'Cancel');

define('AM_AJAX_OK', 'OK');

define('AM_AJAX_SORT', 'Sort:');

define('AM_AJAX_TRACK_STOCK', 'Track Stock?');

define('AM_AJAX_TRACK_STOCK_IMGALT', 'Track this attribute stock ?');

define('AM_AJAX_ENTER_NEW_OPTION_NAME', 'Please enter a new Option Name');

define('AM_AJAX_ENTER_NEW_OPTION_VALUE_NAME', 'Please enter a new Option Name');

define('AM_AJAX_ENTER_NEW_OPTION_VALUE_NAME_TO_ADD_TO', 'Please enter a new Option Value Name to add to %s');

define('AM_AJAX_PROMPT_REMOVE_OPTION_AND_ALL_VALUES', 'Are you sure you want to remove %s and all the values below it from this product?');

define('AM_AJAX_PROMPT_REMOVE_OPTION', 'Are you sure you want to remove %s from this product?');

define('AM_AJAX_PROMPT_STOCK_COMBINATION', 'Are you sure you want to remove this stock combination from this product?');

define('AM_AJAX_PROMPT_LOAD_TEMPLATE', 'Are you sure you want to load the %s Template? <br />This will overwrite this products current options and cannot be undone.');

define('AM_AJAX_NEW_TEMPLATE_NAME_HEADER', 'Please enter a new name for the new Template. Or...');

define('AM_AJAX_NEW_NAME', 'New Name:');

define('AM_AJAX_CHOOSE_EXISTING_TEMPLATE_TO_OVERWRITE', ' ...<br /> ... Choose an existing one to overwrite');

define('AM_AJAX_CHOOSE_EXISTING_TEMPLATE_TITLE', 'Existing:');

define('AM_AJAX_RENAME_TEMPLATE_ENTER_NEW_NAME', 'Please enter the new name for the %s Template');

define('AM_AJAX_PROMPT_DELETE_TEMPLATE', 'Are you sure you want to delete the %s Template?<br>This cannot be undone!');

//attributeManager.php

define('AM_AJAX_ADDS_ATTRIBUTE_TO_OPTION', 'Adds the selected attribute on the left to the %s option');

define('AM_AJAX_ADDS_NEW_VALUE_TO_OPTION', 'Adds a new value to the %s option');

define('AM_AJAX_PRODUCT_REMOVES_OPTION_AND_ITS_VALUES', 'Removes the option %1$s and the %2$d option value(s) below it from this product');

define('AM_AJAX_CHANGES', 'Changes');

define('AM_AJAX_LOADS_SELECTED_TEMPLATE', 'Loads the selected template');

define('AM_AJAX_SAVES_ATTRIBUTES_AS_A_NEW_TEMPLATE', 'Saves the current attributes as a new template');

define('AM_AJAX_RENAMES_THE_SELECTED_TEMPLATE', 'Renames the selected template');

define('AM_AJAX_DELETES_THE_SELECTED_TEMPLATE', 'Deletes the selected template');

define('AM_AJAX_NAME', 'Name');

define('AM_AJAX_ACTION', 'Action');

define('AM_AJAX_PRODUCT_REMOVES_VALUE_FROM_OPTION', 'Removes %1$s from %2$s, from this product');

define('AM_AJAX_MOVES_VALUE_UP', 'Moves option value up');

define('AM_AJAX_MOVES_VALUE_DOWN', 'Moves option value down');

define('AM_AJAX_ADDS_NEW_OPTION', 'Adds a new option to the list');

define('AM_AJAX_OPTION', 'Option:');

define('AM_AJAX_VALUE', 'Value:');

define('AM_AJAX_PREFIX', 'Prefix:');

define('AM_AJAX_PRICE', 'Price:');

define('AM_AJAX_SORT', 'Sort:');

define('AM_AJAX_ADDS_NEW_OPTION_VALUE', 'Adds a new option value to the list');

define('AM_AJAX_ADDS_ATTRIBUTE_TO_PRODUCT', 'Adds the attribute to the current product');

define('AM_AJAX_QUANTITY', 'Quantity');

define('AM_AJAX_PRODUCT_REMOVE_ATTRIBUTE_COMBINATION_AND_STOCK', 'Removes this attribute combination and stock from this product');

define('AM_AJAX_UPDATE_OR_INSERT_ATTRIBUTE_COMBINATIONBY_QUANTITY', 'Update or Insert the attribute combination with the given quantity');

//attributeManager.class.php

define('AM_AJAX_TEMPLATES', '-- Templates --');

?>

 

And where error code points to line 72 I have:

header('Content-type: text/html; charset='.CHARSET);

 

I realy dont know whats going on.

With my defaut language (portugues) selected from the dropbox in the admin/index.php page and then edit the product all works perfectly. no errors

 

The problem is when I go to admin/index.php and select a nother language, english, spanish or german, then go edit a product I get the error.

 

Hope someone has the solution for this.

Thanks

Share this post


Link to post
Share on other sites
I made all the edits to categories.php but when I enter to Attribute in the admin, the regular attribute manager appears.

 

The thing is that when I click Attributes the browser goes to

http://www.....com/admin/products_attributes.php

So, I don't see how editing categories.php would affect browsing product_attributes.php

 

I installed version 2.8.5

 

I don't have additional addons that affect the admin functoin (STS but as far as I know, that only affects the front-end)

 

What am I missing?

 

I tried some searches and read some of the 40 pages of this thread but I didn't find anything (I didn't read the whole 40 pages).

 

Thanks in advance

 

Hi i had a similiar proble with attibutes sets clicked on attirbutes and took me to product preview page in admin, problem was my browser no program

Share this post


Link to post
Share on other sites
Bojan

 

Thank you very much that did it! Now im just figuring it out how it works, but its pretty easy.

 

This contribution will save me a lot of time, this is a life savor.

 

**Before I had a problem with several of the products, the option values were not in order, and even though that this new attribute is installed the Option Values are still not ordered correctly just like how they did it with the regular oscommerce product attribute.

 

Option Value Example: Select Size: 26,28,29,25,27,31,24,32

 

I want those values to stay in order like this: 24,25,26,27,28,29,30,31,32

 

When i inserted them on the Option Value menu, I inserted them in order. Now 95% of the products are correctly ordered and the rest aren't!

 

Do you know any solution for this?

 

Install this http://www.oscommerce.com/community/contributions,1822

then follow instructions at bottom of ajax attrbitutes manager install

Edited by steve_s

Share this post


Link to post
Share on other sites

hi. im having trouble with the sort order to work.

 

its working with the ordinary attribute "manager" and it shows the right values in the ajax manager. but it does not save the values.

 

i have altered the sort order values and altered to the same value in 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

 

price and alle other fields are updated fine.

 

but i also dont see file download options. i can also see in the code that some buttons are missing.

 

 

i have even tried to not alter the sort order fields and its still the same result

osc22

browser IE + firefox

other info ?

Edited by mortal

Share this post


Link to post
Share on other sites

ok. it seems to be working for the previous version. int stated as version 284. but the filename is called 283 ?

 

i have a further question. whet ever i try to alter on the attributeManager.php file does not seem to show up.

 

is there som kind of cache i dan disable or what ? i have tried to empty browser cache and so forth

Share this post


Link to post
Share on other sites
ok. it seems to be working for the previous version. int stated as version 284. but the filename is called 283 ?

 

i have a further question. whet ever i try to alter on the attributeManager.php file does not seem to show up.

 

is there som kind of cache i dan disable or what ? i have tried to empty browser cache and so forth

 

Use firefox, clear error console under tools, before you add, alter anything, then look at error console to see if there are any errors

Share this post


Link to post
Share on other sites

I have installed the AJAX Attribute Magager (http://www.oscommerce.com/community/contributions,4063) and the Product Attributes Sort Order(http://www.oscommerce.com/community/contributions,1822) modules. When i edit a product now, I get the nice AJAX table of options, but it does not appear to be saving all the time, and I have issues trying to move items up or down. Sometimes they will move up and down fine, other times not at all. Also, it seems to be losing the sort order from time to time. I'll edit a product 1 time, go back in and the order is all wrong. I also have 2 "categories" of attributes, Size and Color. If I try to move Size above Color, that's when the order seems to get messed up, and the Size category does not go above Color Can someone help me get his working? This would be a great addon if I could get it to work.

 

Also, just a side note, on the product info page, Size is listed above Color.

 

Thanks.

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

×